From 4d0dc9c766ac0ad0fb681558c86d83635b197cc1 Mon Sep 17 00:00:00 2001
From: Zooko O'Whielacronx <zooko@zooko.com>
Date: Thu, 29 Jan 2009 12:56:40 -0700
Subject: [PATCH] setup: require darcsver >= 1.2.0 and rely exclusively on
 darcsver to set the version string

---
 setup.cfg |  2 ++
 setup.py  | 20 ++++----------------
 2 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/setup.cfg b/setup.cfg
index b839a100..ee170383 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -36,3 +36,5 @@ find_links=misc/dependencies tahoe-deps ../tahoe-deps
 build = darcsver --count-all-patches develop --prefix=support make_executable build
 test = darcsver --count-all-patches develop --prefix=support make_executable build trial
 sdist = darcsver --count-all-patches sdist
+install = darcsver --count-all-patches install
+bdist_egg = darcsver --count-all-patches bdist_egg
diff --git a/setup.py b/setup.py
index 7cdf52cd..4f7e0ebc 100644
--- a/setup.py
+++ b/setup.py
@@ -117,20 +117,9 @@ trove_classifiers=[
     ]
 
 
-VERSIONFILE = "src/allmydata/_version.py"
-verstr = "unknown"
-try:
-    verstrline = open(VERSIONFILE, "rt").read()
-except EnvironmentError:
-    pass # Okay, there is no version file.
-else:
-    VSRE = r"^verstr = ['\"]([^'\"]*)['\"]"
-    mo = re.search(VSRE, verstrline, re.M)
-    if mo:
-        verstr = mo.group(1)
-    else:
-        print "unable to find version in %s" % (VERSIONFILE,)
-        raise RuntimeError("if %s.py exists, it is required to be well-formed" % (VERSIONFILE,))
+# Note that the darcsver command from the darcsver plugin is needed to initialize the
+# distribution's .version attribute correctly.  (It does this either by examining darcs history,
+# or if that fails by reading the src/allmydata/_version.py file).
 
 LONG_DESCRIPTION=\
 """Welcome to the Tahoe project, a secure, decentralized, fault-tolerant
@@ -158,7 +147,7 @@ setup_requires.extend(['setuptools_trial'])
 # darcsver is needed if you want "./setup.py darcsver" to write a new version stamp in
 # src/allmydata/_version.py, with a version number derived from darcs history.
 # http://pypi.python.org/pypi/darcsver
-setup_requires.append('darcsver >= 1.1.5')
+setup_requires.append('darcsver >= 1.2.0')
 
 if 'trial' in sys.argv[1:] or 'test' in sys.argv[1:]:
     # Cygwin requires the poll reactor to work at all.  Linux requires the poll reactor to avoid
@@ -357,7 +346,6 @@ class MySdist(sdist.sdist):
 from _auto_deps import install_requires
 
 setup(name='allmydata-tahoe',
-      version=verstr,
       description='secure, decentralized, fault-tolerant filesystem',
       long_description=LONG_DESCRIPTION,
       author='the allmydata.org Tahoe project',
-- 
2.45.2