GIT_VERSION_BODY = '''
# This _version.py is generated from git metadata by the tahoe setup.py.
-__pkgname__ = "%(pkgname)s"
-real_version = "%(version)s"
-full_version = "%(full)s"
-verstr = "%(normalized)s"
+__pkgname__ = %(pkgname)r
+real_version = %(version)r
+full_version = %(full)r
+branch = %(branch)r
+verstr = %(normalized)r
__version__ = verstr
'''
normalized_version = pieces[0]
else:
normalized_version = "%s.post%s" % (pieces[0], pieces[1])
+
stdout = run_command([GIT, "rev-parse", "HEAD"], cwd=source_dir)
if stdout is None:
return {}
if version.endswith("-dirty"):
full += "-dirty"
normalized_version += ".dev0"
- return {"version": version, "normalized": normalized_version, "full": full}
+
+ # Thanks to Jistanidiot at <http://stackoverflow.com/questions/6245570/get-current-branch-name>.
+ stdout = run_command([GIT, "rev-parse", "--abbrev-ref", "HEAD"], cwd=source_dir)
+ branch = (stdout or "unknown").strip()
+
+ return {"version": version, "normalized": normalized_version, "full": full, "branch": branch}
# setup.cfg has an [aliases] section which runs "update_version" before many
# commands (like "build" and "sdist") that need to know our package version
{ "pkgname": self.distribution.get_name(),
"version": versions["version"],
"normalized": versions["normalized"],
- "full": versions["full"] })
+ "full": versions["full"],
+ "branch": versions["branch"],
+ })
f.close()
print("git-version: wrote '%s' into '%s'" % (versions["version"], fn))
return versions.get("normalized", None)
package_data={"allmydata.web": ["*.xhtml"],
"allmydata.web.static": ["*.js", "*.png", "*.css"],
"allmydata.web.static.css": ["*.css"],
+ "allmydata.web.static.img": ["*.png"],
},
setup_requires=setup_requires,
entry_points = { 'console_scripts': [ 'tahoe = allmydata.scripts.runner:run' ] },