diff --git a/README b/README index 84eaafbc6c..b50f715522 100644 --- a/README +++ b/README @@ -12,9 +12,9 @@ component. Quick Start ----------- -If you'd like to run trunk, you can fetch from the bzr repo:: +If you'd like to run trunk, you can clone the git repo: - bzr branch lp:glance + git clone git@github.com:openstack/glance.git Install Glance by running:: diff --git a/setup.py b/setup.py index e56b56c89f..bcff6a71cb 100644 --- a/setup.py +++ b/setup.py @@ -23,12 +23,28 @@ from setuptools.command.sdist import sdist from glance import version -if os.path.isdir('.bzr'): +def run_git_command(cmd): + output = subprocess.Popen(["/bin/sh", "-c", cmd], + stdout=subprocess.PIPE) + return output.communicate()[0].strip() + + +if os.path.isdir('.git'): + branch_nick_cmd = 'git branch | grep -Ei "\* (.*)" | cut -f2 -d" "' + branch_nick = run_git_command(branch_nick_cmd) + revid_cmd = "git --no-pager log --max-count=1 | cut -f2 -d' ' | head -1" + revid = run_git_command(revid_cmd) + revno_cmd = "git --no-pager log --oneline | wc -l" + revno = run_git_command(revno_cmd) with open("glance/vcsversion.py", 'w') as version_file: - vcs_cmd = subprocess.Popen(["bzr", "version-info", "--python"], - stdout=subprocess.PIPE) - vcsversion = vcs_cmd.communicate()[0] - version_file.write(vcsversion) + version_file.write(""" +# This file is automatically generated by setup.py, So don't edit it. :) +version_info = { + 'branch_nick': '%s', + 'revision_id': '%s', + 'revno': %s +} +""" % (branch_nick, revid, revno)) class local_sdist(sdist):