Merge pull request #156 from kevgliss/bump

adding automatic versioning
This commit is contained in:
kevgliss 2015-11-30 12:09:33 -08:00
commit 068f19c895
6 changed files with 56 additions and 7 deletions

3
.gitattributes vendored
View File

@ -1 +1,2 @@
* text=auto
* text=auto
version.py export-subst

View File

@ -1,4 +1,4 @@
include setup.py package.json bower.json gulpfile.js README.rst MANIFEST.in LICENSE AUTHORS
include setup.py version.py package.json bower.json gulpfile.js README.rst MANIFEST.in LICENSE AUTHORS
recursive-include lemur/plugins/lemur_email/templates *
recursive-include lemur/static *
global-exclude *~

View File

@ -11,6 +11,7 @@
#
# All configuration values have a default; values that are commented out
# serve to show the default.
from version import get_version
import sys
import os
@ -55,9 +56,9 @@ copyright = u'2015, Netflix Inc.'
# built documents.
#
# The short X.Y version.
version = '0.1'
version = get_version()
# The full version, including alpha/beta/rc tags.
release = '0.1.3'
release = get_version()
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.

View File

@ -5,7 +5,7 @@ docutils>=0.7
markupsafe
sphinxcontrib-httpdomain
Flask==0.10.1
Flask-RESTful==0.3.4
Flask-RESTful==0.3.3
Flask-SQLAlchemy==2.1
Flask-Script==2.0.5
Flask-Migrate==1.6.0

View File

@ -21,6 +21,8 @@ from setuptools.command.sdist import sdist
from setuptools import setup, find_packages
from subprocess import check_output
from version import get_version
ROOT = os.path.realpath(os.path.join(os.path.dirname(__file__)))
install_requires = [
@ -124,11 +126,11 @@ class BuildStatic(Command):
setup(
name='lemur',
version='0.1.5',
version=get_version(),
author='Kevin Glisson',
author_email='kglisson@netflix.com',
url='https://github.com/netflix/lemur',
download_url='https://github.com/Netflix/lemur/archive/0.1.3.tar.gz',
download_url='https://github.com/Netflix/lemur/archive/{0}.tar.gz'.format(get_version()),
description='Certificate management and orchestration service',
long_description=open(os.path.join(ROOT, 'README.rst')).read(),
packages=find_packages(),

45
version.py Normal file
View File

@ -0,0 +1,45 @@
# Source: https://github.com/Changaco/version.py
from os.path import dirname, isdir, join
import re
from subprocess import CalledProcessError, check_output
PREFIX = ''
tag_re = re.compile(r'\btag: %s([0-9][^,]*)\b' % PREFIX)
version_re = re.compile('^Version: (.+)$', re.M)
def get_version():
# Return the version if it has been injected into the file by git-archive
version = tag_re.search('$Format:%D$')
if version:
return version.group(1)
d = dirname(__file__)
if isdir(join(d, '.git')):
# Get the version using "git describe".
cmd = 'git describe --tags --match %s[0-9]* --dirty' % PREFIX
try:
version = check_output(cmd.split()).decode().strip()[len(PREFIX):]
except CalledProcessError:
raise RuntimeError('Unable to get version number from git tags')
# PEP 440 compatibility
if '-' in version:
if version.endswith('-dirty'):
raise RuntimeError('The working tree is dirty')
version = '.post'.join(version.split('-')[:2])
else:
# Extract the version from the PKG-INFO file.
with open(join(d, 'PKG-INFO')) as f:
version = version_re.search(f.read()).group(1)
return version
if __name__ == '__main__':
print(get_version())