diff options
-rw-r--r-- | setuptools/__init__.py | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/setuptools/__init__.py b/setuptools/__init__.py index 172c77d..6fb8511 100644 --- a/setuptools/__init__.py +++ b/setuptools/__init__.py @@ -4,14 +4,31 @@ import distutils.core, setuptools.command from setuptools.dist import Distribution, Feature from setuptools.extension import Extension from distutils.core import Command +import os.path __all__ = [ - 'setup', 'Distribution', 'Feature', 'Command', 'Extension' + 'setup', 'Distribution', 'Feature', 'Command', 'Extension', 'findPackages' ] -def setup(**attrs): +def findPackages(where='.', prefix='', append=None): + """List all Python packages found within directory 'where'""" + + out = [] + if not append: + append = out.append + + for name in os.listdir(where): + fn = os.path.join(where,name) + if (os.path.isdir(fn) and + os.path.isfile(os.path.join(fn,'__init__.py')) + ): + append(prefix+name) + findPackages(fn,prefix+name+'.',append) + return out + +def setup(**attrs): """Do package setup This function takes the same arguments as 'distutils.core.setup()', except @@ -19,7 +36,6 @@ def setup(**attrs): that class' documentation for details on the new keyword arguments that it makes available via this function. """ - attrs.setdefault("distclass",Distribution) return distutils.core.setup(**attrs) |