[Zope-CVS] CVS: Packages/zpkgtools/bin - zpkg:1.7
Fred L. Drake, Jr.
fred at zope.com
Sat Mar 13 00:31:38 EST 2004
Update of /cvs-repository/Packages/zpkgtools/bin
In directory cvs.zope.org:/tmp/cvs-serv5015/bin
Modified Files:
zpkg
Log Message:
- remove unnecessary computation of __file__; Python 2.3 always
defines this for scripts as well as modules
- move generation of setup.py to the zpkg script; the zpkgtools.setup
module is now only needed when the generated setup.py is run
=== Packages/zpkgtools/bin/zpkg 1.6 => 1.7 ===
--- Packages/zpkgtools/bin/zpkg:1.6 Fri Mar 12 18:08:40 2004
+++ Packages/zpkgtools/bin/zpkg Sat Mar 13 00:31:36 2004
@@ -6,11 +6,6 @@
import sys
import tempfile
-try:
- __file__
-except NameError:
- __file__ = sys.argv[0]
-
script = os.path.realpath(__file__)
here = os.path.dirname(script)
@@ -26,7 +21,6 @@
from zpkgtools import cvsloader
from zpkgtools import locationmap
from zpkgtools import publication
-from zpkgtools import setup
from zpkgtools.include import InclusionProcessor
@@ -100,10 +94,16 @@
self.destination = os.path.join(self.tmpdir, self.target_name)
def generateSetup(self):
- setup.generate(self.destination,
- self.resource_name,
- self.options.version,
- self.resource_type)
+ setup_py = os.path.join(self.destination, "setup.py")
+ pkgname = self.resource_name
+ type = self.resource_type
+ f = open(setup_py, "w")
+ print >>f, SETUP_HEADER
+ print >>f, "context = zpkgtools.setup.%sContext(" % type.capitalize()
+ print >>f, " %r, %r, __file__)" % (pkgname, self.options.version)
+ print >>f
+ print >>f, "context.setup()"
+ f.close()
def createTarball(self):
pwd = os.getcwd()
@@ -134,6 +134,16 @@
except:
print >>sys.stderr, "temporary files are in", self.tmpdir
raise
+
+
+SETUP_HEADER = """\
+#! /usr/bin/env python
+#
+# THIS IS A GENERATED FILE. DO NOT EDIT THIS DIRECTLY.
+
+import zpkgtools.setup
+
+"""
def main(argv=None):
More information about the Zope-CVS
mailing list