[Jython-checkins] jython: jycompile Ant task prints path of lib file that fails to compile

jim.baker jython-checkins at python.org
Mon Jan 12 19:24:35 CET 2015


https://hg.python.org/jython/rev/3e45b9f2bc2a
changeset:   7527:3e45b9f2bc2a
user:        Jim Baker <jim.baker at rackspace.com>
date:        Mon Jan 12 11:24:03 2015 -0700
summary:
  jycompile Ant task prints path of lib file that fails to compile

This should help find files that will not compile, and therefore break
the ant build, usually due to isolated Unicode surrogate literals, as
seen in evaluating what it will take to upgrade lib-python/2.7 to
2.7.9 (http://bugs.jython.org/issue2250)

files:
  src/org/python/util/JycompileAntTask.java |  17 +++++++---
  1 files changed, 11 insertions(+), 6 deletions(-)


diff --git a/src/org/python/util/JycompileAntTask.java b/src/org/python/util/JycompileAntTask.java
--- a/src/org/python/util/JycompileAntTask.java
+++ b/src/org/python/util/JycompileAntTask.java
@@ -29,13 +29,18 @@
         props.setProperty(PySystemState.PYTHON_CACHEDIR_SKIP, "true");
         PySystemState.initialize(System.getProperties(), props);
         for (File src : toCompile) {
-            String name = _py_compile.getModuleName(src);
-            String compiledFilePath = name.replace('.', '/');
-            if (src.getName().endsWith("__init__.py")) {
-                compiledFilePath += "/__init__";
+            try {
+                String name = _py_compile.getModuleName(src);
+                String compiledFilePath = name.replace('.', '/');
+                if (src.getName().endsWith("__init__.py")) {
+                    compiledFilePath += "/__init__";
+                }
+                File compiled = new File(destDir, compiledFilePath + "$py.class");
+                compile(src, compiled, name);
+            } catch (RuntimeException e) {
+                log("Could not compile " + src);
+                throw e;
             }
-            File compiled = new File(destDir, compiledFilePath + "$py.class");
-            compile(src, compiled, name);
         }
     }
 

-- 
Repository URL: https://hg.python.org/jython


More information about the Jython-checkins mailing list