summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpje <pje@571e12c6-e1fa-0310-aee7-ff1267fa46bd>2004-03-07 23:39:03 +0000
committerpje <pje@571e12c6-e1fa-0310-aee7-ff1267fa46bd>2004-03-07 23:39:03 +0000
commit733278535499d7b3b63def2cc0d7961d1e071062 (patch)
tree2d3c3392d4aa415fdfaab42aab27074331f8b001
parent4d93c40cda8eb3d7ed06dc3d2fa75725325a2539 (diff)
downloadwsgiref-733278535499d7b3b63def2cc0d7961d1e071062.tar.gz
Added 'findPackages()' function to automatically list packages for setup.
git-svn-id: svn://svn.eby-sarna.com/svnroot/wsgiref@237 571e12c6-e1fa-0310-aee7-ff1267fa46bd
-rw-r--r--setuptools/__init__.py22
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)