forked from datalad/datalad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (39 loc) · 1.88 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
# simple makefile to simplify repetetive build env management tasks under posix
# Ideas borrowed from scikit-learn's and PyMVPA Makefiles -- thanks!
PYTHON ?= python
NOSETESTS ?= nosetests
MODULE ?= datalad
all: clean test
clean:
$(PYTHON) setup.py clean
rm -rf dist build bin
bin:
mkdir -p $@
PYTHONPATH=bin:$(PYTHONPATH) python setup.py develop --install-dir $@
test-code: bin
PATH=bin:$(PATH) PYTHONPATH=bin:$(PYTHONPATH) $(NOSETESTS) -s -v $(MODULE)
test-coverage:
rm -rf coverage .coverage
$(NOSETESTS) -s -v --with-coverage $(MODULE)
test: test-code
trailing-spaces:
find $(MODULE) -name "*.py" -exec perl -pi -e 's/[ \t]*$$//' {} \;
code-analysis:
flake8 $(MODULE) | grep -v __init__ | grep -v external
pylint -E -i y $(MODULE)/ # -d E1103,E0611,E1101
manpages: bin
mkdir -p build/man
# main manpage
DATALAD_HELP2MAN=1 PYTHONPATH=. help2man --no-discard-stderr \
--help-option="--help-np" -N -n "data management and sharing tool" \
"bin/datalad" > build/man/datalad.1 ; \
# figure out all relevant interface files, fuck yeah Python
for api in $$(PYTHONPATH=. python -c "from datalad.interface.base import get_interface_groups, get_cmdline_command_name; print(' '.join([' '.join([intf[0] + ':' + get_cmdline_command_name(intf) for intf in group[2]]) for group in get_interface_groups()]))"); do \
mod="$$(echo $${api} | cut -d ':' -f 1)" ; \
cmd="$$(echo $${api} | cut -d ':' -f 2)" ; \
summary="$$(grep -A 1 'class.*(.*Interface.*)' $$(python -c "import inspect; import $${mod} as mod; print(inspect.getsourcefile(mod))") | grep -v ':' | grep -v '^--' | sed -e 's/"//g' -e 's/^[ \t]*//;s/[ \t.]*$$//' | tr 'A-Z' 'a-z')" ; \
DATALAD_HELP2MAN=1 PYTHONPATH=. help2man --no-discard-stderr \
--help-option="--help-np" -N -n "$$summary" \
"bin/datalad $${cmd}" > build/man/datalad-$${cmd}.1 ; \
sed -i -e "4 s/^datalad /datalad $${cmd} /" build/man/datalad-$${cmd}.1 ; \
done