-
Notifications
You must be signed in to change notification settings - Fork 1
/
pychecker.mk
85 lines (69 loc) · 3.01 KB
/
pychecker.mk
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
# configure.ac needs to AM_CONDITIONAL HAVE_PYCHECKER
if HAVE_PYCHECKER
check-local-pychecker: pychecker
else
check-local-pychecker:
echo "Pychecker not found, passing"
endif
# include this snippet for the pychecker stuff
# Makefile.am needs to define
# PYCHECKER_WHITELIST
# and
# PYCHECKER_BLACKLIST
# can be overrridden by user
PYCHECKER = pychecker
pychecker_setup = `ls $(top_srcdir)/misc/setup.py 2> /dev/null`
pychecker_help = `ls $(top_srcdir)/misc/pycheckerhelp.py 2> /dev/null`
pychecker = \
$(PYCHECKER) $$PYCHECKER_OPTIONS \
-F misc/pycheckerrc \
$(pychecker_setup) \
$(pychecker_help)
# during distcheck, we get executed from $(NAME)-$(VERSION)/_build, while
# our python sources are one level up. Figure this out and set a OUR_PATH
# this uses Makefile syntax, so we need to protect it from automake
thisdir = $(shell basename `pwd`)
OUR_PATH = $(if $(subst _build,,$(thisdir)),$(shell pwd),$(shell pwd)/..)
# TODO: This looks a little confusing because our 0.10 files are named
# blah010.py
pychecker_all_files = $(filter-out $(PYCHECKER_BLACKLIST),$(wildcard $(PYCHECKER_WHITELIST)))
pychecker_010_files = $(filter %010.py,$(pychecker_all_files))
pychecker_indep_files = $(filter-out $(pychecker_010_files),$(pychecker_all_files))
pychecker_indep = PYTHONPATH=$(OUR_PATH):$$PYTHONPATH $(pychecker)
pychecker_010 = PYTHONPATH=$(OUR_PATH):$$PYTHONPATH FLU_GST_VERSION=0.10 $(pychecker)
# We could check at runtime if 0.10 is supported, but since it always should
# be at this point, we just let this be true always
# pychecker_if_010 = if test "x$(GST_010_SUPPORTED)" = "xyes"; then
pychecker_if_010 = if test "xyes" = "xyes"; then
pychecker_fi = else echo "passing, gstreamer version not supported"; fi
# we redirect stderr so we don't get messages like
# warning: couldn't find real module for class SSL.Error (module name: SSL)
# which can't be turned off in pychecker
pycheckersplit:
@echo running pychecker on each file ...
@for file in $(pychecker_all_files)
do \
$(pychecker) $$file > /dev/null 2>&1 \
if test $$? -ne 0; then \
echo "Error on $$file"; \
$(pychecker) $$file; break \
fi \
done
# pycheck a given file
%.pychecker: %
$(pychecker) $*
pychecker: pychecker010 pycheckerindep
pycheckerindep:
@echo running pychecker, gstreamer-agnostic files ...
@$(pychecker_indep) $(pychecker_indep_files) 2>/dev/null || make pycheckerverboseindep
pychecker010:
@echo running pychecker, gstreamer 0.10-specific code ...
@$(pychecker_if_010) $(pychecker_010) $(pychecker_010_files) 2>/dev/null \
|| make pycheckerverbose010; $(pychecker_fi)
pycheckerverbose: pycheckerverbose010 pycheckerverboseindep
pycheckerverboseindep:
@echo "running pychecker, gstreamer-agnostic files (verbose) ..."
export PYCHECKER_OPTIONS="--limit 1000" && $(pychecker_indep) $(pychecker_indep_files)
pycheckerverbose010:
@echo "running pychecker, gstreamer 0.10-specific code (verbose) ..."
$(pychecker_if_010) export PYCHECKER_OPTIONS="--limit 1000" && $(pychecker_010) $(pychecker_010_files); $(pychecker_fi)