tiramisu/setup.py
Daniel Dehennin 28d053430b Fix installation for non EOLE developpers
The version is extracted from “relase/” tags and they exists only on EOLE
git repository.

* Makefile (install): Depends on version file.
  (version.in): Fake dev version for developpers without devel release
  tags

* setup.py: Add missing subprocess import.
  (fetch_version): Use same fallback version as Makefile.
2013-07-18 12:23:50 +02:00

38 lines
1.1 KiB
Python

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from distutils.core import setup
import os
import subprocess
def fetch_version():
"""Get version from version.in or latest git tag"""
version_file='version.in'
version = "0.0-dev"
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
setup(
author='Gwenaël Rémond',
author_email='gremond@cadoles.com',
name='tiramisu',
version=fetch_version(),
description='configuration management tool',
url='http://labs.libre-entreprise.org/projects/tiramisu',
packages=['tiramisu']
)