makepanda: add --no-copy-python flag for Windows build

This will avoid copying over the python installation to the built/python directory.
This commit is contained in:
rdb 2018-12-24 20:51:20 +01:00
parent d180be2acc
commit 94d1722c8c

View File

@ -70,6 +70,7 @@ WINDOWS_SDK = None
MSVC_VERSION = None
BOOUSEINTELCOMPILER = False
OPENCV_VER_23 = False
COPY_PYTHON = True
if "MACOSX_DEPLOYMENT_TARGET" in os.environ:
OSXTARGET=os.environ["MACOSX_DEPLOYMENT_TARGET"]
@ -170,6 +171,7 @@ def parseopts(args):
global COMPRESSOR,THREADCOUNT,OSXTARGET,OSX_ARCHS,HOST_URL
global DEBVERSION,WHLVERSION,RPMRELEASE,GIT_COMMIT,P3DSUFFIX,RTDIST_VERSION
global STRDXSDKVERSION, WINDOWS_SDK, MSVC_VERSION, BOOUSEINTELCOMPILER
global COPY_PYTHON
# Options for which to display a deprecation warning.
removedopts = [
@ -183,7 +185,7 @@ def parseopts(args):
"version=","lzma","no-python","threads=","outputdir=","override=",
"static","host=","debversion=","rpmrelease=","p3dsuffix=","rtdist-version=",
"directx-sdk=", "windows-sdk=", "msvc-version=", "clean", "use-icl",
"universal", "target=", "arch=", "git-commit=",
"universal", "target=", "arch=", "git-commit=", "no-copy-python",
] + removedopts
anything = 0
@ -249,6 +251,7 @@ def parseopts(args):
MSVC_VERSION = value.strip().lower()
elif (option=="--use-icl"): BOOUSEINTELCOMPILER = True
elif (option=="--clean"): clean_build = True
elif (option=="--no-copy-python"): COPY_PYTHON = False
elif (option[2:] in removedopts):
Warn("Ignoring removed option %s" % (option))
else:
@ -3058,7 +3061,8 @@ if tp_dir is not None:
CopyFile(GetOutputDir() + "/bin/", fn)
# Copy the whole Python directory.
CopyTree(GetOutputDir() + "/python", SDK["PYTHON"])
if COPY_PYTHON:
CopyTree(GetOutputDir() + "/python", SDK["PYTHON"])
# NB: Python does not always ship with the correct manifest/dll.
# Figure out the correct one to ship, and grab it from WinSxS dir.
@ -3067,7 +3071,7 @@ if tp_dir is not None:
os.unlink(manifest)
oscmd('mt -inputresource:"%s\\python.exe";#1 -out:"%s" -nologo' % (SDK["PYTHON"], manifest), True)
if os.path.isfile(manifest):
if COPY_PYTHON and os.path.isfile(manifest):
import xml.etree.ElementTree as ET
tree = ET.parse(manifest)
idents = tree.findall('./{urn:schemas-microsoft-com:asm.v1}dependency/{urn:schemas-microsoft-com:asm.v1}dependentAssembly/{urn:schemas-microsoft-com:asm.v1}assemblyIdentity')
@ -3097,11 +3101,12 @@ if tp_dir is not None:
CopyFile(GetOutputDir() + "/python/", file)
# Copy python.exe to ppython.exe.
if not os.path.isfile(SDK["PYTHON"] + "/ppython.exe") and os.path.isfile(SDK["PYTHON"] + "/python.exe"):
CopyFile(GetOutputDir() + "/python/ppython.exe", SDK["PYTHON"] + "/python.exe")
if not os.path.isfile(SDK["PYTHON"] + "/ppythonw.exe") and os.path.isfile(SDK["PYTHON"] + "/pythonw.exe"):
CopyFile(GetOutputDir() + "/python/ppythonw.exe", SDK["PYTHON"] + "/pythonw.exe")
ConditionalWriteFile(GetOutputDir() + "/python/panda.pth", "..\n../bin\n")
if COPY_PYTHON:
if not os.path.isfile(SDK["PYTHON"] + "/ppython.exe") and os.path.isfile(SDK["PYTHON"] + "/python.exe"):
CopyFile(GetOutputDir() + "/python/ppython.exe", SDK["PYTHON"] + "/python.exe")
if not os.path.isfile(SDK["PYTHON"] + "/ppythonw.exe") and os.path.isfile(SDK["PYTHON"] + "/pythonw.exe"):
CopyFile(GetOutputDir() + "/python/ppythonw.exe", SDK["PYTHON"] + "/pythonw.exe")
ConditionalWriteFile(GetOutputDir() + "/python/panda.pth", "..\n../bin\n")
# Copy over the MSVC runtime.
if GetTarget() == 'windows' and "VISUALSTUDIO" in SDK: