-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
106 lines (90 loc) · 3.06 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# ----------------------------------------------------------------------------
# Signet Makefile.
#
# Available Recipes
#
# build - invoke 'python setup.py build'
# clean - remove intermediate build targets
# comp - perform python static analysis (compile *.py -> *.pyc)
# docs - build signet documentation (docs/_build/html && README.md)
# (requires pandoc -- http://johnmacfarlane.net/pandoc/)
# install - invoke 'python setup.py install'
# tests - run signet unittests
#
# ----------------------------------------------------------------------------
ifeq ($(OS), Windows_NT)
OSTYPE := Windows
PYTHON := C:/Python27/python.exe
PYLINT := C:/Python27/Scripts/pylint
FIND := /usr/bin/find
else
OSTYPE := $(shell uname)
OSREL := $(shell uname -r)
SHELL := $(shell which bash)
export SHELL
PYTHON := python2.7
PYLINT := pylint
FIND := find
endif
PYARCH := $(shell $(PYTHON) -c "import platform; print platform.architecture()[0]")
# ----------------------------------------------------------------------------
# Implicit rule perform python static analysis. We refer to this
# as compiling. To only analyze python modules that have changed,
# we compile *.py -> *.pyc after each static analysis pass.
# ----------------------------------------------------------------------------
%.pyc: %.py
@echo Check $<
@$(PYLINT) -rn -sn --rcfile pylint.rc $<
@$(PYTHON) -c 'import py_compile; py_compile.compile("$<")'
# ----------------------------------------------------------------------------
# Build the list of target *.pyc to compile
# ----------------------------------------------------------------------------
TGTS := $(patsubst %.py,%.pyc,$(wildcard *.py))
TGTS += $(patsubst %.py,%.pyc,$(wildcard signet/*.py))
TGTS += $(patsubst %.py,%.pyc,$(wildcard signet/command/*.py))
TGTS += $(patsubst %.py,%.pyc,$(wildcard tests/*.py))
ifneq ($(OSTYPE), Windows)
TGTS := $(filter-out signet/command/sign_code.pyc,$(TGTS))
TGTS := $(filter-out tests/test_sign_code.pyc,$(TGTS))
TGTS := $(filter-out tests/winutils.pyc,$(TGTS))
endif
.PHONY: comp tests build install docs clean
comp: $(TGTS)
tests: comp
@$(PYTHON) setup.py develop
ifeq ($(OSTYPE), Windows)
@$(PYTHON) setup.py nosetests -s
else
@$(PYTHON) setup.py nosetests -s --exclude=test_sign_code
endif
testx: comp
#@$(PYTHON) setup.py nosetests -s --tests tests.test_build_ext:TestBuildSignet.test_skipdepends
@$(PYTHON) setup.py nosetests -s --tests tests.test_build_ext
build: comp
@$(PYTHON) setup.py build
install: comp
@$(PYTHON) setup.py install
docs:
@cd docs && $(MAKE) html
@pandoc -f rst -t markdown -o README.md docs/index.rst
clean:
-rm $(TGTS)
$(PYTHON) setup.py clean
pypi: comp
@python setup.py check
@python setup.py register sdist upload
publishdocs:
@chg=`git status -s|wc -l`; \
if [ $$chg -ne 0 ]; \
then \
echo "Run 'git commit ..' before publish"; \
exit -1; \
fi
git checkout gh-pages
git rm -r .
git checkout master -- docs/_build/html
git mv docs/_build/html/* .
git mv docs/_build/html/.nojekyll .
git commit -a -m "update docs"
git push origin gh-pages
git checkout master