summaryrefslogtreecommitdiff
path: root/setuptools/command
diff options
context:
space:
mode:
authorphillip.eby <phillip.eby@6015fed2-1504-0410-9fe1-9d1591cc4771>2006-04-15 05:32:16 +0000
committerphillip.eby <phillip.eby@6015fed2-1504-0410-9fe1-9d1591cc4771>2006-04-15 05:32:16 +0000
commitcfd7ef7aa74a3b29ae919a89237c2ae43858bf3c (patch)
tree70033a7e202b537206e76a0f2c014bc71e4ab841 /setuptools/command
parent768c5f87b5ba8e7ef729e68fcceae18050d1bf42 (diff)
downloadpython-setuptools-cfd7ef7aa74a3b29ae919a89237c2ae43858bf3c.tar.gz
Trap absolute paths given as package_dirs, which foul up things terribly.
git-svn-id: http://svn.python.org/projects/sandbox/trunk/setuptools@45415 6015fed2-1504-0410-9fe1-9d1591cc4771
Diffstat (limited to 'setuptools/command')
-rw-r--r--setuptools/command/build_py.py36
1 files changed, 18 insertions, 18 deletions
diff --git a/setuptools/command/build_py.py b/setuptools/command/build_py.py
index 0602e7f..d820710 100644
--- a/setuptools/command/build_py.py
+++ b/setuptools/command/build_py.py
@@ -84,18 +84,20 @@ class build_py(_build_py):
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 @@ class build_py(_build_py):
for filename in filenames
]
-
-
def check_package(self, package, package_dir):
"""Check namespace packages' __init__ for declare_namespace"""
try:
@@ -177,19 +177,19 @@ class build_py(_build_py):
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
+ )