Skip to content

Commit

Permalink
build: create poni/version.py by default + some cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
Oskari Saarenmaa committed Sep 24, 2013
1 parent 491d611 commit fd23f66
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
16 changes: 10 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
rst2html=rst2html

all: dist doc readme example-doc
all: poni/version.py dist doc readme example-doc

include package.mk

poni/version.py: version.py
python $< $@

dist: doc readme
python setup.py sdist

Expand All @@ -27,11 +30,12 @@ examples/db-cluster/README.html: examples/db-cluster/README.rst
$(rst2html) $< $@

clean: deb-clean
rm -rf dist/ build/ poni.egg-info/ poni/*.pyc cover/ examples/puppet/README.html examples/db-cluster/README.html README.html README.txt *.pyc
(cd doc && make clean)
rm -f /tmp/poni_$(shell git describe).diff.*
rm -f ../poni?$(shell git describe)*
rm -f ../poni?$(shell git describe --abbrev=0)-*.tar.gz
$(RM) -r dist/ build/ poni.egg-info/ cover/
$(RM) poni/version.py poni/*.pyc tests/*.pyc *.pyc README.html README.txt \
examples/puppet/README.html examples/db-cluster/README.html
$(RM) ../poni?$(shell git describe)* \
../poni?$(shell git describe --abbrev=0)-*.tar.gz
$(MAKE) -C doc clean

build-dep:
apt-get --yes install python-setuptools python-docutils lynx
Expand Down
2 changes: 1 addition & 1 deletion doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ help:
@echo " doctest to run all doctests embedded in the documentation (if enabled)"

clean:
-rm -rf $(BUILDDIR)/*
-$(RM) -r $(BUILDDIR)/

html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
Expand Down
7 changes: 2 additions & 5 deletions package.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ base = $(shell basename $(path))
export DEBFULLNAME := Mika Eloranta
export DEBEMAIL := mika.eloranta@gmail.com

rpm:
echo "__version__ = '$(version)'" > poni/version.py
rpm: poni/version.py
cd .. ; tar -zcv --exclude=*~ --exclude=.git -f $(base)-$(version).tar.gz $(base)
$(RM) poni/version.py
rpmbuild -ta ../$(base)-$(version).tar.gz \
--define 'full_version $(version)' \
--define 'major_version $(major_version)' \
Expand All @@ -30,10 +28,9 @@ deb-debuild: debian
debuild -us -uc

deb-clean:
rm -rf debian/
$(RM) -r debian/

deb: debian
dpkg-buildpackage -A -us -uc

.PHONY: debian

4 changes: 4 additions & 0 deletions version.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ def get_project_version(version_file):
% version_file)

return file_ver

if __name__ == "__main__":
import sys
get_project_version(sys.argv[1])

0 comments on commit fd23f66

Please sign in to comment.