Browse Source

bpo-43425: Remove test2to3 from Tools (#26981)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
pull/27217/head
Dong-hee Na 4 years ago
committed by GitHub
parent
commit
d0b2b00c7d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      Misc/NEWS.d/next/Tools-Demos/2021-07-01-22-21-25.bpo-43425.t65len.rst
  2. 2
      Tools/README
  3. 3
      Tools/test2to3/README
  4. 10
      Tools/test2to3/maintest.py
  5. 26
      Tools/test2to3/setup.py
  6. 19
      Tools/test2to3/test/runtests.py
  7. 8
      Tools/test2to3/test/test_foo.py
  8. 1
      Tools/test2to3/test2to3/__init__.py
  9. 5
      Tools/test2to3/test2to3/hello.py

3
Misc/NEWS.d/next/Tools-Demos/2021-07-01-22-21-25.bpo-43425.t65len.rst

@ -0,0 +1,3 @@
Removed the 'test2to3' demo project that demonstrated using lib2to3
to support Python 2.x and Python 3.x from a single source in
a distutils package. Patch by Dong-hee Na

2
Tools/README

@ -35,8 +35,6 @@ scripts A number of useful single-file programs, e.g. tabnanny.py
stringbench A suite of micro-benchmarks for various operations on
strings (both 8-bit and unicode). (*)
test2to3 A demonstration of how to use 2to3 transparently in setup.py.
unicode Tools for generating unicodedata and codecs from unicode.org
and other mapping files (by Fredrik Lundh, Marc-Andre Lemburg
and Martin von Loewis).

3
Tools/test2to3/README

@ -1,3 +0,0 @@
This project demonstrates how a distutils package
can support Python 2.x and Python 3.x from a single
source, using lib2to3.

10
Tools/test2to3/maintest.py

@ -1,10 +0,0 @@
#!/usr/bin/env python3
# The above line should get replaced with the path to the Python
# interpreter; the block below should get 2to3-converted.
try:
from test2to3.hello import hello
except ImportError, e:
print "Import failed", e
hello()

26
Tools/test2to3/setup.py

@ -1,26 +0,0 @@
# -*- coding: iso-8859-1 -*-
from distutils.core import setup
try:
from distutils.command.build_py import build_py_2to3 as build_py
except ImportError:
from distutils.command.build_py import build_py
try:
from distutils.command.build_scripts import build_scripts_2to3 as build_scripts
except ImportError:
from distutils.command.build_scripts import build_scripts
setup(
name = "test2to3",
version = "1.0",
description = "2to3 distutils test package",
author = "Martin v. Löwis",
author_email = "python-dev@python.org",
license = "PSF license",
packages = ["test2to3"],
scripts = ["maintest.py"],
cmdclass = {'build_py': build_py,
'build_scripts': build_scripts,
}
)

19
Tools/test2to3/test/runtests.py

@ -1,19 +0,0 @@
# Fictitious test runner for the project
import sys, os
if sys.version_info > (3,):
# copy test suite over to "build/lib" and convert it
from distutils.util import copydir_run_2to3
testroot = os.path.dirname(__file__)
newroot = os.path.join(testroot, '..', 'build/lib/test')
copydir_run_2to3(testroot, newroot)
# in the following imports, pick up the converted modules
sys.path[0] = newroot
# run the tests here...
from test_foo import FooTest
import unittest
unittest.main()

8
Tools/test2to3/test/test_foo.py

@ -1,8 +0,0 @@
import sys
import unittest
class FooTest(unittest.TestCase):
def test_foo(self):
# use 2.6 syntax to demonstrate conversion
print 'In test_foo, using Python %s...' % (sys.version_info,)
self.assertTrue(False)

1
Tools/test2to3/test2to3/__init__.py

@ -1 +0,0 @@
# empty

5
Tools/test2to3/test2to3/hello.py

@ -1,5 +0,0 @@
def hello():
try:
print "Hello, world"
except IOError, e:
print e.errno
Loading…
Cancel
Save