[zpkg] SVN: zpkgtools/branches/nathan-setuptools-branch/zpkgsetup/ Try to import from setuptools before importing from distutils.

Nathan Yergler nathan at yergler.net
Thu Mar 2 16:17:42 EST 2006


Log message for revision 65745:
  Try to import from setuptools before importing from distutils.

Changed:
  U   zpkgtools/branches/nathan-setuptools-branch/zpkgsetup/dist.py
  U   zpkgtools/branches/nathan-setuptools-branch/zpkgsetup/setup.py

-=-
Modified: zpkgtools/branches/nathan-setuptools-branch/zpkgsetup/dist.py
===================================================================
--- zpkgtools/branches/nathan-setuptools-branch/zpkgsetup/dist.py	2006-03-02 20:56:48 UTC (rev 65744)
+++ zpkgtools/branches/nathan-setuptools-branch/zpkgsetup/dist.py	2006-03-02 21:17:42 UTC (rev 65745)
@@ -15,8 +15,14 @@
 
 $Id$
 """
-import distutils.dist
-import distutils.extension
+
+try:
+    import setuptools.dist as dist_dist
+    import setuptools.extension as dist_extension
+except ImportError:
+    import distutils.dist as dist_dist
+    import distutils.extension as dist_extension
+    
 import sys
 
 import zpkgsetup.build
@@ -25,17 +31,17 @@
 import zpkgsetup.install_headers
 
 
-class ZPkgExtension(distutils.extension.Extension):
+class ZPkgExtension(dist_extension.Extension):
     """Distutils representation of a compiled extension module."""
 
 
-class ZPkgDistribution(distutils.dist.Distribution):
+class ZPkgDistribution(dist_dist.Distribution):
     """Distribution that ensures features needed by **zpkg** are available."""
 
     def __init__ (self, attrs=None):
         self.package_data = None
         self.package_headers = attrs.pop("package_headers", ())
-        distutils.dist.Distribution.__init__(self, attrs)
+        dist_dist.Distribution.__init__(self, attrs)
         if self.package_data and sys.version_info < (2, 4):
             from zpkgsetup.build_py import build_py
             from zpkgsetup.install_lib import install_lib

Modified: zpkgtools/branches/nathan-setuptools-branch/zpkgsetup/setup.py
===================================================================
--- zpkgtools/branches/nathan-setuptools-branch/zpkgsetup/setup.py	2006-03-02 20:56:48 UTC (rev 65744)
+++ zpkgtools/branches/nathan-setuptools-branch/zpkgsetup/setup.py	2006-03-02 21:17:42 UTC (rev 65745)
@@ -31,7 +31,10 @@
 import re
 import sys
 
-from distutils.cmd import Command
+try:
+    from setuptools.cmd import Command
+except ImportError:
+    from distutils.cmd import Command
 
 from zpkgsetup import package
 from zpkgsetup import publication



More information about the zpkg mailing list