diff options
author | PJ Eby <distutils-sig@python.org> | 2005-07-09 04:24:38 +0000 |
---|---|---|
committer | PJ Eby <distutils-sig@python.org> | 2005-07-09 04:24:38 +0000 |
commit | b0c3783bc20b07c798b45e84bcf4e02df03036e9 (patch) | |
tree | 7fb2b4eb3e06152228b738ea269403c5fcc2d58e /setuptools/__init__.py | |
parent | 72de8511ab1a6d622fc2bf8ee2c38440ba140ac3 (diff) | |
download | external_python_setuptools-b0c3783bc20b07c798b45e84bcf4e02df03036e9.tar.gz external_python_setuptools-b0c3783bc20b07c798b45e84bcf4e02df03036e9.tar.bz2 external_python_setuptools-b0c3783bc20b07c798b45e84bcf4e02df03036e9.zip |
Added ``exclude=patternlist`` option to ``setuptools.find_packages()``
--HG--
branch : setuptools
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041102
Diffstat (limited to 'setuptools/__init__.py')
-rw-r--r-- | setuptools/__init__.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/setuptools/__init__.py b/setuptools/__init__.py index 5883010b..258d9f50 100644 --- a/setuptools/__init__.py +++ b/setuptools/__init__.py @@ -1,5 +1,4 @@ """Extensions to the 'distutils' for large or complex distributions""" - import distutils.core, setuptools.command from setuptools.dist import Distribution, Feature from setuptools.extension import Extension @@ -9,7 +8,6 @@ from distutils.util import convert_path import os.path __version__ = '0.5a8' - __all__ = [ 'setup', 'Distribution', 'Feature', 'Command', 'Extension', 'Require', 'find_packages' @@ -17,16 +15,17 @@ __all__ = [ bootstrap_install_from = None -def find_packages(where='.'): +def find_packages(where='.', exclude=()): """Return a list all Python packages found within directory 'where' 'where' should be supplied as a "cross-platform" (i.e. URL-style) path; it - will be converted to the appropriate local path syntax. + will be converted to the appropriate local path syntax. 'exclude' is a + sequence of package names to exclude; '*' can be used as a wildcard in the + names, such that 'foo.*' will exclude all subpackages of 'foo' (but not + 'foo' itself). """ - out = [] stack=[(convert_path(where), '')] - while stack: where,prefix = stack.pop(0) for name in os.listdir(where): @@ -35,10 +34,11 @@ def find_packages(where='.'): os.path.isfile(os.path.join(fn,'__init__.py')) ): out.append(prefix+name); stack.append((fn,prefix+name+'.')) + for pat in exclude: + from fnmatch import fnmatchcase + out = [item for item in out if not fnmatchcase(item,pat)] return out - - def setup(**attrs): """Do package setup |