[CalendarServer-changes] [12195] twext/trunk

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 12 11:20:37 PDT 2014


Revision: 12195
          http://trac.calendarserver.org//changeset/12195
Author:   wsanchez at apple.com
Date:     2013-12-23 14:21:38 -0800 (Mon, 23 Dec 2013)
Log Message:
-----------
Make version string setuptools-compliant.

Modified Paths:
--------------
    twext/trunk/setup.py
    twext/trunk/support/version.py

Modified: twext/trunk/setup.py
===================================================================
--- twext/trunk/setup.py	2013-12-23 22:15:53 UTC (rev 12194)
+++ twext/trunk/setup.py	2013-12-23 22:21:38 UTC (rev 12195)
@@ -64,14 +64,9 @@
 # Write version file
 #
 
-version_number, version_info = version()
-
-version_string = (
-    "{number} ({info})"
-    .format(number=version_number, info=version_info)
-)
+version_string = version()
 version_file = file(os.path.join("twext", "version.py"), "w")
-version_file.write('version = "{version}"\n'.format(version=version_string))
+version_file.write('version = "{0}"\n'.format(version_string))
 version_file.close()
 
 

Modified: twext/trunk/support/version.py
===================================================================
--- twext/trunk/support/version.py	2013-12-23 22:15:53 UTC (rev 12194)
+++ twext/trunk/support/version.py	2013-12-23 22:21:38 UTC (rev 12195)
@@ -18,7 +18,8 @@
 
 from __future__ import print_function
 
-from os.path import dirname
+from os import chdir
+from os.path import dirname, abspath
 import subprocess
 
 
@@ -42,38 +43,40 @@
         )
     )
 
-    source_root = dirname(dirname(__file__))
+    source_root = dirname(dirname(abspath(__file__)))
+    chdir(source_root)
 
     for branch in branches:
-        svn_revision = subprocess.check_output(
-            ["svnversion", "-n", source_root, branch]
-        )
+        cmd = ["svnversion", "-n", source_root, branch]
+        svn_revision = subprocess.check_output(cmd)
 
         if "S" in svn_revision:
             continue
 
+        full_version = base_version
+
         if branch == "trunk":
-            base_version += "-trunk"
+            full_version += "b.trunk"
         elif branch.endswith("-dev"):
-            base_version += "-dev"
+            full_version += "c.dev"
 
         if svn_revision in ("exported", "Unversioned directory"):
-            comment = "unknown"
+            full_version += "-unknown"
         else:
-            comment = "r{revision}".format(revision=svn_revision)
+            full_version += "-r{revision}".format(revision=svn_revision)
 
         break
     else:
-        base_version += "-unknown"
-        comment = "r{revision}".format(revision=svn_revision)
+        full_version += "a.unknown"
+        full_version += "-r{revision}".format(revision=svn_revision)
 
-    return (base_version, comment)
+    return full_version
 
 
 
 if __name__ == "__main__":
-    base_version, comment = version()
+    base_version = version()
     print(
-        "{version} ({comment})"
-        .format(version=base_version, comment=comment)
+        "{version}"
+        .format(version=base_version)
     )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/e86d18f9/attachment.html>


More information about the calendarserver-changes mailing list