2012-07-13 11:22:00 +02:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from distutils.core import setup
|
|
|
|
|
2012-07-24 14:13:27 +02:00
|
|
|
import os
|
2013-07-18 12:23:50 +02:00
|
|
|
import subprocess
|
2012-07-24 14:13:27 +02:00
|
|
|
|
|
|
|
def fetch_version():
|
|
|
|
"""Get version from version.in or latest git tag"""
|
|
|
|
version_file='version.in'
|
2013-07-18 12:23:50 +02:00
|
|
|
version = "0.0-dev"
|
2012-07-24 14:13:27 +02:00
|
|
|
git_last_tag_cmd = ['git', 'describe', '--tags', '--abbrev=0']
|
|
|
|
|
|
|
|
try:
|
|
|
|
if os.path.isfile(version_file):
|
|
|
|
version=file(version_file).readline().strip()
|
|
|
|
elif os.path.isdir('.git'):
|
|
|
|
popen = subprocess.Popen(git_last_tag_cmd, stdout=subprocess.PIPE)
|
|
|
|
out, ret = popen.communicate()
|
|
|
|
for line in out.split('\n'):
|
|
|
|
if line:
|
|
|
|
version = line.lstrip('release/')
|
|
|
|
break
|
|
|
|
except OSError:
|
|
|
|
pass # Failing is fine, we just can't print the version then
|
|
|
|
|
|
|
|
return version
|
|
|
|
|
|
|
|
|
2012-07-13 11:22:00 +02:00
|
|
|
setup(
|
|
|
|
author='Gwenaël Rémond',
|
|
|
|
author_email='gremond@cadoles.com',
|
|
|
|
name='tiramisu',
|
2012-07-24 14:13:27 +02:00
|
|
|
version=fetch_version(),
|
2012-07-13 11:22:00 +02:00
|
|
|
description='configuration management tool',
|
|
|
|
url='http://labs.libre-entreprise.org/projects/tiramisu',
|
|
|
|
packages=['tiramisu']
|
|
|
|
)
|