diff --git a/doc/source/conf.py b/doc/source/conf.py index 9de5f861e2..70138f60dd 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -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. diff --git a/glance/version.py b/glance/version.py new file mode 100644 index 0000000000..2867140973 --- /dev/null +++ b/glance/version.py @@ -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()) diff --git a/setup.py b/setup.py index a89fc19453..93e9b8977a 100644 --- a/setup.py +++ b/setup.py @@ -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'])