Commit 4869239f authored by PJ Eby's avatar PJ Eby

Detect .dll, .so, .dylib and .pyd files that might have

been included in a project as data files rather than as
Python extensions.

--HG--
branch : setuptools
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041409
parent ba813fa5
...@@ -288,31 +288,31 @@ class bdist_egg(Command): ...@@ -288,31 +288,31 @@ class bdist_egg(Command):
def get_ext_outputs(self): def get_ext_outputs(self):
"""Get a list of relative paths to C extensions in the output distro""" """Get a list of relative paths to C extensions in the output distro"""
outputs = []
paths = {self.bdist_dir:''}
for base, dirs, files in os.walk(self.bdist_dir):
for filename in files:
if os.path.splitext(filename)[1].lower() in NATIVE_EXTENSIONS:
outputs.append(paths[base]+filename)
for filename in dirs:
paths[os.path.join(base,filename)] = paths[base]+filename+'/'
if not self.distribution.has_ext_modules(): if not self.distribution.has_ext_modules():
return [] return outputs
build_cmd = self.get_finalized_command('build_ext') build_cmd = self.get_finalized_command('build_ext')
prefix_len = len(build_cmd.build_lib) + len(os.sep) prefix_len = len(build_cmd.build_lib) + len(os.sep)
outputs = []
for filename in build_cmd.get_outputs(): for filename in build_cmd.get_outputs():
outputs.append(filename[prefix_len:]) if os.path.splitext(filename)[1].lower() not in NATIVE_EXTENSIONS:
# only add files w/unrecognized extensions, since the
# recognized ones will already be in the list
outputs.append(filename[prefix_len:])
return outputs return outputs
NATIVE_EXTENSIONS = dict.fromkeys('.dll .so .dylib .pyd'.split())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment