[Zope-CVS] CVS: Packages/SFTPGateway - setup.py:1.10
Fred L. Drake, Jr.
fred at zope.com
Fri Jan 2 19:14:54 EST 2004
Update of /cvs-repository/Packages/SFTPGateway
In directory cvs.zope.org:/tmp/cvs-serv10368
Modified Files:
setup.py
Log Message:
make the portion of this that deals with local code do the right thing
if it isn't disabled
=== Packages/SFTPGateway/setup.py 1.9 => 1.10 ===
--- Packages/SFTPGateway/setup.py:1.9 Fri Jan 2 14:38:38 2004
+++ Packages/SFTPGateway/setup.py Fri Jan 2 19:14:53 2004
@@ -11,10 +11,15 @@
"""Distutils setup script for SFTP Gateway."""
+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
# Figure out where we are:
try:
@@ -97,21 +102,49 @@
"ZConfig.components.logger.tests",
"zdaemon",
"zdaemon.tests"]
-DATAFILES=[]
-
-# if os.path.isdir(os.path.join(here, "src", "ZConfig")):
- # XXX We really need to list the test support here.
- # DATAFILES.extend([])
-
-# if os.path.isdir(os.path.join(here, "src", "zdaemon")):
- # XXX Same here, really.
- # DATAFILES.extend([('zdaemon',
- # ['zdaemon/sample.conf',
- # 'zdaemon/component.xml',
- # 'zdaemon/schema.xml']),
- # ('zdaemon/tests',
- # ['zdaemon/tests/donothing.sh']),
- # ])
+# 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
os.chdir(os.path.join(here, "src"))
@@ -122,5 +155,5 @@
author_email="info at zope.com",
url="http://www.zope.com/",
packages=PACKAGES,
- data_files=DATAFILES,
+ distclass=MyDistribution,
)
More information about the Zope-CVS
mailing list