Makes Glance's versioning non-static. Uses Nova's versioning scheme.

This commit is contained in:
jaypipes@gmail.com 2011-01-27 13:59:49 -06:00
parent 67a71df391
commit 00ac0d44a6
3 changed files with 72 additions and 13 deletions

View File

@ -77,9 +77,11 @@ copyright = u'2010-present, OpenStack, LLC.'
# built documents.
#
# The short X.Y version.
version = '0.1'
from glance import version as glance_version
# The full version, including alpha/beta/rc tags.
release = '0.1.6'
release = glance_version.version_string()
# The short X.Y version.
version = glance_version.canonical_version_string()
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.

46
glance/version.py Normal file
View File

@ -0,0 +1,46 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
try:
from glance.vcsversion import version_info
except ImportError:
version_info = {'branch_nick': u'LOCALBRANCH',
'revision_id': 'LOCALREVISION',
'revno': 0}
GLANCE_VERSION = ['2011', '2']
YEAR, COUNT = GLANCE_VERSION
FINAL = False # This becomes true at Release Candidate time
def canonical_version_string():
return '.'.join([YEAR, COUNT])
def version_string():
if FINAL:
return canonical_version_string()
else:
return '%s-dev' % (canonical_version_string(),)
def vcs_version_string():
return "%s:%s" % (version_info['branch_nick'], version_info['revision_id'])
def version_string_with_vcs():
return "%s-%s" % (canonical_version_string(), vcs_version_string())

View File

@ -20,6 +20,16 @@ import subprocess
from setuptools import setup, find_packages
from setuptools.command.sdist import sdist
from glance import version
if os.path.isdir('.bzr'):
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)
class local_sdist(sdist):
"""Customized sdist hook - builds the ChangeLog file from VC first"""
@ -37,8 +47,12 @@ class local_sdist(sdist):
cmdclass = {'sdist': local_sdist}
# If Sphinx is installed on the box running setup.py,
# enable setup.py to build the documentation, otherwise,
# just ignore it
try:
from sphinx.setup_command import BuildDoc
class local_BuildDoc(BuildDoc):
def run(self):
for builder in ['html', 'man']:
@ -51,21 +65,19 @@ except:
pass
name = 'glance'
version = '0.1.6'
setup(
name=name,
version=version,
description='Glance',
name='glance',
version=version.canonical_version_string(),
description='The Glance project provides services for discovering, '
'registering, and retrieving virtual machine images',
license='Apache License (2.0)',
author='OpenStack, LLC.',
author_email='openstack-admins@lists.launchpad.net',
url='https://launchpad.net/glance',
author='OpenStack',
author_email='openstack@lists.launchpad.net',
url='http://glance.openstack.org/',
packages=find_packages(exclude=['tests', 'bin']),
test_suite='nose.collector',
cmdclass=cmdclass,
include_package_data=True,
classifiers=[
'Development Status :: 4 - Beta',
'License :: OSI Approved :: Apache Software License',
@ -73,7 +85,6 @@ setup(
'Programming Language :: Python :: 2.6',
'Environment :: No Input/Output (Daemon)',
],
install_requires=[], # removed for better compat
scripts=['bin/glance-api',
'bin/glance-registry',
'bin/glance-upload'])