[wwwsearch-commits] r23221 - wwwsearch/ClientForm/trunk

jjlee at codespeak.net jjlee at codespeak.net
Fri Feb 10 22:55:47 CET 2006


Author: jjlee
Date: Fri Feb 10 22:55:45 2006
New Revision: 23221

Modified:
   wwwsearch/ClientForm/trunk/setup.py
Log:
setup.py changes to support Pythons older than 2.3 again, using plain-distutils install

Modified: wwwsearch/ClientForm/trunk/setup.py
==============================================================================
--- wwwsearch/ClientForm/trunk/setup.py	(original)
+++ wwwsearch/ClientForm/trunk/setup.py	Fri Feb 10 22:55:45 2006
@@ -8,6 +8,10 @@
 interface is not the same.
 """
 
+try: True
+except NameError:
+    False, True = 0, 1
+
 import re
 #VERSION_MATCH = re.search(r'VERSION = "(.*)"', open("ClientForm.py").read())
 #VERSION = VERSION_MATCH.group(1)
@@ -45,10 +49,7 @@
 #-------------------------------------------------------
 # the rest is constant for most of my released packages:
 
-import ez_setup
-ez_setup.use_setuptools()
-
-import setuptools
+import sys
 
 if PACKAGE:
     packages, py_modules = [NAME], None
@@ -57,7 +58,33 @@
 
 doclines = __doc__.split("\n")
 
-setuptools.setup(
+if not hasattr(sys, "version_info") or sys.version_info < (2, 3):
+    from distutils.core import setup
+    _setup = setup
+    def setup(**kwargs):
+        for key in [
+            # distutils >= Python 2.3 args
+            # XXX probably download_url came in earlier than 2.3
+            "classifiers", "download_url",
+            # setuptools args
+            "install_requires", "zip_safe", "test_suite",
+            ]:
+            if kwargs.has_key(key):
+                del kwargs[key]
+        # Only want packages keyword if this is a package,
+        # only want py_modules keyword if this is a single-file module,
+        # so get rid of packages or py_modules keyword as appropriate.
+        if kwargs["packages"] is None:
+            del kwargs["packages"]
+        else:
+            del kwargs["py_modules"]
+        apply(_setup, (), kwargs)
+else:
+    import ez_setup
+    ez_setup.use_setuptools()
+    from setuptools import setup
+
+setup(
     name = NAME,
     version = VERSION,
     license = LICENSE,


More information about the wwwsearch-commits mailing list