aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command/build_py.py
diff options
context:
space:
mode:
authorPJ Eby <distutils-sig@python.org>2006-06-09 18:26:45 +0000
committerPJ Eby <distutils-sig@python.org>2006-06-09 18:26:45 +0000
commitf01c17e9e6301a72c54a0b3a5b9d1e21449e4e51 (patch)
tree3dd5cc37b5f43f952c82740a90a979f9bedb7b52 /setuptools/command/build_py.py
parent977692d0a929ef4d03b8f9181f2c29fa1fbdd57e (diff)
downloadexternal_python_setuptools-f01c17e9e6301a72c54a0b3a5b9d1e21449e4e51.tar.gz
external_python_setuptools-f01c17e9e6301a72c54a0b3a5b9d1e21449e4e51.tar.bz2
external_python_setuptools-f01c17e9e6301a72c54a0b3a5b9d1e21449e4e51.zip
Allow .py files found by the include_package_data option to be
automatically included. Remove duplicate data file matches if both include_package_data and package_data are used to refer to the same files. (merge from trunk) --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4046791
Diffstat (limited to 'setuptools/command/build_py.py')
-rw-r--r--setuptools/command/build_py.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/setuptools/command/build_py.py b/setuptools/command/build_py.py
index 373930ac..79570bc2 100644
--- a/setuptools/command/build_py.py
+++ b/setuptools/command/build_py.py
@@ -92,18 +92,18 @@ class build_py(_build_py):
self.run_command('egg_info')
ei_cmd = self.get_finalized_command('egg_info')
for path in ei_cmd.filelist.files:
- if path.endswith('.py'):
- continue
d,f = os.path.split(assert_relative(path))
prev = None
+ oldf = f
while d and d!=prev and d not in src_dirs:
prev = d
d, df = os.path.split(d)
f = os.path.join(df, f)
if d in src_dirs:
+ if path.endswith('.py') and f==oldf:
+ continue # it's a module, not data
mf.setdefault(src_dirs[d],[]).append(path)
-
def get_data_files(self): pass # kludge 2.4 for lazy computation
if sys.version<"2.4": # Python 2.4 already has this code
@@ -167,14 +167,18 @@ class build_py(_build_py):
globs = (self.exclude_package_data.get('', [])
+ self.exclude_package_data.get(package, []))
bad = []
- for pattern in globs:
+ for pattern in globs:
bad.extend(
fnmatch.filter(
files, os.path.join(src_dir, convert_path(pattern))
)
)
bad = dict.fromkeys(bad)
- return [f for f in files if f not in bad]
+ seen = {}
+ return [
+ f for f in files if f not in bad
+ and f not in seen and seen.setdefault(f,1) # ditch dupes
+ ]
def assert_relative(path):
@@ -199,7 +203,3 @@ setup.py directory, *never* absolute paths.
-
-
-
-