we can personalise storage easily
[tiramisu.git] / setup.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 from distutils.core import setup
4
5 import os
6 import subprocess
7
8 def fetch_version():
9     """Get version from version.in or latest git tag"""
10     version_file='version.in'
11     version = "0.0-dev"
12     git_last_tag_cmd = ['git', 'describe', '--tags', '--abbrev=0']
13
14     try:
15         if os.path.isfile(version_file):
16             version=file(version_file).readline().strip()
17         elif os.path.isdir('.git'):
18             popen = subprocess.Popen(git_last_tag_cmd, stdout=subprocess.PIPE)
19             out, ret = popen.communicate()
20             for line in out.split('\n'):
21                 if line:
22                     version = line.lstrip('release/')
23                     break
24     except OSError:
25         pass # Failing is fine, we just can't print the version then
26
27     return version
28
29
30 setup(
31     author='Gwenaël Rémond',
32     author_email='gremond@cadoles.com',
33     name='tiramisu',
34     version=fetch_version(),
35     description='configuration management tool',
36     url='http://labs.libre-entreprise.org/projects/tiramisu',
37     packages=['tiramisu']
38 )