1 diff --git a/omp/__init__.py b/omp/__init__.py
2 index 3801d1c8c..a93a74d6f 100644
5 @@ -48,72 +48,8 @@ class OpenMP(object):
6 return ['omp', 'gomp', 'iomp5']
8 def init_not_msvc(self):
9 - """ Find OpenMP library and try to load if using ctype interface. """
10 - # find_library() does not automatically search LD_LIBRARY_PATH
11 - # until Python 3.6+, so we explicitly add it.
12 - # LD_LIBRARY_PATH is used on Linux, while macOS uses DYLD_LIBRARY_PATH
13 - # and DYLD_FALLBACK_LIBRARY_PATH.
15 - if sys.platform == 'darwin':
16 - env_vars = ['DYLD_LIBRARY_PATH', 'DYLD_FALLBACK_LIBRARY_PATH']
18 - env_vars = ['LD_LIBRARY_PATH']
21 - for env_var in env_vars:
22 - env_paths = os.environ.get(env_var, '')
24 - paths.extend(env_paths.split(os.pathsep))
27 - libomp_names = self.get_libomp_names()
30 - for libomp_name in libomp_names:
32 - '-print-file-name=lib{}{}'.format(
34 - get_shared_lib_extension())]
35 - # The subprocess can fail in various ways, including because it
36 - # doesn't support '-print-file-name'. In that case just give up.
38 - output = check_output(cmd,
40 - path = os.path.dirname(output.decode().strip())
43 - except (OSError, CalledProcessError):
47 - for libomp_name in libomp_names:
48 - # Try to load find libomp shared library using loader search dirs
49 - libomp_path = find_library(libomp_name)
51 - # Try to use custom paths if lookup failed
54 - candidate_path = os.path.join(
56 - 'lib{}{}'.format(libomp_name,
57 - get_shared_lib_extension()))
58 - if os.path.isfile(candidate_path):
59 - libomp_path = candidate_path
65 - self.libomp = ctypes.CDLL(libomp_path)
67 - raise ImportError("found openMP library '{}' but couldn't load it. "
68 - "This may happen if you are cross-compiling.".format(libomp_path))
72 - raise ImportError("I can't find a shared library for libomp, you may need to install it "
73 - "or adjust the {} environment variable.".format(env_vars[0]))
75 + self.libomp = ctypes.CDLL("@gomp@")
78 def __getattr__(self, name):