Author: dmeyer
Date: Thu Mar 20 10:16:48 2008
New Revision: 3206

Log:
revert write_version test to avoid rewriting version.py every time

Modified:
   trunk/base/src/distribution/core.py

Modified: trunk/base/src/distribution/core.py
==============================================================================
--- trunk/base/src/distribution/core.py (original)
+++ trunk/base/src/distribution/core.py Thu Mar 20 10:16:48 2008
@@ -461,6 +461,21 @@
         # the module gets installed in the platform-specific libdir.
         kwargs['ext_modules'] = EmptyExtensionsList()
 
+    # check version.py information
+    write_version = False
+    if 'version' in kwargs:
+        write_version = True
+        # check if a version.py is there
+        if os.path.isfile('src/version.py'):
+            # read the file to find the old version information
+            f = open('src/version.py')
+            for line in f.readlines():
+                if line.startswith('VERSION'):
+                    if eval(line[10:-1]) == kwargs['version']:
+                        write_version = False
+                    break
+            f.close()
+           
     if len(sys.argv) > 1 and sys.argv[1] in ('bdist_rpm', 'sdist') and \
            os.path.isfile('ChangeLog.in'):
         # FIXME: find a better way to detect if we need to create a
@@ -473,12 +488,13 @@
 
     # Write a version.py and add it to the list of files to
     # be installed.
-    f = open('src/version.py', 'w')
-    f.write('# version information for %s\n' % kwargs['name'])
-    f.write('# autogenerated by kaa.distribution\n\n')
-    f.write('from kaa.distribution.version import Version\n')
-    f.write('VERSION = Version(\'%s\')\n' % kwargs['version'])
-    f.close()
+    if write_version:
+        f = open('src/version.py', 'w')
+        f.write('# version information for %s\n' % kwargs['name'])
+        f.write('# autogenerated by kaa.distribution\n\n')
+        f.write('from kaa.distribution.version import Version\n')
+        f.write('VERSION = Version(\'%s\')\n' % kwargs['version'])
+        f.close()
 
     # add some missing keywords
     if 'author' not in kwargs:

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to