Browse Source

makepanda: Don't copy over old Python 2-only Pmw versions

rdb 4 years ago
parent
commit
b42fd4ee4f
2 changed files with 16 additions and 4 deletions
  1. 4 2
      makepanda/makepanda.py
  2. 12 2
      makepanda/makepandacore.py

+ 4 - 2
makepanda/makepanda.py

@@ -3071,8 +3071,10 @@ else:
 if not PkgSkip("PANDATOOL"):
 if not PkgSkip("PANDATOOL"):
     CopyAllFiles(GetOutputDir()+"/plugins/",  "pandatool/src/scripts/", ".mel")
     CopyAllFiles(GetOutputDir()+"/plugins/",  "pandatool/src/scripts/", ".mel")
     CopyAllFiles(GetOutputDir()+"/plugins/",  "pandatool/src/scripts/", ".ms")
     CopyAllFiles(GetOutputDir()+"/plugins/",  "pandatool/src/scripts/", ".ms")
-if not PkgSkip("PYTHON") and os.path.isdir(GetThirdpartyBase()+"/Pmw"):
-    CopyTree(GetOutputDir()+'/Pmw',         GetThirdpartyBase()+'/Pmw')
+
+if not PkgSkip("PYTHON") and os.path.isdir(GetThirdpartyBase() + "/Pmw"):
+    CopyTree(GetOutputDir() + "/Pmw", GetThirdpartyBase() + "/Pmw", exclude=["Pmw_1_3", "Pmw_1_3_3"])
+
 ConditionalWriteFile(GetOutputDir()+'/include/ctl3d.h', '/* dummy file to make MAX happy */')
 ConditionalWriteFile(GetOutputDir()+'/include/ctl3d.h', '/* dummy file to make MAX happy */')
 
 
 # Since Eigen is included by all sorts of core headers, as a convenience
 # Since Eigen is included by all sorts of core headers, as a convenience

+ 12 - 2
makepanda/makepandacore.py

@@ -3104,13 +3104,16 @@ def CopyAllHeaders(dir, skip=[]):
             WriteBinaryFile(dstfile, ReadBinaryFile(srcfile))
             WriteBinaryFile(dstfile, ReadBinaryFile(srcfile))
             JustBuilt([dstfile], [srcfile])
             JustBuilt([dstfile], [srcfile])
 
 
-def CopyTree(dstdir, srcdir, omitVCS=True):
+def CopyTree(dstdir, srcdir, omitVCS=True, exclude=()):
     if os.path.isdir(dstdir):
     if os.path.isdir(dstdir):
         source_entries = os.listdir(srcdir)
         source_entries = os.listdir(srcdir)
         for entry in source_entries:
         for entry in source_entries:
             srcpth = os.path.join(srcdir, entry)
             srcpth = os.path.join(srcdir, entry)
             dstpth = os.path.join(dstdir, entry)
             dstpth = os.path.join(dstdir, entry)
 
 
+            if entry in exclude:
+                continue
+
             if os.path.islink(srcpth) or os.path.isfile(srcpth):
             if os.path.islink(srcpth) or os.path.isfile(srcpth):
                 if not omitVCS or entry not in VCS_FILES:
                 if not omitVCS or entry not in VCS_FILES:
                     CopyFile(dstpth, srcpth)
                     CopyFile(dstpth, srcpth)
@@ -3120,7 +3123,7 @@ def CopyTree(dstdir, srcdir, omitVCS=True):
 
 
         # Delete files in dstdir that are not in srcdir.
         # Delete files in dstdir that are not in srcdir.
         for entry in os.listdir(dstdir):
         for entry in os.listdir(dstdir):
-            if entry not in source_entries:
+            if entry not in source_entries or entry in exclude:
                 path = os.path.join(dstdir, entry)
                 path = os.path.join(dstdir, entry)
                 if os.path.islink(path) or os.path.isfile(path):
                 if os.path.islink(path) or os.path.isfile(path):
                     os.remove(path)
                     os.remove(path)
@@ -3136,6 +3139,13 @@ def CopyTree(dstdir, srcdir, omitVCS=True):
             if subprocess.call(['cp', '-R', '-f', srcdir, dstdir]) != 0:
             if subprocess.call(['cp', '-R', '-f', srcdir, dstdir]) != 0:
                 exit("Copy failed.")
                 exit("Copy failed.")
 
 
+        for entry in exclude:
+            path = os.path.join(dstdir, entry)
+            if os.path.islink(path) or os.path.isfile(path):
+                os.remove(path)
+            elif os.path.isdir(path):
+                shutil.rmtree(path)
+
         if omitVCS:
         if omitVCS:
             DeleteVCS(dstdir)
             DeleteVCS(dstdir)