update Makefile and setup.py
This commit is contained in:
parent
d3ee2acaab
commit
f379a0fc0a
27
Makefile
27
Makefile
@ -15,8 +15,7 @@ ifneq ($(DESTDIR),)
|
||||
PYTHON_OPTS += --root $(DESTDIR)
|
||||
endif
|
||||
|
||||
LAST_TAG := $(shell git describe --tags --abbrev=0)
|
||||
VERSION := $(shell echo $(LAST_TAG) | awk -F'/' '{print $$2}' || true)
|
||||
VERSION := 1.0rc
|
||||
VERSION_FILE := version.in
|
||||
|
||||
# Build translation files
|
||||
@ -39,11 +38,12 @@ define install_translation
|
||||
fi
|
||||
endef
|
||||
|
||||
all:
|
||||
all: build-lang
|
||||
|
||||
clean:
|
||||
$(RM) -r build
|
||||
$(RM) -r tiramisu.egg-info/
|
||||
$(RM) -r $(PACKAGE).egg-info/
|
||||
$(RM) -r $(VERSION_FILE)
|
||||
$(RM) -r $(TRADUC_DIR)/*/*.mo
|
||||
|
||||
#test: clean
|
||||
@ -51,12 +51,12 @@ clean:
|
||||
|
||||
# Build or update Portable Object Base Translation for gettext
|
||||
build-pot:
|
||||
pygettext.py -p translations/ -o tiramisu.pot `find tiramisu/ -name "*.py"`
|
||||
pygettext.py -p translations/ -o $(PACKAGE).pot `find $(PACKAGE)/ -name "*.py"`
|
||||
|
||||
build-lang:
|
||||
$(call build_translation, $(TRADUC_DIR))
|
||||
|
||||
install-lang: build-lang
|
||||
install-lang:
|
||||
$(INSTALL_DIR) $(TRADUC_DEST)
|
||||
$(call install_translation, $(TRADUC_DIR))
|
||||
|
||||
@ -65,16 +65,9 @@ install: version.in install-lang
|
||||
|
||||
# List in .PHONY to force generation at each call
|
||||
version.in:
|
||||
@if test -n $(VERSION) ; then \
|
||||
echo -n $(VERSION) > $(VERSION_FILE) ; \
|
||||
fi
|
||||
@if test ! -s $(VERSION_FILE); then \
|
||||
echo -n '0.0-dev' > $(VERSION_FILE); \
|
||||
fi
|
||||
echo -n $(VERSION) > $(VERSION_FILE)
|
||||
|
||||
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
|
||||
dist:
|
||||
git archive --format=tar --prefix $(PACKAGE)-$(VERSION)/ HEAD | gzip -9 > $(PACKAGE)-$(VERSION).tar.gz
|
||||
|
||||
.PHONY: all clean test install version.in dist build-pot
|
||||
.PHONY: all clean build-pot build-lang install-lang install version.in dist
|
||||
|
65
setup.py
65
setup.py
@ -1,38 +1,55 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
from distutils.core import setup
|
||||
from os.path import isfile
|
||||
|
||||
|
||||
version_file = 'version.in'
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
def fetch_version():
|
||||
"""Get version from version.in or latest git tag"""
|
||||
version_file='version.in'
|
||||
version = "1.0"
|
||||
git_last_tag_cmd = ['git', 'describe', '--tags', '--abbrev=0']
|
||||
"""Get version from version.in"""
|
||||
|
||||
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
|
||||
if not isfile(version_file):
|
||||
raise Exception('Please use "make && make" install instead of '
|
||||
'setup.py directly')
|
||||
return file(version_file).readline().strip()
|
||||
|
||||
|
||||
setup(
|
||||
author='cadoles team',
|
||||
author="Tiramisu's team",
|
||||
author_email='contact@cadoles.com',
|
||||
name='tiramisu',
|
||||
version=fetch_version(),
|
||||
description='configuration management tool',
|
||||
url='http://labs.libre-entreprise.org/projects/tiramisu',
|
||||
packages=['tiramisu']
|
||||
description='an options controller tool',
|
||||
url='http://tiramisu.labs.libre-entreprise.org/',
|
||||
packages=['tiramisu'],
|
||||
classifiers=[
|
||||
"Programming Language :: Python",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Development Status :: 4 - Beta",
|
||||
"Environment :: Other Environment",
|
||||
"Intended Audience :: Developers",
|
||||
# "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)",
|
||||
"License :: OSI Approved :: GNU General Public License (GPL)",
|
||||
"Operating System :: OS Independent",
|
||||
"Topic :: Software Development :: Libraries :: Python Modules",
|
||||
"Topic :: Text Processing :: Linguistic"
|
||||
],
|
||||
long_description="""\
|
||||
An options controller tool
|
||||
-------------------------------------
|
||||
|
||||
Due to more and more available options required to set up an operating system,
|
||||
compiler options or whatever, it became quite annoying to hand the necessary
|
||||
options to where they are actually used and even more annoying to add new
|
||||
options. To circumvent these problems the configuration control was
|
||||
introduced...
|
||||
|
||||
Tiramisu is an options handler and an options controller, wich aims at
|
||||
producing flexible and fast options access.
|
||||
|
||||
|
||||
This version requires Python 2.6 or later.
|
||||
"""
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user