diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2015-08-30 13:56:54 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2015-08-30 13:56:54 -0400 |
commit | 8496cfb24aa20109e64a3b03c972792cd911c086 (patch) | |
tree | 15d22eee8b350d740b26ddbe04bd9285e79bed29 /setuptools | |
parent | c05680c5d1b4f0a688a4e560fabde6aa3022596d (diff) | |
download | external_python_setuptools-8496cfb24aa20109e64a3b03c972792cd911c086.tar.gz external_python_setuptools-8496cfb24aa20109e64a3b03c972792cd911c086.tar.bz2 external_python_setuptools-8496cfb24aa20109e64a3b03c972792cd911c086.zip |
Use relpath to produce results relative to 'dir'
Diffstat (limited to 'setuptools')
-rw-r--r-- | setuptools/__init__.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/setuptools/__init__.py b/setuptools/__init__.py index a884d2d3..0d1994dc 100644 --- a/setuptools/__init__.py +++ b/setuptools/__init__.py @@ -143,18 +143,13 @@ def findall(dir=os.curdir): """Find all files under 'dir' and return the list of full filenames (relative to 'dir'). """ - def _strip_leading_curdir(base): - do_strip = base == os.curdir or base.startswith(os.curdir + os.sep) - return base[2:] if do_strip else base - - def _base_prepend(base): - base = _strip_leading_curdir(base) - return functools.partial(os.path.join, base) + def _prepend(base): + return functools.partial(os.path.join, os.path.relpath(base, dir)) return [ file for base, dirs, files in os.walk(dir, followlinks=True) - for file in map(_base_prepend(base), files) + for file in map(_prepend(base), files) if os.path.isfile(file) ] |