From ca688222e5f974d532d3759d7b774e32de68f082 Mon Sep 17 00:00:00 2001 From: Erik O'Shaughnessy Date: Tue, 27 Oct 2015 14:14:04 -0500 Subject: [PATCH] version increment rules --- Makefile | 56 ++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 00946fb..1e6f94b 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,18 @@ - TARGET= GameOfLife -VERSION= 0.0.14 + +MAJOR=0 +MINOR=0 +POINT=17 +VERSION= ${MAJOR}.${MINOR}.${POINT} QVERSION= "'${VERSION}'" VERSION_FILE= VERSION +NEWPOINT = `expr $(POINT) + 1` +NEWMINOR = `expr $(MINOR) + 1` +NEWMAJOR = `expr $(MAJOR) + 1` +UPDTINIT = 's/__version__.*=.*/__version__ = ${QVERSION}/' +UPDTRDME = 's/Version: .*/Version: ${VERSION}/' + +MAKEFILE= Makefile PYTHON=python3 SETUP= setup.py @@ -20,17 +30,33 @@ SED = sed RM = rm MV = mv -UPDTINIT = 's/__version__.*=.*/__version__ = ${QVERSION}/' -UPDTRDME = 's/Version: .*/Version: ${VERSION}/' - all: - @echo "make update - updates the version VERSION=${VERSION}" - @echo "make sdist - creates a source distribution" - @echo "make bdist - creates a binary distribution" - @echo "make wheel - creates a wheel distribution" - @echo "make test - runs unit tests" - @echo "make upload - uploads bdist_wheel to PYPI=${PYPI}" - @echo "make clean - removes all derived files and directories" + @echo "make sdist - creates a source distribution" + @echo "make bdist - creates a binary distribution" + @echo "make wheel - creates a wheel distribution" + @echo "make test - runs unit tests" + @echo "make upload - uploads bdist_wheel to PYPI=${PYPI}" + @echo "make clean - removes all derived files and directories" + @echo "make bump_major - increment the major version number MAJOR=${MAJOR}" + @echo "make bump_minor - increment the minor version number MINOR=${MINOR}" + @echo "make bump_point - increment the point version number POINT=${POINT}" + @echo "make update - updates the version VERSION=${VERSION}" + + +bump_major: + @${SED} "s/^MAJOR[ \t]*=[ \t]*[0-9]*/MAJOR=$(NEWMAJOR)/" \ + ${MAKEFILE} > ${MAKEFILE}.tmp + @${MV} ${MAKEFILE}.tmp ${MAKEFILE} + +bump_minor: + @${SED} "s/^MINOR[ \t]*=[ \t]*[0-9]*/MINOR=$(NEWMINOR)/" \ + ${MAKEFILE} > ${MAKEFILE}.tmp + @${MV} ${MAKEFILE}.tmp ${MAKEFILE} + +bump_point: + @${SED} "s/^POINT[ \t]*=[ \t]*[0-9]*/POINT=$(NEWPOINT)/" \ + ${MAKEFILE} > ${MAKEFILE}.tmp + @${MV} ${MAKEFILE}.tmp ${MAKEFILE} update: @echo ${VERSION} > ${VERSION_FILE} @@ -39,9 +65,8 @@ update: @${SED} -e ${UPDTRDME} ${README} > ${README}.tmp @${MV} ${README}.tmp ${README} + tag: - git add ${PKG_INIT} - git commit -m "Version ${VERSION}" git tag ${VERSION} git push origin ${VERSION} @@ -55,14 +80,13 @@ bdist: ${PYSETUP} build bdist test: - ${PYSETUP} test + ${PYSETUP} test -q # switch to twine? upload: $(PYSETUP) bdist_wheel upload -r ${PYPI} - clean: @${PYSETUP} clean @${RM} -rf ${TMPFILES}