Dynamic version and Makefile target to generate a distribution
The version is extracted from the last tag name minus the 'release/' prefix. * AUTHORS: Add mysel as contributor. * setup.py: Add a function to get version from extracted version.in file or from the last tag name. * Makefile: Add a target to generate the version.in file from the last tag name. * .gitignore: Ignore the version.in file.
This commit is contained in:
25
Makefile
25
Makefile
@ -1,5 +1,7 @@
|
||||
#!/usr/bin/make
|
||||
|
||||
PACKAGE := tiramisu
|
||||
|
||||
INSTALL := install
|
||||
INSTALL_DATA := install -m 644
|
||||
INSTALL_PROGRAM := install -m 755
|
||||
@ -10,16 +12,31 @@ ifneq ($(DESTDIR),)
|
||||
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
|
||||
|
Reference in New Issue
Block a user