summaryrefslogtreecommitdiff
path: root/setuptools
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2016-01-16 06:33:04 -0500
committerJason R. Coombs <jaraco@jaraco.com>2016-01-16 06:33:04 -0500
commitf07c8b9864016b12d0bdc1e60d62200a50bd8b5a (patch)
tree051771492d902838f0ac1aa07875bf5ae17c96f1 /setuptools
parentf33971d8f230ac52e2b85da86e27ec4acd32cb25 (diff)
downloadpython-setuptools-bitbucket-f07c8b9864016b12d0bdc1e60d62200a50bd8b5a.tar.gz
Prefer relpath to string slicing for computing a path relative to a base. Fixes #341.
Diffstat (limited to 'setuptools')
-rw-r--r--setuptools/command/build_py.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/setuptools/command/build_py.py b/setuptools/command/build_py.py
index 5021bd1f..0c1026aa 100644
--- a/setuptools/command/build_py.py
+++ b/setuptools/command/build_py.py
@@ -84,12 +84,10 @@ class build_py(orig.build_py, Mixin2to3):
# Compute package build directory
build_dir = os.path.join(*([self.build_lib] + package.split('.')))
- # Length of path to strip from found files
- plen = len(src_dir) + 1
-
# Strip directory from globbed filenames
filenames = [
- file[plen:] for file in self.find_data_files(package, src_dir)
+ os.path.relpath(file, src_dir)
+ for file in self.find_data_files(package, src_dir)
]
return package, src_dir, build_dir, filenames