changeset 1520:61134776e33c

make the setup.py file work.
author Frederic Bastien <nouiz@nouiz.org>
date Wed, 31 Oct 2012 14:36:55 -0400
parents 04d859714506
children 6397233f3ccd
files setup.py
diffstat 1 files changed, 25 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/setup.py	Sat Sep 29 20:28:48 2012 -0400
+++ b/setup.py	Wed Oct 31 14:36:55 2012 -0400
@@ -1,8 +1,30 @@
 #!/bin/env python
 
-from ez_setup import use_setuptools
-use_setuptools()
-from setuptools import setup, find_packages, Extension, Library
+import os
+from fnmatch import fnmatchcase
+from distutils.util import convert_path
+try:
+    from setuptools import setup
+except ImportError:
+    from distutils.core import setup
+
+
+def find_packages(where='.', exclude=()):
+    out = []
+    stack = [(convert_path(where), '')]
+    while stack:
+        where, prefix = stack.pop(0)
+        for name in os.listdir(where):
+            fn = os.path.join(where, name)
+            if ('.' not in name and os.path.isdir(fn) and
+                os.path.isfile(os.path.join(fn, '__init__.py'))
+            ):
+                out.append(prefix + name)
+                stack.append((fn, prefix + name + '.'))
+    for pat in list(exclude) + ['ez_setup', 'distribute_setup']:
+        out = [item for item in out if not fnmatchcase(item, pat)]
+    return out
+
 setup(name="Pylearn",
       version="0.1",
       description="Pylearn",
@@ -11,4 +33,3 @@
       author_email="pylearn-dev@googlegroups.com",
       packages=find_packages(exclude='tests'),
 )
-