commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r9662 - in trunk/gnue-common: . packaging/osx


From: reinhard
Subject: [gnue] r9662 - in trunk/gnue-common: . packaging/osx
Date: Tue, 5 Jun 2007 16:28:00 -0500 (CDT)

Author: reinhard
Date: 2007-06-05 16:27:59 -0500 (Tue, 05 Jun 2007)
New Revision: 9662

Added:
   trunk/gnue-common/packaging/osx/Info.plist.dist_template
Removed:
   trunk/gnue-common/packaging/osx/Info.plist
   trunk/gnue-common/packaging/osx/Info.plist.in
Modified:
   trunk/gnue-common/setup.py
Log:
Updated setup.py to allow for automatic *.dist_template processing.


Deleted: trunk/gnue-common/packaging/osx/Info.plist
===================================================================
--- trunk/gnue-common/packaging/osx/Info.plist  2007-06-05 15:06:16 UTC (rev 
9661)
+++ trunk/gnue-common/packaging/osx/Info.plist  2007-06-05 21:27:59 UTC (rev 
9662)
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" 
"http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
-<plist version="1.0">
-<dict>
-       <key>CFBundleGetInfoString</key>
-       <string>0.6.8+svn.9614, GNUe (c) 2001-2007 Free Software 
Foundation</string>
-       <key>CFBundleIdentifier</key>
-       <string>org.gnuenterprise.common</string>
-       <key>CFBundleShortVersionString</key>
-       <string>0.6.8</string>
-       <key>IFMajorVersion</key>
-       <integer>0</integer>
-       <key>IFMinorVersion</key>
-       <integer>6</integer>
-       <key>IFPkgFlagAllowBackRev</key>
-       <false/>
-       <key>IFPkgFlagAuthorizationAction</key>
-       <string>AdminAuthorization</string>
-       <key>IFPkgFlagBackgroundAlignment</key>
-       <string>topleft</string>
-       <key>IFPkgFlagBackgroundScaling</key>
-       <string>none</string>
-       <key>IFPkgFlagDefaultLocation</key>
-       <string>/</string>
-       <key>IFPkgFlagFollowLinks</key>
-       <true/>
-       <key>IFPkgFlagInstallFat</key>
-       <false/>
-       <key>IFPkgFlagInstalledSize</key>
-       <integer>4060</integer>
-       <key>IFPkgFlagIsRequired</key>
-       <false/>
-       <key>IFPkgFlagOverwritePermissions</key>
-       <false/>
-       <key>IFPkgFlagRelocatable</key>
-       <false/>
-       <key>IFPkgFlagRestartAction</key>
-       <string>NoRestart</string>
-       <key>IFPkgFlagRootVolumeOnly</key>
-       <false/>
-       <key>IFPkgFlagUpdateInstalledLanguages</key>
-       <false/>
-       <key>IFPkgFormatVersion</key>
-       <real>0.10000000149011612</real>
-</dict>
-</plist>

Copied: trunk/gnue-common/packaging/osx/Info.plist.dist_template (from rev 
9661, trunk/gnue-common/packaging/osx/Info.plist.in)
===================================================================
--- trunk/gnue-common/packaging/osx/Info.plist.in       2007-06-05 15:06:16 UTC 
(rev 9661)
+++ trunk/gnue-common/packaging/osx/Info.plist.dist_template    2007-06-05 
21:27:59 UTC (rev 9662)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" 
"http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
+<plist version="1.0">
+<dict>
+       <key>CFBundleGetInfoString</key>
+       <string>:VERSION:, GNUe (c) 2001-2007 Free Software Foundation</string>
+       <key>CFBundleIdentifier</key>
+       <string>org.gnuenterprise.common</string>
+       <key>CFBundleShortVersionString</key>
+       <string>:MAJOR:.:MINOR:.:FINAL:</string>
+       <key>IFMajorVersion</key>
+       <integer>0</integer>
+       <key>IFMinorVersion</key>
+       <integer>6</integer>
+       <key>IFPkgFlagAllowBackRev</key>
+       <false/>
+       <key>IFPkgFlagAuthorizationAction</key>
+       <string>AdminAuthorization</string>
+       <key>IFPkgFlagBackgroundAlignment</key>
+       <string>topleft</string>
+       <key>IFPkgFlagBackgroundScaling</key>
+       <string>none</string>
+       <key>IFPkgFlagDefaultLocation</key>
+       <string>/</string>
+       <key>IFPkgFlagFollowLinks</key>
+       <true/>
+       <key>IFPkgFlagInstallFat</key>
+       <false/>
+       <key>IFPkgFlagInstalledSize</key>
+       <integer>4060</integer>
+       <key>IFPkgFlagIsRequired</key>
+       <false/>
+       <key>IFPkgFlagOverwritePermissions</key>
+       <false/>
+       <key>IFPkgFlagRelocatable</key>
+       <false/>
+       <key>IFPkgFlagRestartAction</key>
+       <string>NoRestart</string>
+       <key>IFPkgFlagRootVolumeOnly</key>
+       <false/>
+       <key>IFPkgFlagUpdateInstalledLanguages</key>
+       <false/>
+       <key>IFPkgFormatVersion</key>
+       <real>0.10000000149011612</real>
+</dict>
+</plist>

