[Python-checkins] r45416 - sandbox/branches/setuptools-0.6/setuptools/command/build_py.py
phillip.eby
python-checkins at python.org
Sat Apr 15 07:33:00 CEST 2006
Author: phillip.eby
Date: Sat Apr 15 07:33:00 2006
New Revision: 45416
Modified:
sandbox/branches/setuptools-0.6/setuptools/command/build_py.py
Log:
Backport absolute path trapping to the 0.6 branch.
Modified: sandbox/branches/setuptools-0.6/setuptools/command/build_py.py
==============================================================================
--- sandbox/branches/setuptools-0.6/setuptools/command/build_py.py (original)
+++ sandbox/branches/setuptools-0.6/setuptools/command/build_py.py Sat Apr 15 07:33:00 2006
@@ -84,18 +84,20 @@
self.manifest_files = mf = {}
if not self.distribution.include_package_data:
return
-
src_dirs = {}
for package in self.packages or ():
# Locate package source directory
- src_dirs[self.get_package_dir(package)] = package
+ src_dirs[assert_relative(self.get_package_dir(package))] = package
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(path)
- while d and d not in src_dirs:
+ if path.endswith('.py'):
+ continue
+ d,f = os.path.split(assert_relative(path))
+ prev = None
+ 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:
@@ -119,8 +121,6 @@
for filename in filenames
]
-
-
def check_package(self, package, package_dir):
"""Check namespace packages' __init__ for declare_namespace"""
try:
@@ -177,19 +177,19 @@
return [f for f in files if f not in bad]
-
-
-
-
-
-
-
-
-
-
-
-
-
+def assert_relative(path):
+ if not os.path.isabs(path):
+ return path
+ from distutils.errors import DistutilsSetupError
+ raise DistutilsSetupError(
+"""Error: setup script specifies an absolute path:
+
+ %s
+
+setup() arguments must *always* be /-separated paths relative to the
+setup.py directory, *never* absolute paths.
+""" % path
+ )
More information about the Python-checkins
mailing list