diff options
author | xoviat <xoviat@users.noreply.github.com> | 2017-12-24 09:44:47 -0600 |
---|---|---|
committer | xoviat <xoviat@users.noreply.github.com> | 2017-12-24 09:46:48 -0600 |
commit | 473a6f067267e752cbfd2c163e95a0387ccb06b5 (patch) | |
tree | 6f422bfd38b33ba9c5c8dce8327cb2bfc2cef1ea /numpy/distutils | |
parent | 986268bed067899af8de456afb93209230a34e1a (diff) | |
download | numpy-473a6f067267e752cbfd2c163e95a0387ccb06b5.tar.gz |
BUG: distutils: use correct top-level package name
Here, we align the extra-dll name to the one
that auditwheel uses, and we handle the case where
1) there is more than one root package and
2) the root package name is different
than the distribution name
Diffstat (limited to 'numpy/distutils')
-rw-r--r-- | numpy/distutils/command/build_ext.py | 30 | ||||
-rw-r--r-- | numpy/distutils/misc_util.py | 2 |
2 files changed, 21 insertions, 11 deletions
diff --git a/numpy/distutils/command/build_ext.py b/numpy/distutils/command/build_ext.py index d935a3303..eca62fff4 100644 --- a/numpy/distutils/command/build_ext.py +++ b/numpy/distutils/command/build_ext.py @@ -120,7 +120,7 @@ class build_ext (old_build_ext): self.compiler.show_customization() # Setup directory for storing generated extra DLL files on Windows - self.extra_dll_dir = os.path.join(self.build_temp, 'extra-dll') + self.extra_dll_dir = os.path.join(self.build_temp, '.libs') if not os.path.isdir(self.extra_dll_dir): os.makedirs(self.extra_dll_dir) @@ -262,15 +262,25 @@ class build_ext (old_build_ext): self.build_extensions() # Copy over any extra DLL files - runtime_lib_dir = os.path.join( - self.build_lib, self.distribution.get_name(), 'extra-dll') - for fn in os.listdir(self.extra_dll_dir): - if not fn.lower().endswith('.dll'): - continue - if not os.path.isdir(runtime_lib_dir): - os.makedirs(runtime_lib_dir) - runtime_lib = os.path.join(self.extra_dll_dir, fn) - copy_file(runtime_lib, runtime_lib_dir) + # FIXME: In the case where there are more than two packages, + # we blindly assume that both packages need all of the libraries, + # resulting in a larger wheel than is required. This should be fixed, + # but it's so rare that I won't bother to handle it. + pkg_roots = set( + self.get_ext_fullname(ext.name).split('.')[0] + for ext in self.extensions + ) + for pkg_root in pkg_roots: + shared_lib_dir = os.path.join(pkg_root, '.libs') + if not self.inplace: + shared_lib_dir = os.path.join(self.build_lib, shared_lib_dir) + if not os.path.isdir(shared_lib_dir): + os.makedirs(shared_lib_dir) + for fn in os.listdir(self.extra_dll_dir): + if not fn.lower().endswith('.dll'): + continue + runtime_lib = os.path.join(self.extra_dll_dir, fn) + copy_file(runtime_lib, shared_lib_dir) def swig_sources(self, sources): # Do nothing. Swig sources have beed handled in build_src command. diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py index 8bf69ffbd..93af72375 100644 --- a/numpy/distutils/misc_util.py +++ b/numpy/distutils/misc_util.py @@ -2290,7 +2290,7 @@ def generate_config_py(target): # For gfortran+msvc combination, extra shared libraries may exist f.write(""" import os -extra_dll_dir = os.path.join(os.path.dirname(__file__), 'extra-dll') +extra_dll_dir = os.path.join(os.path.dirname(__file__), '.libs') if os.path.isdir(extra_dll_dir): os.environ["PATH"] += os.pathsep + extra_dll_dir """) |