Browse Source

makepanda: remove unused 2to3 code in CopyPythonTree

We haven't needed this for a while since the direct tree is both Python 2 and 3 capable, and furthermore, Python 2.7 is EOL and will be dropped soon in Panda3D.
rdb 6 years ago
parent
commit
8d472dfbcc
1 changed files with 3 additions and 35 deletions
  1. 3 35
      makepanda/makepandacore.py

+ 3 - 35
makepanda/makepandacore.py

@@ -3055,29 +3055,13 @@ def CopyTree(dstdir, srcdir, omitVCS=True):
         if omitVCS:
             DeleteVCS(dstdir)
 
-def CopyPythonTree(dstdir, srcdir, lib2to3_fixers=[], threads=0):
+def CopyPythonTree(dstdir, srcdir, threads=0):
     if (not os.path.isdir(dstdir)):
         os.mkdir(dstdir)
 
-    lib2to3 = None
-    lib2to3_args = ['-w', '-n', '--no-diffs']
-
-    if len(lib2to3_fixers) > 0 and sys.version_info >= (3, 0):
-        from lib2to3.main import main as lib2to3
-
-        if lib2to3_fixers == ['all']:
-            lib2to3_args += ['-x', 'buffer', '-x', 'idioms', '-x', 'set_literal', '-x', 'ws_comma']
-        else:
-            for fixer in lib2to3_fixers:
-                lib2to3_args += ['-f', fixer]
-
-    if threads:
-        lib2to3_args += ['-j', str(threads)]
-
     exclude_files = set(VCS_FILES)
     exclude_files.add('panda3d.py')
 
-    refactor = []
     for entry in os.listdir(srcdir):
         srcpth = os.path.join(srcdir, entry)
         dstpth = os.path.join(dstdir, entry)
@@ -3086,26 +3070,10 @@ def CopyPythonTree(dstdir, srcdir, lib2to3_fixers=[], threads=0):
             if entry not in exclude_files and ext not in SUFFIX_INC + ['.pyc', '.pyo']:
                 if (NeedsBuild([dstpth], [srcpth])):
                     WriteBinaryFile(dstpth, ReadBinaryFile(srcpth))
-
-                    if ext == '.py' and not entry.endswith('-extensions.py') and lib2to3 is not None:
-                        refactor.append((dstpth, srcpth))
-                        lib2to3_args.append(dstpth)
-                    else:
-                        JustBuilt([dstpth], [srcpth])
+                    JustBuilt([dstpth], [srcpth])
 
         elif entry not in VCS_DIRS:
-            CopyPythonTree(dstpth, srcpth, lib2to3_fixers, threads=threads)
-
-    if refactor and lib2to3 is not None:
-        ret = lib2to3("lib2to3.fixes", lib2to3_args)
-
-        if ret != 0:
-            for dstpth, srcpth in refactor:
-                os.remove(dstpth)
-                exit("Error in lib2to3.")
-        else:
-            for dstpth, srcpth in refactor:
-                JustBuilt([dstpth], [srcpth])
+            CopyPythonTree(dstpth, srcpth, threads=threads)
 
 ########################################################################
 ##