[Jython-checkins] jython: Add lib2to3 module to stdlib.

jim.baker jython-checkins at python.org
Sat Jan 9 19:58:39 EST 2016


https://hg.python.org/jython/rev/6aaa26de5b0b
changeset:   7864:6aaa26de5b0b
user:        Jim Baker <jim.baker at rackspace.com>
date:        Sat Jan 09 17:58:29 2016 -0700
summary:
  Add lib2to3 module to stdlib.

Required excluding compilation by Ant of this module's tests.

As motivated by the discussion on python-ideas for supporting optional
type annotations in Python 2.7; see
https://mail.python.org/pipermail/python-ideas/2016-January/037704.html

files:
  CPythonLib.includes  |   1 +
  Lib/test/regrtest.py |   5 -----
  build.xml            |  16 +++++++++++++++-
  3 files changed, 16 insertions(+), 6 deletions(-)


diff --git a/CPythonLib.includes b/CPythonLib.includes
--- a/CPythonLib.includes
+++ b/CPythonLib.includes
@@ -8,6 +8,7 @@
 encodings/**
 ensurepip/**
 importlib/*
+lib2to3/**
 json/**
 logging/*
 pydoc_data/**
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -94,8 +94,6 @@
     curses -    Tests that use curses and will modify the terminal's
                 state and output modes.
 
-    lib2to3 -   Run the tests for 2to3 (They take a while.)
-
     largefile - It is okay to run some test that may create huge
                 files.  These tests can take a long time and may
                 consume >2GB of disk space temporarily.
@@ -1267,9 +1265,6 @@
         test_winsound
         test_zipfile64         # requires bogus resource "extralargefile"
 
-        # Not yet Jython 3.x
-        test_lib2to3
-
         # Could rewrite these tests
         test_descr             # cannot import name verify
         test_epoll             # test works only on Linux 2.6
diff --git a/build.xml b/build.xml
--- a/build.xml
+++ b/build.xml
@@ -786,7 +786,21 @@
             <classpath path="${dist.dir}/${jython.dev.jar}" />
             <classpath refid="main.classpath" />
         </taskdef>
-        <jycompile srcdir="${dist.dir}/Lib" destdir="${dist.dir}/Lib" excludes="test/**"/>
+	<!-- One might think that the exclusion of lib2to3/tests/** is
+	     recursive, but one would be wrong ;) It's actually only
+	     two levels, so for now the workaround is to also include
+	     data/myfixes/**
+
+             This exclusion for lib2to3/tests/ in general is necessary
+             because data/infinite_recursion.py is not compileable by
+             Jython - it's too large and will exceed Java method
+             limits for the top level script; nor is
+             data/py3_test_grammar.py - it's Python 3. Meanwhile
+             refactor.get_all_fix_names depends on having *.py, not
+             exclusively $py.class, files available in
+             lib2to3/tests/data/myfixes/**. -->
+        <jycompile srcdir="${dist.dir}/Lib" destdir="${dist.dir}/Lib"
+		   excludes="test/**,lib2to3/tests/**,lib2to3/tests/data/myfixes/**"/>
     </target>
 
     <target name="copy-lib" depends="init, copy-javalib, copy-cpythonlib">

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


More information about the Jython-checkins mailing list