de-nova setup system

This commit is contained in:
Jason Kölker 2011-11-01 13:09:35 -05:00
parent 245230e420
commit 869dc95104
3 changed files with 79 additions and 90 deletions

View File

@ -15,7 +15,14 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # 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 YEAR, COUNT = MELANGE_VERSION
FINAL = False # This becomes true at Release Candidate time FINAL = False # This becomes true at Release Candidate time
@ -29,4 +36,12 @@ def version_string():
if FINAL: if FINAL:
return canonical_version_string() return canonical_version_string()
else: 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())

115
setup.py
View File

@ -17,10 +17,8 @@
# under the License. # under the License.
import gettext import gettext
import glob
import os import os
import subprocess import subprocess
import sys
from setuptools import find_packages from setuptools import find_packages
from setuptools.command.sdist import sdist from setuptools.command.sdist import sdist
@ -38,35 +36,49 @@ except ImportError:
print "To build nova with support for message catalogs, you need " print "To build nova with support for message catalogs, you need "
print " https://launchpad.net/python-distutils-extra >= 2.18" 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 openstack.common.utils import parse_mailmap, str_dict_replace
from nova import version from melange import version
if os.path.isdir('.bzr'):
with open("nova/vcsversion.py", 'w') as version_file: def run_git_command(cmd):
vcs_cmd = subprocess.Popen(["bzr", "version-info", "--python"], output = subprocess.Popen(["/bin/sh", "-c", cmd],
stdout=subprocess.PIPE) stdout=subprocess.PIPE)
vcsversion = vcs_cmd.communicate()[0] return output.communicate()[0].strip()
version_file.write(vcsversion)
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): class local_sdist(sdist):
"""Customized sdist hook - builds the ChangeLog file from VC first""" """Customized sdist hook - builds the ChangeLog file from VC first"""
def run(self): def run(self):
if os.path.isdir('.bzr'): if os.path.isdir('.git'):
# We're in a bzr branch git_log_gnu = 'git log --format="%ai %aN %n%n%x09* %s%d%n"'
env = os.environ.copy() changelog = run_git_command(git_log_gnu)
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]
mailmap = parse_mailmap() mailmap = parse_mailmap()
with open("ChangeLog", "w") as changelog_file: with open("ChangeLog", "w") as changelog_file:
changelog_file.write(str_dict_replace(changelog, mailmap)) changelog_file.write(str_dict_replace(changelog, mailmap))
sdist.run(self) sdist.run(self)
nova_cmdclass = {'sdist': local_sdist}
cmdclass = {'sdist': local_sdist}
try: try:
@ -78,7 +90,7 @@ try:
self.builder = builder self.builder = builder
self.finalize_options() self.finalize_options()
BuildDoc.run(self) BuildDoc.run(self)
nova_cmdclass['build_sphinx'] = local_BuildDoc cmdclass['build_sphinx'] = local_BuildDoc
except: except:
pass pass
@ -86,51 +98,34 @@ except:
try: try:
from babel.messages import frontend as babel from babel.messages import frontend as babel
nova_cmdclass['compile_catalog'] = babel.compile_catalog cmdclass['compile_catalog'] = babel.compile_catalog
nova_cmdclass['extract_messages'] = babel.extract_messages cmdclass['extract_messages'] = babel.extract_messages
nova_cmdclass['init_catalog'] = babel.init_catalog cmdclass['init_catalog'] = babel.init_catalog
nova_cmdclass['update_catalog'] = babel.update_catalog cmdclass['update_catalog'] = babel.update_catalog
except: except:
pass pass
def find_data_files(destdir, srcdir): setup(name='melange',
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',
version=version.canonical_version_string(), version=version.canonical_version_string(),
description='cloud computing fabric controller', description='IPAM mangement service for Openstack',
author='OpenStack', author='OpenStack',
author_email='nova@lists.launchpad.net', author_email='openstack@lists.launchpad.net',
url='http://www.openstack.org/', url='http://www.openstack.org/',
cmdclass=nova_cmdclass, cmdclass=cmdclass,
packages=find_packages(exclude=['bin', 'smoketests']), packages=find_packages(exclude=['bin']),
include_package_data=True, include_package_data=True,
test_suite='nose.collector', test_suite='nose.collector',
data_files=find_data_files('share/nova', 'tools'), classifiers=[
scripts=['bin/nova-ajax-console-proxy', 'Development Status :: 4 - Beta',
'bin/nova-api', 'License :: OSI Approved :: Apache Software License',
'bin/nova-compute', 'Operating System :: POSIX :: Linux',
'bin/nova-console', 'Programming Language :: Python :: 2.6',
'bin/nova-dhcpbridge', 'Environment :: No Input/Output (Daemon)',
'bin/nova-direct-api', ],
'bin/nova-logspool', scripts=['bin/melange',
'bin/nova-manage', 'bin/melange-api',
'bin/nova-network', 'bin/melange-manage',
'bin/nova-objectstore', 'bin/melange-delete-deallocated-ips',
'bin/nova-scheduler', ],
'bin/nova-spoolsentry', py_modules=[])
'bin/stack',
'bin/nova-volume',
'bin/nova-vncproxy',
'tools/nova-debug'],
py_modules=[])

View File

@ -1,38 +1,17 @@
SQLAlchemy==0.6.3 SQLAlchemy
pep8==0.6.1 pep8
pylint==0.19 pylint
Cheetah==2.4.4
M2Crypto==0.20.2
amqplib==0.6.1
anyjson==0.2.4
boto==1.9b
carrot==0.10.5
eventlet eventlet
kombu==1.0.4 routes
lockfile==0.8 WebOb
lxml==2.3 mox
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
nose nose
PasteDeploy>=1.5 PasteDeploy
paste paste
sqlalchemy-migrate sqlalchemy-migrate
netaddr netaddr
sphinx sphinx
glance
xattr>=0.6.0
nova-adminclient
suds==0.4
coverage coverage
nosexcover nosexcover
paramiko
feedparser
webtest webtest
factory_boy factory_boy