makepackage: fix locating Panda3D on sys.path on macOS w/ Py 3.7

Also moves panda3d.dist-info directory to /Developer/Panda3D/ so that deleting /Developer/Panda3D makes it possible to install panda3d via pip again.

Fixes #502
This commit is contained in:
rdb 2019-01-03 15:03:53 +01:00
parent 173d3883dc
commit 9ff536432d

View File

@ -531,6 +531,10 @@ def MakeInstallerOSX(version, runtime=False, python_versions=[], **kwargs):
if os.path.isdir(outputdir+"/Pmw"):
oscmd("cp -R %s/Pmw dstroot/pythoncode/Developer/Panda3D/Pmw" % outputdir)
# Copy over panda3d.dist-info directory.
if os.path.isdir(outputdir + "/panda3d.dist-info"):
oscmd("cp -R %s/panda3d.dist-info dstroot/pythoncode/Developer/Panda3D/panda3d.dist-info" % (outputdir))
for base in os.listdir(outputdir+"/panda3d"):
if base.endswith('.py'):
libname = "dstroot/pythoncode/Developer/Panda3D/panda3d/" + base
@ -554,9 +558,12 @@ def MakeInstallerOSX(version, runtime=False, python_versions=[], **kwargs):
oscmd("mkdir -p dstroot/pybindings%s/Library/Python/%s/site-packages" % (pyver, pyver))
WriteFile("dstroot/pybindings%s/Library/Python/%s/site-packages/Panda3D.pth" % (pyver, pyver), "/Developer/Panda3D")
# Copy over panda3d.dist-info directory.
if os.path.isdir(outputdir + "/panda3d.dist-info"):
oscmd("cp -R %s/panda3d.dist-info dstroot/pybindings%s/Library/Python/%s/site-packages/" % (outputdir, pyver, pyver))
# Evidently not all Python 3.7 installations read the above path, so do this for now
# See GitHub #502
if pyver == "3.7":
dir = "dstroot/pybindings%s/Library/Frameworks/Python.framework/Versions/%s/lib/python%s/site-packages" % (pyver, pyver, pyver)
oscmd("mkdir -p %s" % (dir))
WriteFile("%s/Panda3D.pth" % (dir), "/Developer/Panda3D")
if not PkgSkip("FFMPEG"):
oscmd("mkdir -p dstroot/ffmpeg/Developer/Panda3D/lib")