Coverage for /pythoncovmergedfiles/medio/medio/src/python-crc32c/src/google_crc32c/__config__.py: 31%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

16 statements  

1# Copyright 2018 Google LLC 

2# 

3# Licensed under the Apache License, Version 2.0 (the "License"); 

4# you may not use this file except in compliance with the License. 

5# You may obtain a copy of the License at 

6# 

7# https://www.apache.org/licenses/LICENSE-2.0 

8# 

9# Unless required by applicable law or agreed to in writing, software 

10# distributed under the License is distributed on an "AS IS" BASIS, 

11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 

12# See the License for the specific language governing permissions and 

13# limitations under the License. 

14 

15import os 

16 

17 

18def modify_path(): 

19 """Modify the module search path.""" 

20 # Only modify path on Windows. 

21 if os.name != "nt": 

22 return 

23 

24 path = os.environ.get("PATH") 

25 if path is None: 

26 return 

27 

28 try: 

29 from importlib.resources import files as _resources_files 

30 

31 extra_dll_dir = str(_resources_files("google_crc32c") / "extra-dll") 

32 if os.path.isdir(extra_dll_dir): 

33 # Python 3.8+ uses add_dll_directory. 

34 os.add_dll_directory(extra_dll_dir) 

35 except ImportError: 

36 pass 

37 

38modify_path()