Revision eed5c5df
b/Makefile.am | ||
---|---|---|
13 | 13 |
DOCBOOK_WRAPPER = $(top_srcdir)/autotools/docbook-wrapper |
14 | 14 |
BUILD_BASH_COMPLETION = $(top_srcdir)/autotools/build-bash-completion |
15 | 15 |
RUN_IN_TEMPDIR = $(top_srcdir)/autotools/run-in-tempdir |
16 |
CHECK_PYTHON_CODE = $(top_srcdir)/autotools/check-python-code |
|
16 | 17 |
REPLACE_VARS_SED = autotools/replace_vars.sed |
17 | 18 |
|
18 | 19 |
hypervisordir = $(pkgpythondir)/hypervisor |
... | ... | |
195 | 196 |
DEVNOTES \ |
196 | 197 |
pylintrc \ |
197 | 198 |
autotools/build-bash-completion \ |
199 |
autotools/check-python-code \ |
|
198 | 200 |
autotools/docbook-wrapper \ |
199 | 201 |
autotools/run-in-tempdir \ |
200 | 202 |
daemons/ganeti-cleaner.in \ |
... | ... | |
280 | 282 |
PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) \ |
281 | 283 |
$(RUN_IN_TEMPDIR) $(PYTHON) |
282 | 284 |
|
283 |
srclink_files = \ |
|
284 |
man/footer.sgml \ |
|
285 |
all_python_code = \ |
|
285 | 286 |
$(dist_sbin_SCRIPTS) \ |
286 | 287 |
$(dist_tools_SCRIPTS) \ |
287 | 288 |
$(dist_TESTS) \ |
... | ... | |
292 | 293 |
$(confd_PYTHON) \ |
293 | 294 |
$(noinst_PYTHON) |
294 | 295 |
|
296 |
srclink_files = \ |
|
297 |
man/footer.sgml \ |
|
298 |
$(all_python_code) |
|
299 |
|
|
300 |
check_python_code = \ |
|
301 |
$(all_python_code) |
|
302 |
|
|
295 | 303 |
all-local: stamp-directories devel/upload \ |
296 | 304 |
doc/examples/bash_completion \ |
297 | 305 |
doc/examples/ganeti.initd doc/examples/ganeti.cron \ |
... | ... | |
403 | 411 |
ganeti: |
404 | 412 |
cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; } |
405 | 413 |
|
414 |
check-local: |
|
415 |
$(CHECK_PYTHON_CODE) $(check_python_code) |
|
416 |
|
|
406 | 417 |
# a dist hook rule for catching revision control directories |
407 | 418 |
distcheck-hook: |
408 | 419 |
if find $(top_distdir) | grep -F -e '.svn' -e '.git'; then \ |
b/autotools/check-python-code | ||
---|---|---|
1 |
#!/bin/bash |
|
2 |
# |
|
3 |
|
|
4 |
# Copyright (C) 2009 Google Inc. |
|
5 |
# |
|
6 |
# This program is free software; you can redistribute it and/or modify |
|
7 |
# it under the terms of the GNU General Public License as published by |
|
8 |
# the Free Software Foundation; either version 2 of the License, or |
|
9 |
# (at your option) any later version. |
|
10 |
# |
|
11 |
# This program is distributed in the hope that it will be useful, but |
|
12 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 |
# General Public License for more details. |
|
15 |
# |
|
16 |
# You should have received a copy of the GNU General Public License |
|
17 |
# along with this program; if not, write to the Free Software |
|
18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
19 |
# 02110-1301, USA. |
|
20 |
|
|
21 |
let problems=0 |
|
22 |
|
|
23 |
for script; do |
|
24 |
if grep -H -F $'\t' "$script"; then |
|
25 |
let ++problems |
|
26 |
echo "Found tabs in $script" >&2 |
|
27 |
fi |
|
28 |
if [[ "$(wc --max-line-length < "$script")" -gt 80 ]]; then |
|
29 |
let ++problems |
|
30 |
echo "Longest line in $script is longer than 80 characters" >&2 |
|
31 |
fi |
|
32 |
done |
|
33 |
|
|
34 |
if [[ "$problems" -gt 0 ]]; then |
|
35 |
echo "Found $problems problems while checking code." >&2 |
|
36 |
exit 1 |
|
37 |
fi |
Also available in: Unified diff