[Zope-CVS] CVS: Packages/zpkgtools/zpkgtools - package.py:1.2
setup.py:1.5
Fred L. Drake, Jr.
fred at zope.com
Wed Mar 17 11:18:05 EST 2004
Update of /cvs-repository/Packages/zpkgtools/zpkgtools
In directory cvs.zope.org:/tmp/cvs-serv32109
Modified Files:
package.py setup.py
Log Message:
- add support for build instructions embedded in packages
- generate a simple setup.cfg if we need to mark some files as documentation
(needed for RPM generation)
=== Packages/zpkgtools/zpkgtools/package.py 1.1 => 1.2 ===
--- Packages/zpkgtools/zpkgtools/package.py:1.1 Mon Mar 15 16:49:08 2004
+++ Packages/zpkgtools/zpkgtools/package.py Wed Mar 17 11:18:03 2004
@@ -13,6 +13,7 @@
##############################################################################
"""Support for handling package configuration files."""
+import glob
import os
import posixpath
import re
@@ -31,6 +32,7 @@
def loadPackageInfo(pkgname, directory, reldir, file=None):
+ print (pkgname, directory, reldir, file)
if not file:
file = PACKAGE_CONF
path = os.path.join(directory, file)
@@ -51,11 +53,27 @@
pkginfo.extensions = [create_extension(ext, pkgname, directory, reldir)
for ext in pkginfo.extension]
if reldir:
- pkginfo.documentation = [posixpath.join(reldir, fn)
- for fn in pkginfo.documentation]
- pkginfo.script = [posixpath.join(reldir, fn)
- for fn in pkginfo.script]
+ pkginfo.documentation = expand_globs(directory, reldir,
+ pkginfo.documentation)
+ pkginfo.script = expand_globs(directory, reldir, pkginfo.script)
return pkginfo
+
+
+def expand_globs(directory, reldir, globlist):
+ results = []
+ pwd = os.getcwd()
+ os.chdir(directory)
+ try:
+ for g in globlist:
+ gs = g.replace("/", os.sep)
+ filenames = glob.glob(gs)
+ if not filenames:
+ raise ValueError("filename pattern %r doesn't match any files" % g)
+ results += [posixpath.join(reldir, fn.replace(os.sep, "/"))
+ for fn in filenames]
+ finally:
+ os.chdir(pwd)
+ return results
def cpp_definition(s):
=== Packages/zpkgtools/zpkgtools/setup.py 1.4 => 1.5 ===
--- Packages/zpkgtools/zpkgtools/setup.py:1.4 Mon Mar 15 16:45:53 2004
+++ Packages/zpkgtools/zpkgtools/setup.py Wed Mar 17 11:18:03 2004
@@ -17,6 +17,7 @@
import posixpath
import sys
+from zpkgtools import package
from zpkgtools import publication
@@ -52,6 +53,25 @@
if self.platforms:
self.platforms = ", ".join(self.platforms)
+ def load_package_info(self, pkgname, reldir):
+ directory = os.path.join(self._working_dir, pkgname)
+ pkginfo = package.loadPackageInfo(pkgname, directory, reldir)
+ self.scripts.extend(pkginfo.script)
+ self.extensions.extend(pkginfo.extensions)
+ #
+ # Generate setup.cfg the first time we run:
+ #
+ setup_cfg = os.path.join(self._working_dir, "setup.cfg")
+ if os.path.exists(setup_cfg):
+ return
+ if pkginfo.documentation:
+ f = open(setup_cfg, "w")
+ f.write("[bdist_rpm]\n")
+ f.write("doc_files =")
+ for fn in pkginfo.documentation:
+ f.write(" %s\n" % fn)
+ f.close()
+
def scan_package(self, name, directory):
files = os.listdir(directory)
# need to load package-specific data here as well
@@ -102,6 +122,7 @@
self.packages.append(pkgname)
self.load_metadata(
os.path.join(self._working_dir, pkgname, "PUBLICATION.txt"))
+ self.load_package_info(pkgname, pkgname)
self.add_package_dir(pkgname, pkgname)
self.scan_package(
pkgname, os.path.join(self._working_dir, pkgname))
More information about the Zope-CVS
mailing list