← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~mars/launchpad/add-py25-lint into lp:launchpad/devel

 

Māris Fogels has proposed merging lp:~mars/launchpad/add-py25-lint into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)


This branch adds a test for Python 2.5 incompatible code to the bin/lint.sh script.

I manually tested all of the execution paths in this patch.  Python2.5 is not a
Launchpad development dependency, so a branch was included to make this check
conditional.  pyflakes is used for the check, and pyflakes is in
launchpad-developer-dependencies.


-- 
Māris Fogels -- https://launchpad.net/~mars
Launchpad.net -- cross-project collaboration and hosting
-- 
https://code.launchpad.net/~mars/launchpad/add-py25-lint/+merge/36502
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~mars/launchpad/add-py25-lint into lp:launchpad/devel.
=== modified file 'buildout-templates/bin/lint.sh.in'
--- buildout-templates/bin/lint.sh.in	2010-07-17 21:42:06 +0000
+++ buildout-templates/bin/lint.sh.in	2010-09-23 20:26:03 +0000
@@ -152,3 +152,32 @@
 
 echo ""
 pocketlint $pocketlint_files 2>&1
+
+
+# Check the changed files with Python 2.5, if possible
+if [ -e '/usr/bin/python2.5' ]; then
+    pyfiles=$(echo "$files" | grep '.py')
+    if [ "$pyfiles" ]; then
+        echo
+        echo "Checking changed sources for Python 2.5 incompatible code... "
+        problems=$(/usr/bin/python2.5 /usr/bin/pyflakes $pyfiles |& grep -e 'invalid')
+        if [ "$problems" ]; then
+            echo
+            echo $problems
+            echo
+            echo "  *********************************************************"
+            echo "  *** CRITICAL: Python 2.5 incompatible code was found! ***"
+            echo "  *********************************************************"
+            echo
+            echo "      You should fix this before committing the code!"
+            echo
+            exit 1
+        fi
+        echo "Done"
+    fi
+else
+    echo
+    echo "  Python 2.5 is not installed!"
+    echo "  Skipped checking for Python 2.5 incompatible code."
+    echo
+fi


Follow ups