From 869dc95104455897e2063ed7ea903447cb3fdc19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jason=20K=C3=B6lker?= Date: Tue, 1 Nov 2011 13:09:35 -0500 Subject: [PATCH] de-nova setup system --- melange/version.py | 19 +++++++- setup.py | 115 ++++++++++++++++++++++----------------------- tools/pip-requires | 35 +++----------- 3 files changed, 79 insertions(+), 90 deletions(-) diff --git a/melange/version.py b/melange/version.py index 41030384..a7934542 100644 --- a/melange/version.py +++ b/melange/version.py @@ -15,7 +15,14 @@ # License for the specific language governing permissions and limitations # under the License. -MELANGE_VERSION = ['2011', '1'] +try: + from melange.vcsversion import version_info +except ImportError: + version_info = {'branch_nick': u'LOCALBRANCH', + 'revision_id': 'LOCALREVISION', + 'revno': 0} + +MELANGE_VERSION = ['2012', '1'] YEAR, COUNT = MELANGE_VERSION FINAL = False # This becomes true at Release Candidate time @@ -29,4 +36,12 @@ def version_string(): if FINAL: return canonical_version_string() else: - return '%s-dev' % canonical_version_string() + 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 9b11fb95..509b6a03 100644 --- a/setup.py +++ b/setup.py @@ -17,10 +17,8 @@ # under the License. import gettext -import glob import os import subprocess -import sys from setuptools import find_packages from setuptools.command.sdist import sdist @@ -38,35 +36,49 @@ except ImportError: print "To build nova with support for message catalogs, you need " print " https://launchpad.net/python-distutils-extra >= 2.18" -gettext.install('nova', unicode=1) +gettext.install('melange', unicode=1) -from nova.utils import parse_mailmap, str_dict_replace -from nova import version +from openstack.common.utils import parse_mailmap, str_dict_replace +from melange import version -if os.path.isdir('.bzr'): - with open("nova/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) + +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("melange/vcsversion.py", 'w') as version_file: + 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): """Customized sdist hook - builds the ChangeLog file from VC first""" - def run(self): - if os.path.isdir('.bzr'): - # We're in a bzr branch - env = os.environ.copy() - env['BZR_PLUGIN_PATH'] = os.path.abspath('./bzrplugins') - log_cmd = subprocess.Popen(["bzr", "log", "--novalog"], - stdout=subprocess.PIPE, env=env) - changelog = log_cmd.communicate()[0] + if os.path.isdir('.git'): + git_log_gnu = 'git log --format="%ai %aN %n%n%x09* %s%d%n"' + changelog = run_git_command(git_log_gnu) mailmap = parse_mailmap() with open("ChangeLog", "w") as changelog_file: changelog_file.write(str_dict_replace(changelog, mailmap)) sdist.run(self) -nova_cmdclass = {'sdist': local_sdist} + + +cmdclass = {'sdist': local_sdist} try: @@ -78,7 +90,7 @@ try: self.builder = builder self.finalize_options() BuildDoc.run(self) - nova_cmdclass['build_sphinx'] = local_BuildDoc + cmdclass['build_sphinx'] = local_BuildDoc except: pass @@ -86,51 +98,34 @@ except: try: from babel.messages import frontend as babel - nova_cmdclass['compile_catalog'] = babel.compile_catalog - nova_cmdclass['extract_messages'] = babel.extract_messages - nova_cmdclass['init_catalog'] = babel.init_catalog - nova_cmdclass['update_catalog'] = babel.update_catalog + cmdclass['compile_catalog'] = babel.compile_catalog + cmdclass['extract_messages'] = babel.extract_messages + cmdclass['init_catalog'] = babel.init_catalog + cmdclass['update_catalog'] = babel.update_catalog except: pass -def find_data_files(destdir, srcdir): - package_data = [] - files = [] - for d in glob.glob('%s/*' % (srcdir, )): - if os.path.isdir(d): - package_data += find_data_files( - os.path.join(destdir, os.path.basename(d)), d) - else: - files += [d] - package_data += [(destdir, files)] - return package_data - -setup(name='nova', +setup(name='melange', version=version.canonical_version_string(), - description='cloud computing fabric controller', + description='IPAM mangement service for Openstack', author='OpenStack', - author_email='nova@lists.launchpad.net', + author_email='openstack@lists.launchpad.net', url='http://www.openstack.org/', - cmdclass=nova_cmdclass, - packages=find_packages(exclude=['bin', 'smoketests']), + cmdclass=cmdclass, + packages=find_packages(exclude=['bin']), include_package_data=True, test_suite='nose.collector', - data_files=find_data_files('share/nova', 'tools'), - scripts=['bin/nova-ajax-console-proxy', - 'bin/nova-api', - 'bin/nova-compute', - 'bin/nova-console', - 'bin/nova-dhcpbridge', - 'bin/nova-direct-api', - 'bin/nova-logspool', - 'bin/nova-manage', - 'bin/nova-network', - 'bin/nova-objectstore', - 'bin/nova-scheduler', - 'bin/nova-spoolsentry', - 'bin/stack', - 'bin/nova-volume', - 'bin/nova-vncproxy', - 'tools/nova-debug'], - py_modules=[]) + classifiers=[ + 'Development Status :: 4 - Beta', + 'License :: OSI Approved :: Apache Software License', + 'Operating System :: POSIX :: Linux', + 'Programming Language :: Python :: 2.6', + 'Environment :: No Input/Output (Daemon)', + ], + scripts=['bin/melange', + 'bin/melange-api', + 'bin/melange-manage', + 'bin/melange-delete-deallocated-ips', + ], + py_modules=[]) diff --git a/tools/pip-requires b/tools/pip-requires index bcc3fc38..841ab4f6 100644 --- a/tools/pip-requires +++ b/tools/pip-requires @@ -1,38 +1,17 @@ -SQLAlchemy==0.6.3 -pep8==0.6.1 -pylint==0.19 -Cheetah==2.4.4 -M2Crypto==0.20.2 -amqplib==0.6.1 -anyjson==0.2.4 -boto==1.9b -carrot==0.10.5 +SQLAlchemy +pep8 +pylint eventlet -kombu==1.0.4 -lockfile==0.8 -lxml==2.3 -python-novaclient==2.6.5 -python-daemon==1.5.5 -python-gflags==1.3 -redis==2.0.0 -routes==1.12.3 -WebOb==1.0.8 -wsgiref==0.1.2 -mox==0.5.3 -greenlet==0.3.1 +routes +WebOb +mox nose -PasteDeploy>=1.5 +PasteDeploy paste sqlalchemy-migrate netaddr sphinx -glance -xattr>=0.6.0 -nova-adminclient -suds==0.4 coverage nosexcover -paramiko -feedparser webtest factory_boy