]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
setup.py: use constant for _version.py filename.
authorDaira Hopwood <daira@jacaranda.org>
Fri, 21 Nov 2014 05:27:18 +0000 (05:27 +0000)
committerDaira Hopwood <daira@jacaranda.org>
Fri, 21 Nov 2014 05:29:45 +0000 (05:29 +0000)
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
setup.py

index f18b82aa0aee7231811ea707a3bd6244ccb78c35..31f1289b6a5533e2489e3aa835ea03038dbdee8f 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -37,7 +37,8 @@ def read_version_py(infname):
         if mo:
             return mo.group(1)
 
-version = read_version_py("src/allmydata/_version.py")
+VERSION_PY_FILENAME = 'src/allmydata/_version.py'
+version = read_version_py(VERSION_PY_FILENAME)
 
 APPNAME='allmydata-tahoe'
 APPNAMEFILE = os.path.join('src', 'allmydata', '_appname.py')
@@ -361,17 +362,20 @@ class UpdateVersion(Command):
     def try_from_git(self):
         versions = versions_from_git("allmydata-tahoe-")
         if versions:
+            version_info = {
+                "pkgname": self.distribution.get_name(),
+                "version": versions["version"],
+                "normalized": versions["normalized"],
+                "full": versions["full"],
+                "branch": versions["branch"],
+            }
+
             fn = 'src/allmydata/_version.py'
             f = open(fn, "wb")
-            f.write(GIT_VERSION_BODY %
-                    { "pkgname": self.distribution.get_name(),
-                      "version": versions["version"],
-                      "normalized": versions["normalized"],
-                      "full": versions["full"],
-                      "branch": versions["branch"],
-                    })
+            f.write(GIT_VERSION_PY % version_info)
             f.close()
             print("git-version: wrote '%s' into '%s'" % (versions["version"], fn))
+
         return versions.get("normalized", None)