[Zope-CVS] CVS: Packages/zpkgtools/zpkgtools - setup.py:1.9
Fred L. Drake, Jr.
fred at zope.com
Fri Mar 19 17:20:25 EST 2004
Update of /cvs-repository/Packages/zpkgtools/zpkgtools
In directory cvs.zope.org:/tmp/cvs-serv32287
Modified Files:
setup.py
Log Message:
- use setuptools.setup() instead of distutils.core.setup(), if
available, logging an error if it can't be loaded and there's
package data that will be mishandled
- fix a call to scan_package()
=== Packages/zpkgtools/zpkgtools/setup.py 1.8 => 1.9 ===
--- Packages/zpkgtools/zpkgtools/setup.py:1.8 Thu Mar 18 13:25:57 2004
+++ Packages/zpkgtools/zpkgtools/setup.py Fri Mar 19 17:20:25 2004
@@ -13,6 +13,7 @@
##############################################################################
"""Generator for distutils setup.py files."""
+import logging
import os
import posixpath
import sys
@@ -21,6 +22,9 @@
from zpkgtools import publication
+_logger = logging.getLogger(__name__)
+
+
class SetupContext:
"""Object representing the arguments to distutils.core.setup()."""
@@ -44,8 +48,19 @@
import pprint
pprint.pprint(kwargs)
else:
- import distutils.core
- distutils.core.setup(**kwargs)
+ root_logger = logging.getLogger()
+ if not root_logger.handlers:
+ root_logger.addHandler(logging.StreamHandler())
+ try:
+ from setuptools import setup
+ except ImportError:
+ # package_data can't be handled this way ;-(
+ if self.package_data:
+ _logger.error(
+ "can't import setuptools;"
+ " some package data will not be properly installed")
+ from distutils.core import setup
+ setup(**kwargs)
def load_metadata(self, path):
f = open(path, "rU")
@@ -55,7 +70,7 @@
def scan_package(self, name, directory, reldir):
# load the package metadata
- pkginfo = package.loadPackageInfo(pkgname, directory, reldir)
+ pkginfo = package.loadPackageInfo(name, directory, reldir)
self.scripts.extend(pkginfo.script)
self.ext_modules.extend(pkginfo.extensions)
@@ -113,7 +128,8 @@
self.load_metadata(
os.path.join(self._working_dir, pkgname, "PUBLICATION.txt"))
self.add_package_dir(pkgname, pkgname)
- self.scan_package(pkgname, os.path.join(self._working_dir, pkgname))
+ self.scan_package(pkgname, os.path.join(self._working_dir, pkgname),
+ pkgname)
class CollectionContext(SetupContext):
More information about the Zope-CVS
mailing list