-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify maintenance with a set of Makefiles
Move the package version to the version.txt in the top level directory, and use metapensiero.tool.bump_version to maintain it, wrapped in a few Makefile targets to reduce the release burden.
- Loading branch information
Showing
9 changed files
with
176 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
export TOPDIR := $(CURDIR) | ||
export VENVDIR := $(TOPDIR)/env | ||
export PYTHON := $(VENVDIR)/bin/python | ||
export SHELL := /bin/bash | ||
export SYS_PYTHON := $(shell which python3.6 || which python3) | ||
|
||
all: rapidjson/license.txt virtualenv help | ||
|
||
rapidjson/license.txt: | ||
git submodule update --init | ||
|
||
.PHONY: help | ||
help:: | ||
@printf "\nBuild targets\n" | ||
@printf "=============\n\n" | ||
|
||
help:: | ||
@printf "build\n\tbuild the module\n" | ||
|
||
build: virtualenv | ||
$(PYTHON) setup.py build_ext --inplace | ||
|
||
help:: | ||
@printf "clean\n\tremove rebuildable stuff\n" | ||
|
||
.PHONY: clean | ||
clean: | ||
$(MAKE) -C docs clean | ||
rm -f *.so | ||
|
||
help:: | ||
@printf "distclean\n\tremove anything superfluous\n" | ||
|
||
.PHONY: distclean | ||
distclean:: clean | ||
rm -rf build dist | ||
rm -rf rapidjson/.* rapidjson/* | ||
|
||
help:: | ||
@printf "doc\n\tbuild Sphinx documentation\n" | ||
|
||
SPHINXBUILD := $(VENVDIR)/bin/sphinx-build | ||
|
||
.PHONY: doc | ||
doc: | ||
$(MAKE) -C docs SPHINXBUILD=$(SPHINXBUILD) html | ||
|
||
help:: | ||
@printf "check\n\trun the test suite\n" | ||
|
||
PYTEST := $(VENVDIR)/bin/pytest | ||
|
||
.PHONY: check | ||
check: build | ||
$(PYTEST) tests/ | ||
$(MAKE) -C docs SPHINXBUILD=$(SPHINXBUILD) doctest | ||
|
||
include Makefile.virtualenv | ||
include Makefile.release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
BUMPER := $(VENVDIR)/bin/bump_version -f minor | ||
VERSION_TXT := version.txt | ||
VERSION = $(shell cat $(VERSION_TXT)) | ||
|
||
help:: | ||
@printf "\nRelease management\n" | ||
@printf "==================\n\n" | ||
|
||
.PHONY: assert-clean-tree | ||
assert-clean-tree: | ||
@(test -z "$(shell git status -s --untracked=no)" || \ | ||
(echo "UNCOMMITTED STAFF" && false)) | ||
|
||
.PHONY: assert-master-branch | ||
assert-master-branch: | ||
@(test "$(shell git rev-parse --abbrev-ref HEAD)" = "master" || \ | ||
(echo "NOT IN MASTER BRANCH" && false)) | ||
|
||
help:: | ||
@printf "release\n\tBump version number\n" | ||
|
||
.PHONY: release | ||
release: assert-master-branch assert-clean-tree | ||
$(BUMPER) $(VERSION_TXT) | ||
@echo ">>>" | ||
@echo ">>> Do your duties (update CHANGES.rst for example), then" | ||
@echo ">>> execute “make tag-release”." | ||
@echo ">>>" | ||
|
||
help:: | ||
@printf "tag-release\n\tComplete the release tagging the working tree\n" | ||
|
||
.PHONY: tag-release | ||
tag-release: assert-master-branch check-release-date check-long-description-markup | ||
git commit -a -m "Release $(VERSION)" | ||
git tag -a -m "Version $(VERSION)" v$(VERSION) | ||
|
||
.PHONY: check-long-description-markup | ||
check-long-description-markup: | ||
@$(PYTHON) setup.py check -r -s | ||
|
||
.PHONY: check-release-date | ||
check-release-date: | ||
@fgrep -q "$(VERSION) ($(shell date --iso-8601))" CHANGES.rst \ | ||
|| (echo "ERROR: release date of version $(VERSION) not set in CHANGES.rst"; exit 1) | ||
|
||
help:: | ||
@printf "pypi-upload\n\tUpload the source distribution to PyPI\n" | ||
|
||
.PHONY: pypi-upload | ||
pypi-upload: assert-master-branch assert-clean-tree | ||
$(PYTHON) setup.py sdist upload | ||
|
||
help:: | ||
@printf "publish\n\tUpload to PyPI, push changes and tags to the remote repo\n" | ||
|
||
.PHONY: publish | ||
publish: pypi-upload | ||
git push | ||
git push --tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
ACTIVATE_SCRIPT := $(VENVDIR)/bin/activate | ||
PIP := $(VENVDIR)/bin/pip | ||
REQUIREMENTS ?= requirements.txt | ||
REQUIREMENTS_TIMESTAMP := $(VENVDIR)/$(REQUIREMENTS).timestamp | ||
|
||
help:: | ||
@printf "\nPython virtualenv related targets\n" | ||
@printf "=================================\n\n" | ||
|
||
help:: | ||
@printf "virtualenv\n\tsetup the Python virtualenv and install required packages\n" | ||
|
||
.PHONY: virtualenv | ||
virtualenv: $(VENVDIR) requirements | ||
|
||
$(VENVDIR): | ||
@echo "Bootstrapping Python 3 virtualenv..." | ||
@$(SYS_PYTHON) -m venv --prompt $(notdir $(TOPDIR)) $@ | ||
@$(MAKE) upgrade-pip | ||
|
||
help:: | ||
@printf "upgrade-pip\n\tupgrade pip\n" | ||
|
||
.PHONY: upgrade-pip | ||
upgrade-pip: | ||
@echo "Upgrading pip..." | ||
@$(PIP) install --no-cache-dir --upgrade pip | ||
|
||
help:: | ||
@printf "requirements\n\tinstall/update required Python packages\n" | ||
|
||
.PHONY: requirements | ||
requirements: $(REQUIREMENTS_TIMESTAMP) | ||
|
||
$(REQUIREMENTS_TIMESTAMP): $(REQUIREMENTS) | ||
@echo "Installing pre-requirements..." | ||
@PATH=$(TOPDIR)/bin:$(PATH) $(PIP) install --no-cache-dir -r $(REQUIREMENTS) | ||
@touch $@ | ||
|
||
distclean:: | ||
rm -rf $(VENVDIR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-r requirements-test.txt | ||
|
||
metapensiero.tool.bump-version==1.3 | ||
readme-renderer==17.2 | ||
sphinx==1.6.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.1.0 |