[CalendarServer-changes] [12197] twext/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Wed Mar 12 11:25:18 PDT 2014
Revision: 12197
http://trac.calendarserver.org//changeset/12197
Author: wsanchez at apple.com
Date: 2013-12-23 14:39:48 -0800 (Mon, 23 Dec 2013)
Log Message:
-----------
Move version() into setup.py.
Modified Paths:
--------------
twext/trunk/setup.py
Removed Paths:
-------------
twext/trunk/support/
Modified: twext/trunk/setup.py
===================================================================
--- twext/trunk/setup.py 2013-12-23 22:33:29 UTC (rev 12196)
+++ twext/trunk/setup.py 2013-12-23 22:39:48 UTC (rev 12197)
@@ -19,16 +19,16 @@
from __future__ import print_function
import sys
-from os.path import dirname, join as joinpath
+from os import chdir
+from os.path import dirname, abspath, join as joinpath
+import subprocess
# from distutils.core import setup
from setuptools import setup, find_packages as setuptools_find_packages
sys.path.insert(0, joinpath(dirname(__file__), "support"))
-from version import version
-
#
# Utilities
#
@@ -41,6 +41,54 @@
return modules + setuptools_find_packages()
+def version():
+ """
+ Compute the version number.
+ """
+
+ base_version = "0.1"
+
+ branches = tuple(
+ branch.format(
+ project="twext",
+ version=base_version,
+ )
+ for branch in (
+ "tags/release/{project}-{version}",
+ "branches/release/{project}-{version}-dev",
+ "trunk",
+ )
+ )
+
+ source_root = dirname(dirname(abspath(__file__)))
+
+ for branch in branches:
+ 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":
+ full_version += "b.trunk"
+ elif branch.endswith("-dev"):
+ full_version += "c.dev"
+
+ if svn_revision in ("exported", "Unversioned directory"):
+ full_version += "-unknown"
+ else:
+ full_version += "-r{revision}".format(revision=svn_revision)
+
+ break
+ else:
+ full_version += "a.unknown"
+ full_version += "-r{revision}".format(revision=svn_revision)
+
+ return full_version
+
+
#
# Options
#
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/5040eea5/attachment.html>
More information about the calendarserver-changes
mailing list