summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPJ Eby <distutils-sig@python.org>2005-11-09 03:23:34 +0000
committerPJ Eby <distutils-sig@python.org>2005-11-09 03:23:34 +0000
commit4869239fcea5c102385155550c3005b3f92ecfe5 (patch)
tree583f9cb537580ab376cd00636b1157720014fd27
parentba813fa50adbaff2ecaa16015adcb22167e20e02 (diff)
downloadpython-setuptools-git-4869239fcea5c102385155550c3005b3f92ecfe5.tar.gz
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
-rw-r--r--setuptools/command/bdist_egg.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py
index dd30ffbd..9003542f 100644
--- a/setuptools/command/bdist_egg.py
+++ b/setuptools/command/bdist_egg.py
@@ -288,31 +288,31 @@ class bdist_egg(Command):
def get_ext_outputs(self):
"""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():
- return []
+ return outputs
build_cmd = self.get_finalized_command('build_ext')
prefix_len = len(build_cmd.build_lib) + len(os.sep)
- 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
-
-
-
-
-
-
-
-
-
-
-
-
+NATIVE_EXTENSIONS = dict.fromkeys('.dll .so .dylib .pyd'.split())