Deleted: trunk/gnue-common/packaging/osx/Info.plist.in
===================================================================
--- trunk/gnue-common/packaging/osx/Info.plist.in       2007-06-05 15:06:16 UTC 
(rev 9661)
+++ trunk/gnue-common/packaging/osx/Info.plist.in       2007-06-05 21:27:59 UTC 
(rev 9662)
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" 
"http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
-<plist version="1.0">
-<dict>
-       <key>CFBundleGetInfoString</key>
-       <string>::GNUe-Version::, GNUe (c) 2001-2007 Free Software 
Foundation</string>
-       <key>CFBundleIdentifier</key>
-       <string>org.gnuenterprise.common</string>
-       <key>CFBundleShortVersionString</key>
-       <string>::GNUe-ShortVersion::</string>
-       <key>IFMajorVersion</key>
-       <integer>0</integer>
-       <key>IFMinorVersion</key>
-       <integer>6</integer>
-       <key>IFPkgFlagAllowBackRev</key>
-       <false/>
-       <key>IFPkgFlagAuthorizationAction</key>
-       <string>AdminAuthorization</string>
-       <key>IFPkgFlagBackgroundAlignment</key>
-       <string>topleft</string>
-       <key>IFPkgFlagBackgroundScaling</key>
-       <string>none</string>
-       <key>IFPkgFlagDefaultLocation</key>
-       <string>/</string>
-       <key>IFPkgFlagFollowLinks</key>
-       <true/>
-       <key>IFPkgFlagInstallFat</key>
-       <false/>
-       <key>IFPkgFlagInstalledSize</key>
-       <integer>4060</integer>
-       <key>IFPkgFlagIsRequired</key>
-       <false/>
-       <key>IFPkgFlagOverwritePermissions</key>
-       <false/>
-       <key>IFPkgFlagRelocatable</key>
-       <false/>
-       <key>IFPkgFlagRestartAction</key>
-       <string>NoRestart</string>
-       <key>IFPkgFlagRootVolumeOnly</key>
-       <false/>
-       <key>IFPkgFlagUpdateInstalledLanguages</key>
-       <false/>
-       <key>IFPkgFormatVersion</key>
-       <real>0.10000000149011612</real>
-</dict>
-</plist>

Modified: trunk/gnue-common/setup.py
===================================================================
--- trunk/gnue-common/setup.py  2007-06-05 15:06:16 UTC (rev 9661)
+++ trunk/gnue-common/setup.py  2007-06-05 21:27:59 UTC (rev 9662)
@@ -27,7 +27,7 @@
 from src.setup import ChangeLog
 from src.utils import version
 
-from src import PACKAGE, VERSION
+from src import TITLE, PACKAGE, VERSION
 
 
 # =============================================================================
@@ -89,6 +89,7 @@
 # Build files to be distributed and installed:
 # Should generate the files that go in a distribution but aren't in SVN.
 # Gets called on sdist (always) and on build/install (only when run from SVN).
+# FIXME: Better to build files in target directory directly.
 # -----------------------------------------------------------------------------
 
 def build_files (action):
@@ -159,6 +160,8 @@
 # -----------------------------------------------------------------------------
 # Build the svnrev.py file.
 # Gets called on sdist (always) and on build/install (only when run from SVN).
+# FIXME: Could be done with svnrev.py.dist_template, but it wouldn't happen on
+# build in that case.
 # -----------------------------------------------------------------------------
 
 def build_svnrev(filename):
@@ -186,6 +189,7 @@
 
 from distutils import log
 from distutils.core import setup
+from distutils.filelist import FileList
 from distutils.util import change_root
 from distutils.sysconfig import get_python_lib
 import distutils.command.sdist
@@ -258,11 +262,63 @@
     build_files ('sdist')
     distutils.command.sdist.sdist.run (self)
 
+  def prune_file_list(self):
+    distutils.command.sdist.sdist.prune_file_list(self)
+    self.filelist.exclude_pattern('*.dist_template', anchor=0)
+
   def make_release_tree (self, base_dir, files):
     distutils.command.sdist.sdist.make_release_tree (self, base_dir, files)
+    self.process_templates(base_dir)
     build_svnrev(os.path.join(base_dir, 'src', 'svnrev.py'))
 
+  def process_templates(self, target):
 
+    # Build list of files to be processed.
+    filelist = FileList()
+    if filelist.include_pattern('*.dist_template', anchor=0) == 0:
+        # Nothing to do.
+        return
+
+    # FIXME: For compatibility with old packages not yet using the version
+    # module. Change to unconditional import in gnue-common 0.8.
+    try:
+        from src import version
+    except:
+        return
+
+    # List of keywords to replace.
+    keywords = {
+            ':PACKAGE:': PACKAGE.lower(),
+            ':TITLE:': TITLE,
+            ':VERSION:': version.get_version(),
+            ':MAJOR:': str(version.major),
+            ':MINOR:': str(version.minor),
+            ':PHASE:': str(version.phase),
+            ':BUILD:': str(version.build),
+            ':SVN:': str(version.svn)}
+    # Hack for version numbering schemes that are limited to x.y.z.
+    if version.phase == 'final':
+        keywords[':FINAL:'] = str(version.build)
+    else:
+        keywords[':FINAL:'] = '0'
+
+    for src in filelist.files:
+        dst = os.path.join(target, src[:-14])
+        args = (src, dst, keywords)
+        self.execute(self.__process_template, args,
+                "generating %s from %s" % (dst, src))
+
+  def __process_template(self, src, dst, keywords):
+    infile = open(src, 'r')
+    content = infile.read()
+    infile.close()
+    for keyword, value in keywords.iteritems():
+        content = content.replace(keyword, value)
+    outfile = open(dst, 'w')
+    outfile.write(content)
+    outfile.close()
+
+
 # =============================================================================
 # build: if done from SVN, build files to be installed first
 # =============================================================================
@@ -270,6 +326,7 @@
 class build (distutils.command.build.build):
 
   def run (self):
+    # TODO: Some smarter way to generate files. Maybe build a sdist object?
     if not os.path.isfile ("PKG-INFO"):         # downloaded from SVN?
       build_files ('build')
     distutils.command.build.build.run (self)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]