Skip to content

Commit

Permalink
Updates Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
ask committed Jul 5, 2016
1 parent 7035a44 commit a7f4251
Showing 1 changed file with 106 additions and 13 deletions.
119 changes: 106 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,36 +1,129 @@
PROJ=billiard
PYTHON=python
GIT=git
TOX=tox
NOSETESTS=nosetests
ICONV=iconv
FLAKE8=flake8
FLAKEPLUS=flakeplus
SPHINX2RST=sphinx2rst

SPHINX_DIR=docs/
SPHINX_BUILDDIR="${SPHINX_DIR}/_build"
README=README.rst
README_SRC="docs/templates/readme.txt"
CONTRIBUTING=CONTRIBUTING.rst
CONTRIBUTING_SRC="docs/contributing.rst"
SPHINX_HTMLDIR="${SPHINX_BUILDDIR}/html"
DOCUMENTATION=Documentation
FLAKEPLUSTARGET=2.7

all: help

help:
@echo "docs - Build documentation."
@echo "test-all - Run tests for all supported python versions."
@echo "distcheck ---------- - Check distribution for problems."
@echo " test - Run unittests using current python."
@echo " lint ------------ - Check codebase for problems."
@echo " apicheck - Check API reference coverage."
@echo " configcheck - Check configuration reference coverage."
@echo " readmecheck - Check README.rst encoding."
@echo " contribcheck - Check CONTRIBUTING.rst encoding"
@echo " flakes -------- - Check code for syntax and style errors."
@echo " flakecheck - Run flake8 on the source code."
@echo " flakepluscheck - Run flakeplus on the source code."
@echo "readme - Regenerate README.rst file."
@echo "contrib - Regenerate CONTRIBUTING.rst file"
@echo "clean-dist --------- - Clean all distribution build artifacts."
@echo " clean-git-force - Remove all uncomitted files."
@echo " clean ------------ - Non-destructive clean"
@echo " clean-pyc - Remove .pyc/__pycache__ files"
@echo " clean-docs - Remove documentation build artifacts."
@echo " clean-build - Remove setup artifacts."

clean: clean-docs clean-pyc clean-build

clean-dist: clean clean-git-force

Documentation:
(cd "$(SPHINX_DIR)"; $(MAKE) html)
mv "$(SPHINX_HTMLDIR)" $(DOCUMENTATION)

docs: Documentation

clean-docs:
-rm -rf "$(SPHINX_BUILDDIR)"

lint: flakecheck apicheck configcheck readmecheck

apicheck:
(cd "$(SPHINX_DIR)"; $(MAKE) apicheck)

configcheck:
(cd "$(SPHINX_DIR)"; $(MAKE) configcheck)

flakecheck:
flake8 "$(PROJ)"
# the only way to enable all-1 errors is to ignore one of them.
$(FLAKE8) --ignore=X999 "$(PROJ)"

flakediag:
-$(MAKE) flakecheck

flakepluscheck:
flakeplus --2.6 "$(PROJ)"
$(FLAKEPLUS) --$(FLAKEPLUSTARGET) "$(PROJ)"

flakeplusdiag:
-$(MAKE) flakepluscheck

flakes: flakediag flakeplusdiag

test:
nosetests -xv
clean-readme:
-rm -f $(README)

cov:
nosetests -xv --with-coverage --cover-html --cover-branch
readmecheck:
$(ICONV) -f ascii -t ascii $(README) >/dev/null

removepyc:
$(README):
$(SPHINX2RST) "$(README_SRC)" --ascii > $@

readme: clean-readme $(README) readmecheck

clean-contrib:
-rm -f "$(CONTRIBUTING)"

$(CONTRIBUTING):
$(SPHINX2RST) "$(CONTRIBUTING_SRC)" > $@

contrib: clean-contrib $(CONTRIBUTING)

clean-pyc:
-find . -type f -a \( -name "*.pyc" -o -name "*$$py.class" \) | xargs rm
-find . -type d -name "__pycache__" | xargs rm -r

gitclean:
git clean -xdn
removepyc: clean-pyc

clean-build:
rm -rf build/ dist/ .eggs/ *.egg-info/ .tox/ .coverage cover/

clean-git:
$(GIT) clean -xdn

clean-git-force:
$(GIT) clean -xdf

test-all: clean-pyc
$(TOX)

test:
$(PYTHON) setup.py test

cov:
$(NOSETESTS) -xv --with-coverage --cover-html --cover-branch

gitcleanforce:
git clean -xdf
build:
$(PYTHON) setup.py sdist bdist_wheel

distcheck: flakecheck test gitclean
distcheck: lint test clean

dist: gitcleanforce removepyc
dist: readme contrib clean-dist build

0 comments on commit a7f4251

Please sign in to comment.