diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2014-03-22 09:16:27 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2014-03-22 09:16:27 -0400 |
commit | 53ee4c9c87337d60d66ecca05450f4936c7c7465 (patch) | |
tree | 4b02e5abf3c098e7e81ce17444a6b03760f88d1f /setuptools/__init__.py | |
parent | 50f98edc5d47d11a93a9e28fe2fd5577ca36320b (diff) | |
download | external_python_setuptools-53ee4c9c87337d60d66ecca05450f4936c7c7465.tar.gz external_python_setuptools-53ee4c9c87337d60d66ecca05450f4936c7c7465.tar.bz2 external_python_setuptools-53ee4c9c87337d60d66ecca05450f4936c7c7465.zip |
Extract _find_packages_iter
Diffstat (limited to 'setuptools/__init__.py')
-rw-r--r-- | setuptools/__init__.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/setuptools/__init__.py b/setuptools/__init__.py index 33b05815..dbe4368c 100644 --- a/setuptools/__init__.py +++ b/setuptools/__init__.py @@ -46,8 +46,16 @@ def find_packages(where='.', exclude=(), include=('*',)): The list of included packages is built up first and then any explicitly excluded packages are removed from it. """ + out = _find_packages_iter(convert_path(where)) + includes = _build_filter(*include) + excludes = _build_filter('ez_setup', '*__pycache__', *exclude) + out = filter(includes, out) + out = filterfalse(excludes, out) + return list(out) + +def _find_packages_iter(where): out = [] - stack=[(convert_path(where), '')] + stack=[(where, '')] while stack: where,prefix = stack.pop(0) dirs = _dirs(where) @@ -59,11 +67,7 @@ def find_packages(where='.', exclude=(), include=('*',)): pkg_name = prefix + name out.append(pkg_name) stack.append((path, pkg_name + '.')) - includes = _build_filter(*include) - excludes = _build_filter('ez_setup', '*__pycache__', *exclude) - out = filter(includes, out) - out = filterfalse(excludes, out) - return list(out) + return out def _looks_like_package(path): return ( |