diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2015-08-07 14:01:10 -0400 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2015-08-07 14:01:10 -0400 |
| commit | 565dd0699befdc1d27db05fc56c5215f3590567a (patch) | |
| tree | da1aa6eb586f726094feb79819494e4136d643e8 /setuptools/__init__.py | |
| parent | 30ece5ff98b651251c491ecf9c7f8c12ebe0f6b8 (diff) | |
| parent | d51ba2d7a8850a7fb56a6572b372626dd1cd3631 (diff) | |
| download | python-setuptools-git-565dd0699befdc1d27db05fc56c5215f3590567a.tar.gz | |
Merged in spookylukey/setuptools (pull request #140)
Big performance fix for find_packages by ignoring hidden dirs earlier
Diffstat (limited to 'setuptools/__init__.py')
| -rw-r--r-- | setuptools/__init__.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/setuptools/__init__.py b/setuptools/__init__.py index 8188f125..f6536359 100644 --- a/setuptools/__init__.py +++ b/setuptools/__init__.py @@ -81,10 +81,20 @@ class PackageFinder(object): for dir in dirs: yield os.path.relpath(os.path.join(root, dir), base_path) + @staticmethod + def _suitable_dirs(base_path): + """ + Return all suitable package dirs in base_path, relative to base_path + """ + for root, dirs, files in os.walk(base_path, followlinks=True): + # Mutate dirs to trim the search: + dirs[:] = filterfalse(lambda n: '.' in n, dirs) + for dir in dirs: + yield os.path.relpath(os.path.join(root, dir), base_path) + @classmethod def _find_packages_iter(cls, base_path): - dirs = cls._all_dirs(base_path) - suitable = filterfalse(lambda n: '.' in n, dirs) + suitable = cls._suitable_dirs(base_path) return ( path.replace(os.path.sep, '.') for path in suitable |
