DOCBOOK_WRAPPER = $(top_srcdir)/autotools/docbook-wrapper
BUILD_BASH_COMPLETION = $(top_srcdir)/autotools/build-bash-completion
RUN_IN_TEMPDIR = $(top_srcdir)/autotools/run-in-tempdir
+CHECK_PYTHON_CODE = $(top_srcdir)/autotools/check-python-code
REPLACE_VARS_SED = autotools/replace_vars.sed
hypervisordir = $(pkgpythondir)/hypervisor
DEVNOTES \
pylintrc \
autotools/build-bash-completion \
+ autotools/check-python-code \
autotools/docbook-wrapper \
autotools/run-in-tempdir \
daemons/ganeti-cleaner.in \
PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) \
$(RUN_IN_TEMPDIR) $(PYTHON)
-srclink_files = \
- man/footer.sgml \
+all_python_code = \
$(dist_sbin_SCRIPTS) \
$(dist_tools_SCRIPTS) \
$(dist_TESTS) \
$(confd_PYTHON) \
$(noinst_PYTHON)
+srclink_files = \
+ man/footer.sgml \
+ $(all_python_code)
+
+check_python_code = \
+ $(all_python_code)
+
all-local: stamp-directories devel/upload \
doc/examples/bash_completion \
doc/examples/ganeti.initd doc/examples/ganeti.cron \
ganeti:
cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
+check-local:
+ $(CHECK_PYTHON_CODE) $(check_python_code)
+
# a dist hook rule for catching revision control directories
distcheck-hook:
if find $(top_distdir) | grep -F -e '.svn' -e '.git'; then \
--- /dev/null
+#!/bin/bash
+#
+
+# Copyright (C) 2009 Google Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+let problems=0
+
+for script; do
+ if grep -H -F $'\t' "$script"; then
+ let ++problems
+ echo "Found tabs in $script" >&2
+ fi
+ if [[ "$(wc --max-line-length < "$script")" -gt 80 ]]; then
+ let ++problems
+ echo "Longest line in $script is longer than 80 characters" >&2
+ fi
+done
+
+if [[ "$problems" -gt 0 ]]; then
+ echo "Found $problems problems while checking code." >&2
+ exit 1
+fi