From b42fd4ee4f77af8934a278e2f3c7b9d83cf14c1f Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 29 Nov 2021 14:50:01 +0100 Subject: [PATCH] makepanda: Don't copy over old Python 2-only Pmw versions --- makepanda/makepanda.py | 6 ++++-- makepanda/makepandacore.py | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index adbd685f13..145ffe19df 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -3071,8 +3071,10 @@ else: if not PkgSkip("PANDATOOL"): CopyAllFiles(GetOutputDir()+"/plugins/", "pandatool/src/scripts/", ".mel") 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 */') # Since Eigen is included by all sorts of core headers, as a convenience diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index d86620e18f..2201ddbdc5 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -3104,13 +3104,16 @@ def CopyAllHeaders(dir, skip=[]): WriteBinaryFile(dstfile, ReadBinaryFile(srcfile)) JustBuilt([dstfile], [srcfile]) -def CopyTree(dstdir, srcdir, omitVCS=True): +def CopyTree(dstdir, srcdir, omitVCS=True, exclude=()): if os.path.isdir(dstdir): source_entries = os.listdir(srcdir) for entry in source_entries: srcpth = os.path.join(srcdir, entry) dstpth = os.path.join(dstdir, entry) + if entry in exclude: + continue + if os.path.islink(srcpth) or os.path.isfile(srcpth): if not omitVCS or entry not in VCS_FILES: CopyFile(dstpth, srcpth) @@ -3120,7 +3123,7 @@ def CopyTree(dstdir, srcdir, omitVCS=True): # Delete files in dstdir that are not in srcdir. 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) if os.path.islink(path) or os.path.isfile(path): os.remove(path) @@ -3136,6 +3139,13 @@ def CopyTree(dstdir, srcdir, omitVCS=True): if subprocess.call(['cp', '-R', '-f', srcdir, dstdir]) != 0: 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: DeleteVCS(dstdir)