[Zope-CVS] CVS: StandaloneZConfig - setup.py:1.9
Fred L. Drake, Jr.
fred at zope.com
Fri Jan 2 19:36:56 EST 2004
Update of /cvs-repository/StandaloneZConfig
In directory cvs.zope.org:/tmp/cvs-serv15337
Modified Files:
setup.py
Log Message:
- work really hard to make sure the XML and sample configuration files
get installed alongside the code
- update the URL to the ZConfig "site-let"
=== StandaloneZConfig/setup.py 1.8 => 1.9 ===
--- StandaloneZConfig/setup.py:1.8 Fri Jan 2 14:39:45 2004
+++ StandaloneZConfig/setup.py Fri Jan 2 19:36:55 2004
@@ -1,8 +1,14 @@
#!/usr/bin/env python
+import glob
+import os
import sys
+from distutils import dir_util
from distutils.core import setup
+from distutils.dist import Distribution
+from distutils.command.install_lib import install_lib
+from distutils.command.build_py import build_py
# patch distutils if it can't cope with the "classifiers" keyword
if sys.version < '2.2.3':
@@ -40,13 +46,56 @@
"ZConfig.components.logger",
"ZConfig.components.logger.tests",
]
+# additional directories within the tests that hold data, but are not
+# packages:
+DATADIRS = ["ZConfig/tests/input",
+ "ZConfig/tests/library/thing/extras"]
+
+def copy_other_files(cmd, outputbase):
+ for pkg in PACKAGES + DATADIRS:
+ inputdir = pkg.replace(".", os.sep)
+ outputdir = os.path.join(outputbase, inputdir)
+ if not os.path.exists(outputdir):
+ dir_util.mkpath(outputdir)
+ for pattern in ("*.conf", "*.xml", "*.txt"):
+ for fn in glob.glob(os.path.join(inputdir, pattern)):
+ cmd.copy_file(fn, os.path.join(outputbase, fn))
+
+class MyLibInstaller(install_lib):
+ """Custom library installer used to put schema components in the
+ right place."""
+
+ # We use the install_lib command since we need to put hosttab
+ # inside the library directory. This is where we already have the
+ # real information about where to install it after the library
+ # location has been set by any relevant distutils command line
+ # options.
+
+ def run(self):
+ install_lib.run(self)
+ copy_other_files(self, self.install_dir)
+
+class MyPyBuilder(build_py):
+ def build_packages(self):
+ build_py.build_packages(self)
+ copy_other_files(self, self.build_lib)
+
+class MyDistribution(Distribution):
+ # To control the selection of MyLibInstaller and MyPyBuilder, we
+ # have to set it into the cmdclass instance variable, set in
+ # Distribution.__init__().
+
+ def __init__(self, *attrs):
+ Distribution.__init__(self, *attrs)
+ self.cmdclass['build_py'] = MyPyBuilder
+ self.cmdclass['install_lib'] = MyLibInstaller
setup(name="ZConfig",
version=VERSION,
description="Structured Configuration Library",
author="Fred Drake",
author_email="fred at zope.com",
- url="http://cvs.zope.org/Packages/ZConfig/",
+ url="http://www.zope.org/Members/fdrake/zconfig/",
packages=PACKAGES,
classifiers=[
"Development Status :: 5 - Production/Stable",
@@ -60,4 +109,5 @@
download_url=("http://www.zope.org/Members/fdrake/zconfig/"
"ZConfig-%s.tar.gz" % VERSION),
long_description=LONG_DESCRIPTION,
+ distclass=MyDistribution,
)
More information about the Zope-CVS
mailing list