forked from ossobv/exactonline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
61 lines (51 loc) · 1.85 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
.PHONY: cleanup compile default dist install isclean pep test vimmodelines
PYTHON = python # or python3
WHERE = ./exactonline
PYFILES = $(wildcard $(WHERE)/*.py)
DATAFILES = LICENSE.txt README.rst
default: cleanup vimmodelines pep compile test
dist: isclean $(PYFILES) $(DATAFILES)
# sdist likes a reStructuredText README.txt
#cp -n README.rst README.txt
# do the sdist
$(PYTHON) setup.py sdist
##python setup.py register # only needed once
#python setup.py sdist upload
# clean up
$(RM) MANIFEST
#README.txt
install:
$(PYTHON) setup.py install
isclean:
# Check that there are no leftover unversioned python files.
# If there are, you should clean it up.
# (We check this, because the setup.py will include every .py it finds
# due to its find_package_module() function.)
! (git status | sed -e '1,/^# Untracked/d;/^#\t.*\.py$$/!d;s/^#\t/Untracked: /' | grep .)
# These files should be created AND removed by the *-dist rules.
test ! -f README.txt
cleanup:
#$(RM) -r build
find $(WHERE) -name '*.pyc' | \
xargs --no-run-if-empty -d\\n rm
which pepclean >/dev/null && find $(WHERE) -name '*.py' | \
xargs --no-run-if-empty -d\\n pepclean
compile:
$(PYTHON) -m compileall $(WHERE)
pep:
@# Use a custom --format so the path is space separated for
@# easier copy-pasting.
find $(WHERE) -name '*.py' -print0 | \
xargs --no-run-if-empty -0 $(PYTHON) -m flake8 \
--max-line-length=99 --max-complexity=10 \
--format='%(path)s %(row)d:%(col)d [%(code)s] %(text)s'
test: $(PYFILES)
# Check RST, somewhat.
$(PYTHON) setup.py check --restructuredtext --strict
# Run tests on the rest.
./runtests23.sh
vimmodelines:
find $(WHERE) -name '*.py' -size +0 '!' -perm -u=x -print0 | \
xargs --no-run-if-empty -0 grep -L '^# v''im:' | \
xargs --no-run-if-empty -d\\n \
sed -i -e '1i# vim: set ts=8 sw=4 sts=4 et ai tw=79:'