setup adapted. Version number on three positions

This commit is contained in:
Serghei Mihai 2014-10-28 16:50:17 +01:00
parent 615a2452fb
commit 31044fcbba
2 changed files with 41 additions and 3 deletions

View File

@ -1 +1 @@
__version__ = '0.1'
__version__ = '0.1.0'

View File

@ -1,7 +1,12 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import glob
import re
import sys
import os
from setuptools import setup
from djangocms_video import __version__
CLASSIFIERS = [
'Development Status :: 5 - Production/Stable',
@ -18,9 +23,42 @@ CLASSIFIERS = [
'Programming Language :: Python :: 2.7',
]
def get_version():
version = None
if os.path.exists('VERSION'):
version_file = open('VERSION', 'r')
version = version_file.read()
version_file.close()
return version
for d in glob.glob('*'):
if not os.path.isdir(d):
continue
module_file = os.path.join(d, '__init__.py')
if not os.path.exists(module_file):
continue
for v in re.findall("""__version__ *= *['"](.*)['"]""",
open(module_file).read()):
assert version is None
version = v
if version:
break
assert version is not None
if os.path.exists('.git'):
import subprocess
p = subprocess.Popen(['git','describe','--dirty','--match=v*'],
stdout=subprocess.PIPE)
result = p.communicate()[0]
assert p.returncode == 0, 'git returned non-zero'
new_version = result.split()[0][1:]
assert new_version.split('-')[0] == version, '__version__ must match the last git annotated tag'
version = new_version.replace('-', '.')
return version
setup(
name='djangocms-video',
version=__version__,
version=get_version(),
description='Video plugin for django CMS',
author='Divio AG',
author_email='info@divio.ch',