From 0f590c0d72709128f32c23437fe0183386c69d1c Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 16 Jan 2016 06:33:04 -0500 Subject: Prefer relpath to string slicing for computing a path relative to a base. Fixes #341. --- setuptools/command/build_py.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'setuptools/command/build_py.py') 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 -- cgit v1.2.3