setup.py: manage git version

This commit is contained in:
Jérôme Schneider 2013-10-17 14:22:35 +02:00
parent 4d11f663c1
commit c7b45355e0
2 changed files with 21 additions and 4 deletions

View File

@ -1,4 +1,7 @@
recursive-include mandaye/templates *.html
recursive-include mandaye/static *
include MANIFEST
include VERSION
include mandaye/alembic.ini
recursive-include mandaye/alembic *
recursive-include mandaye/static *
recursive-include mandaye/templates *.html

View File

@ -4,7 +4,8 @@
Setup script for Mandaye
'''
import mandaye
import os
import subprocess
from setuptools import setup, find_packages
from sys import version
@ -23,8 +24,21 @@ install_requires=[
if version < '2.7':
install_requires.append('importlib')
def get_version():
if os.path.exists('VERSION'):
version_file = open('VERSION', 'r')
version = version_file.read()
version_file.close()
return version
if os.path.exists('.git'):
p = subprocess.Popen(['git','describe','--long'], stdout=subprocess.PIPE)
result = p.communicate()[0]
return result.split()[0].replace('-','.')
import mandaye
return mandaye.VERSION
setup(name="mandaye",
version=mandaye.VERSION,
version=get_version(),
license="AGPLv3 or later",
description="Mandaye, modular reverse proxy to authenticate",
url="http://dev.entrouvert.org/projects/reverse-proxy/",