Latest setup goodness.
Upgrade the common setup code to the latest versions, and use setuptools-git for sdist tarball generation. Change-Id: I81eca9199b7d330ef8ec80482565a75f8475a78c
This commit is contained in:
parent
cf8613e76d
commit
c315c5274f
|
@ -1,9 +1,5 @@
|
||||||
include AUTHORS
|
include AUTHORS
|
||||||
include HACKING.rst README.rst
|
|
||||||
include LICENSE
|
|
||||||
include ChangeLog
|
include ChangeLog
|
||||||
include run_tests.sh
|
|
||||||
include openstack-common.conf tox.ini
|
|
||||||
include glanceclient/versioninfo
|
include glanceclient/versioninfo
|
||||||
recursive-include tests *
|
exclude .gitignore
|
||||||
recursive-include tools *
|
exclude .gitreview
|
||||||
|
|
|
@ -35,7 +35,8 @@ def parse_mailmap(mailmap='.mailmap'):
|
||||||
for l in fp:
|
for l in fp:
|
||||||
l = l.strip()
|
l = l.strip()
|
||||||
if not l.startswith('#') and ' ' in l:
|
if not l.startswith('#') and ' ' in l:
|
||||||
canonical_email, alias = l.split(' ')
|
canonical_email, alias = [x for x in l.split(' ')
|
||||||
|
if x.startswith('<')]
|
||||||
mapping[alias] = canonical_email
|
mapping[alias] = canonical_email
|
||||||
return mapping
|
return mapping
|
||||||
|
|
||||||
|
@ -126,6 +127,13 @@ def _run_shell_command(cmd):
|
||||||
return out[0].strip()
|
return out[0].strip()
|
||||||
|
|
||||||
|
|
||||||
|
def _get_git_branch_name():
|
||||||
|
branch_ref = _run_shell_command("git symbolic-ref -q HEAD")
|
||||||
|
if branch_ref is None:
|
||||||
|
return "HEAD"
|
||||||
|
return branch_ref[len("refs/heads/"):]
|
||||||
|
|
||||||
|
|
||||||
def _get_git_next_version_suffix(branch_name):
|
def _get_git_next_version_suffix(branch_name):
|
||||||
datestamp = datetime.datetime.now().strftime('%Y%m%d')
|
datestamp = datetime.datetime.now().strftime('%Y%m%d')
|
||||||
if branch_name == 'milestone-proposed':
|
if branch_name == 'milestone-proposed':
|
||||||
|
@ -136,10 +144,16 @@ def _get_git_next_version_suffix(branch_name):
|
||||||
milestone_cmd = "git show meta/openstack/release:%s" % branch_name
|
milestone_cmd = "git show meta/openstack/release:%s" % branch_name
|
||||||
milestonever = _run_shell_command(milestone_cmd)
|
milestonever = _run_shell_command(milestone_cmd)
|
||||||
if not milestonever:
|
if not milestonever:
|
||||||
milestonever = ""
|
milestonever = branch_name
|
||||||
post_version = _get_git_post_version()
|
post_version = _get_git_post_version()
|
||||||
revno = post_version.split(".")[-1]
|
# post version should look like:
|
||||||
return "%s~%s.%s%s" % (milestonever, datestamp, revno_prefix, revno)
|
# 0.1.1.4.cc9e28a
|
||||||
|
# where the bit after the last . is the short sha, and the bit between
|
||||||
|
# the last and second to last is the revno count
|
||||||
|
(revno, sha) = post_version.split(".")[-2:]
|
||||||
|
first_half = "%(milestonever)s~%(datestamp)s" % locals()
|
||||||
|
second_half = "%(revno_prefix)s%(revno)s.%(sha)s" % locals()
|
||||||
|
return ".".join((first_half, second_half))
|
||||||
|
|
||||||
|
|
||||||
def _get_git_current_tag():
|
def _get_git_current_tag():
|
||||||
|
@ -161,11 +175,14 @@ def _get_git_post_version():
|
||||||
cmd = "git --no-pager log --oneline"
|
cmd = "git --no-pager log --oneline"
|
||||||
out = _run_shell_command(cmd)
|
out = _run_shell_command(cmd)
|
||||||
revno = len(out.split("\n"))
|
revno = len(out.split("\n"))
|
||||||
|
sha = _run_shell_command("git describe --always")
|
||||||
else:
|
else:
|
||||||
tag_infos = tag_info.split("-")
|
tag_infos = tag_info.split("-")
|
||||||
base_version = "-".join(tag_infos[:-2])
|
base_version = "-".join(tag_infos[:-2])
|
||||||
revno = tag_infos[-2]
|
(revno, sha) = tag_infos[-2:]
|
||||||
return "%s.%s" % (base_version, revno)
|
# git describe prefixes the sha with a g
|
||||||
|
sha = sha[1:]
|
||||||
|
return "%s.%s.%s" % (base_version, revno, sha)
|
||||||
|
|
||||||
|
|
||||||
def write_git_changelog():
|
def write_git_changelog():
|
||||||
|
@ -207,7 +224,7 @@ _rst_template = """%(heading)s
|
||||||
|
|
||||||
def read_versioninfo(project):
|
def read_versioninfo(project):
|
||||||
"""Read the versioninfo file. If it doesn't exist, we're in a github
|
"""Read the versioninfo file. If it doesn't exist, we're in a github
|
||||||
zipball, and there's really know way to know what version we really
|
zipball, and there's really no way to know what version we really
|
||||||
are, but that should be ok, because the utility of that should be
|
are, but that should be ok, because the utility of that should be
|
||||||
just about nil if this code path is in use in the first place."""
|
just about nil if this code path is in use in the first place."""
|
||||||
versioninfo_path = os.path.join(project, 'versioninfo')
|
versioninfo_path = os.path.join(project, 'versioninfo')
|
||||||
|
@ -302,17 +319,9 @@ def get_cmdclass():
|
||||||
return cmdclass
|
return cmdclass
|
||||||
|
|
||||||
|
|
||||||
def get_git_branchname():
|
|
||||||
for branch in _run_shell_command("git branch --color=never").split("\n"):
|
|
||||||
if branch.startswith('*'):
|
|
||||||
_branch_name = branch.split()[1].strip()
|
|
||||||
if _branch_name == "(no":
|
|
||||||
_branch_name = "no-branch"
|
|
||||||
return _branch_name
|
|
||||||
|
|
||||||
|
|
||||||
def get_pre_version(projectname, base_version):
|
def get_pre_version(projectname, base_version):
|
||||||
"""Return a version which is based"""
|
"""Return a version which is leading up to a version that will
|
||||||
|
be released in the future."""
|
||||||
if os.path.isdir('.git'):
|
if os.path.isdir('.git'):
|
||||||
current_tag = _get_git_current_tag()
|
current_tag = _get_git_current_tag()
|
||||||
if current_tag is not None:
|
if current_tag is not None:
|
||||||
|
@ -320,14 +329,14 @@ def get_pre_version(projectname, base_version):
|
||||||
else:
|
else:
|
||||||
branch_name = os.getenv('BRANCHNAME',
|
branch_name = os.getenv('BRANCHNAME',
|
||||||
os.getenv('GERRIT_REFNAME',
|
os.getenv('GERRIT_REFNAME',
|
||||||
get_git_branchname()))
|
_get_git_branch_name()))
|
||||||
version_suffix = _get_git_next_version_suffix(branch_name)
|
version_suffix = _get_git_next_version_suffix(branch_name)
|
||||||
version = "%s~%s" % (base_version, version_suffix)
|
version = "%s~%s" % (base_version, version_suffix)
|
||||||
write_versioninfo(projectname, version)
|
write_versioninfo(projectname, version)
|
||||||
return version.split('~')[0]
|
return version
|
||||||
else:
|
else:
|
||||||
version = read_versioninfo(projectname)
|
version = read_versioninfo(projectname)
|
||||||
return version.split('~')[0]
|
return version
|
||||||
|
|
||||||
|
|
||||||
def get_post_version(projectname):
|
def get_post_version(projectname):
|
||||||
|
|
1
setup.py
1
setup.py
|
@ -40,6 +40,7 @@ setuptools.setup(
|
||||||
install_requires=requires,
|
install_requires=requires,
|
||||||
dependency_links=dependency_links,
|
dependency_links=dependency_links,
|
||||||
tests_require=tests_require,
|
tests_require=tests_require,
|
||||||
|
setup_requires=['setuptools-git>=0.4'],
|
||||||
test_suite="nose.collector",
|
test_suite="nose.collector",
|
||||||
entry_points={'console_scripts': ['glance = glanceclient.shell:main']},
|
entry_points={'console_scripts': ['glance = glanceclient.shell:main']},
|
||||||
)
|
)
|
||||||
|
|
|
@ -6,4 +6,5 @@ nose-exclude
|
||||||
nosexcover
|
nosexcover
|
||||||
openstack.nose_plugin
|
openstack.nose_plugin
|
||||||
pep8==1.2
|
pep8==1.2
|
||||||
|
setuptools-git>=0.4
|
||||||
sphinx>=1.1.2
|
sphinx>=1.1.2
|
||||||
|
|
5
tox.ini
5
tox.ini
|
@ -13,11 +13,8 @@ deps = -r{toxinidir}/tools/pip-requires
|
||||||
-r{toxinidir}/tools/test-requires
|
-r{toxinidir}/tools/test-requires
|
||||||
commands = nosetests {posargs}
|
commands = nosetests {posargs}
|
||||||
|
|
||||||
[tox:jenkins]
|
|
||||||
downloadcache = ~/cache/pip
|
|
||||||
|
|
||||||
[testenv:pep8]
|
[testenv:pep8]
|
||||||
commands = pep8 --repeat --show-source --exclude=.venv,.tox,dist,doc .
|
commands = pep8 --repeat --show-source --exclude=.venv,.tox,dist,doc,*egg .
|
||||||
|
|
||||||
[testenv:cover]
|
[testenv:cover]
|
||||||
setenv = NOSE_WITH_COVERAGE=1
|
setenv = NOSE_WITH_COVERAGE=1
|
||||||
|
|
Loading…
Reference in New Issue