Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
179 lines (145 loc) · 5.32 KB
/
Copy pathMakefile
File metadata and controls
179 lines (145 loc) · 5.32 KB
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
PYTHON = python
top_srcdir = src
COVERAGE_MODULES = feat
TOOLS = tools
TRIAL = ${TOOLS}/flumotion-trial
PEP8 = ${TOOLS}/pep8.py --repeat
SHOW_COVERAGE = ${TOOLS}/show-coverage.py
GIT_REVISION = $(shell git describe || echo 'unknown')
# Begin Help snippet
# Source: https://gist.github.com/prwhite/8168133#gistcomment-1727513
#COLORS
GREEN := $(shell tput -Txterm setaf 2)
WHITE := $(shell tput -Txterm setaf 7)
YELLOW := $(shell tput -Txterm setaf 3)
RESET := $(shell tput -Txterm sgr0)
# Add the following 'help' target to your Makefile
# And add help text after each target name starting with '\#\#'
# A category can be added with @category
HELP_FUN = \
%help; \
while(<>) { push @{$$help{$$2 // 'options'}}, [$$1, $$3] if /^([a-zA-Z\-]+)\s*:.*\#\#(?:@([a-zA-Z\-]+))?\s(.*)$$/ }; \
print "usage: make [target]\n\n"; \
for (sort keys %help) { \
print "${WHITE}$$_:${RESET}\n"; \
for (@{$$help{$$_}}) { \
$$sep = " " x (32 - length $$_->[0]); \
print " ${YELLOW}$$_->[0]${RESET}$$sep${GREEN}$$_->[1]${RESET}\n"; \
}; \
print "\n"; }
# End Help snippet
VERSION := $(shell python setup.py --version)
SPRINT_VERSION := $(shell python -c 'from datetime import datetime; print("%s.%d" %(str(datetime.today().year)[-2:],(datetime.today().isocalendar()[1]/2)*2))')
PREVIOUS_SPRINT_VERSION := $(shell python -c 'from datetime import datetime; print("%s.%d" %(str(datetime.today().year)[-2:],((datetime.today().isocalendar()[1] - 2)/2)*2))')
help: ##@general Show this help.
@perl -e '$(HELP_FUN)' $(MAKEFILE_LIST)
clean: clean-build clean-pyc clean-test ##@build remove all build, test, coverage and Python artifacts
clean-build: ##@build remove build artifacts
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +
clean-pyc: ##@build remove Python file artifacts
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
clean-test: ##@build remove test and coverage artifacts
rm -fr .tox/
rm -f .coverage
rm -fr htmlcov/
rm -fr .pytest_cache
check-local: check-tests check-local-pep8
check-local-pep8:
find $(top_srcdir) -name \*.py | grep -v extern | \
sort -u | xargs $(PYTHON) $(PEP8)
pyflakes:
find $(top_srcdir) -name \*.py | grep -v extern | \
sort -u | xargs pyflakes
pychecker:
find $(top_srcdir) -name \*.py | grep -v extern | \
sort -u | xargs pychecker
check-tests:
$(PYTHON) $(TRIAL) $(TRIAL_FLAGS) $(COVERAGE_MODULES)
check-tests-fast:
@make check-tests \
TRIAL_FLAGS="--skip-slow"
check-doc: doc/reference/html/index.html
check-zip:
-make check-tests FEAT_DEBUG=4 > test.out 2>&1
-rm -r check
mkdir -p check
-mv test.out check
-mv _trial_temp check
-mv test.log check
git describe > check/feat.gitversion
zip -r check-$(GIT_REVISION).zip check
doc/reference/html/index.html: Makefile src
epydoc feat -o doc/reference/html -v --fail-on-warning | $(PYTHON) common/epyfilter.py common/efc.py
docs:
@-rm doc/reference/html/index.html
make doc/reference/html/index.html
coverage:
@test ! -z "$(COVERAGE_MODULES)" || \
(echo Define COVERAGE_MODULES in your Makefile; exit 1)
rm -f feat-saved-coverage.pickle
$(PYTHON) $(TRIAL) --temp-directory=_trial_coverage --coverage --saved-coverage=feat-saved-coverage.pickle $(COVERAGE_MODULES)
make show-coverage
show-coverage:
@test ! -z "$(COVERAGE_MODULES)" || \
(echo Define COVERAGE_MODULES in your Makefile; exit 1)
@keep=""; \
for m in $(COVERAGE_MODULES); do \
echo adding $$m; \
keep="$$keep `ls _trial_coverage/coverage/$$m*`"; \
done; \
$(PYTHON) $(SHOW_COVERAGE) $$keep
check-fast:
@make check-commit \
TRIAL_FLAGS="--skip-slow"
check-commit:
current=`pwd`; \
repo=`pwd`; \
reponame=`basename $$current`; \
dst=/tmp/$$reponame; \
if test -d $$dst; then \
(echo Removing old $$dst; rm -rf $$dst); \
fi; \
cd /tmp; \
git clone --recursive --depth 0 $$repo; \
cd $$reponame; \
make check-local; \
cd $$current; \
rm -rf $$dst;
targz:
python setup.py sdist
mv dist/feat-*.tar.gz .
rpm: el6
el6: targz
mach -k -r c6l64 build feat.spec
release: dist ##@build package and upload a release
twine upload -r getfinancing dist/*
dist: clean ##@build builds source and wheel package
python setup.py sdist
python setup.py bdist_wheel
ls -l dist
#ln -s gfbase-${VERSION}.tar.gz dist/gfbase-latest.tar.gz
bumpdev: ##@build Bump the dev version of the package, when package is not yet final.
bumpversion --allow-dirty dev
git diff
bumprel: ##@build Bump version to create a new release in the current sprint.
bumpversion --allow-dirty patch
git diff
bumpreset: ##@build Apply current sprint year.year_week as the packae version.
bumpversion --allow-dirty --new-version ${SPRINT_VERSION} minor
git diff
bumpresetpre: ##@build Apply previous sprint year.year_week as the packae version.
bumpversion --allow-dirty --new-version ${PREVIOUS_SPRINT_VERSION} minor
git diff
version: ##@build Show current version
@echo "Current version: ${VERSION}"
@echo "Previous sprint was: ${PREVIOUS_SPRINT_VERSION}"
@echo "New sprint is: ${SPRINT_VERSION}"
@echo "Type make bumpreset to set current sprint or make bumpresetpre to set previous sprint version"
@gfversion gfbase gfdba feat