Switch to openstack style versioning

Bug 1078480

Change-Id: I32471acc16e7ca6f60672474c9bf70537ba76fd2
Signed-off-by: Jeff Peeler <jpeeler@redhat.com>
This commit is contained in:
Jeff Peeler 2012-12-06 17:15:05 -05:00 committed by Gerrit Code Review
parent 42599700a7
commit 4e99d4d0bb
5 changed files with 10 additions and 60 deletions

2
.gitignore vendored
View File

@ -3,7 +3,7 @@
build
dist
heat.egg-info
heat/vcsversion.py
heat/versioninfo
tags
*.log
heat-test.db

View File

@ -7,6 +7,7 @@ include MANIFEST.in pylintrc
include openstack-common.conf
include babel.cfg
graft templates
include heat/versioninfo
include heat/cloudinit/config
include heat/cloudinit/loguserdata.sh
include heat/cloudinit/part-handler.py

View File

@ -47,7 +47,7 @@ if scriptname == 'heat-boto':
from heat import boto_client as heat_client
else:
from heat import client as heat_client
from heat import version
from heat.version import version_info as version
from heat.common import config
from heat.common import exception
from heat import utils
@ -639,8 +639,8 @@ Commands:
"""
oparser = optparse.OptionParser(version='%%prog %s'
% version.version_string(),
deferred_string = version.deferred_version_string(prefix='%prog ')
oparser = optparse.OptionParser(version=str(deferred_string),
usage=usage.strip())
create_options(oparser)
(opts, cmd, args) = parse_options(oparser, sys.argv[1:])

View File

@ -13,57 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import os
try:
import git
except ImportError:
git = None
from heat.openstack.common import version as common_version
try:
from heat.vcsversion import version_info
except ImportError:
version_info = {}
HEAT_VERSION = '8'
FINAL = False # This becomes true at Release Candidate time
def get_git_sha():
if not git:
return version_info.get('sha', '')
try:
repo = git.Repo('.')
except git.InvalidGitRepositoryError:
return version_info.get('sha', '')
return repo.head.commit.hexsha
def write_git_sha():
sha = get_git_sha()
vcsversion_path = 'heat/vcsversion.py'
if sha:
with open(vcsversion_path, 'w') as version_file:
version_file.write("""
# This file is automatically generated by heat's setup.py, so don't edit it. :)
version_info = {
'sha': '%s'
}
""" % (sha))
else:
try:
os.remove(vcsversion_path)
except OSError:
pass
def version_string(type='short'):
version = HEAT_VERSION
if not FINAL:
version += '-dev ' + get_git_sha()
elif type != 'short':
version += ' ' + get_git_sha()
return version
NEXT_VERSION = '2013.1'
version_info = common_version.VersionInfo('heat', pre_version=NEXT_VERSION)

View File

@ -20,15 +20,13 @@ import subprocess
import setuptools
from heat.openstack.common import setup
from heat import version
version.write_git_sha()
from heat.version import version_info as version
requires = setup.parse_requirements()
setuptools.setup(
name='heat',
version=version.HEAT_VERSION,
version=version.canonical_version_string(always=True),
description='The heat project provides services for provisioning '
'virtual machines',
license='Apache License (2.0)',