Gwenaël Rémond <gremond@cadoles.com> lead developer
Emmanuel Garette <egarette@cadoles.com> contributor
-
+Daniel Dehennin <daniel.dehennin@ac-dijon.fr> contributor
#!/usr/bin/make
+PACKAGE := tiramisu
+
INSTALL := install
INSTALL_DATA := install -m 644
INSTALL_PROGRAM := install -m 755
PYTHON_OPTS += --root $(DESTDIR)
endif
-all: test
+LAST_TAG := $(shell git describe --tags --abbrev=0)
+VERSION := $(shell echo $(LAST_TAG) | awk -F'/' '{print $$2}' || true)
+VERSION_FILE := version.in
+
+all:
clean:
$(RM) -r build
$(RM) -r tiramisu.egg-info/
-
+
test: clean
py.test
-
+
install:
python setup.py install --no-compile $(PYTHON_OPTS)
-.PHONY: all clean test install
+# List in .PHONY to force generation at each call
+version.in:
+ @if test -n $(VERSION) ; then \
+ echo $(VERSION) > $(VERSION_FILE) ; \
+ fi
+
+dist: version.in
+ git archive --format=tar --prefix $(PACKAGE)-$(VERSION)/ -o $(PACKAGE)-$(VERSION).tar $(LAST_TAG) \
+ && tar --xform "s,\(.*\),$(PACKAGE)-$(VERSION)/\1," -f $(PACKAGE)-$(VERSION).tar -r version.in \
+ && gzip -9 $(PACKAGE)-$(VERSION).tar
+
+.PHONY: all clean test install version.in dist
# -*- coding: utf-8 -*-
from distutils.core import setup
+import os
+
+def fetch_version():
+ """Get version from version.in or latest git tag"""
+ version_file='version.in'
+ version = "0.0"
+ 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='0.1',
+ version=fetch_version(),
description='configuration management tool',
url='http://labs.libre-entreprise.org/projects/tiramisu',
packages=['tiramisu']