mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
Don't require setting system PATH to import panda3d.* (backport from master)
This commit is contained in:
parent
df4c4bc250
commit
da6d5f442c
@ -1790,7 +1790,7 @@ def RunGenPyCode(target, inputs, opts):
|
|||||||
if (PkgSkip("PYTHON") != 0):
|
if (PkgSkip("PYTHON") != 0):
|
||||||
return
|
return
|
||||||
|
|
||||||
cmdstr = BracketNameWithQuotes(SDK["PYTHONEXEC"]) + " "
|
cmdstr = BracketNameWithQuotes(SDK["PYTHONEXEC"].replace('\\', '/')) + " "
|
||||||
if sys.version_info >= (2, 6):
|
if sys.version_info >= (2, 6):
|
||||||
cmdstr += "-B "
|
cmdstr += "-B "
|
||||||
|
|
||||||
@ -2591,6 +2591,39 @@ if (PkgSkip("DIRECT")==0):
|
|||||||
if os.path.isfile(GetOutputDir() + '/direct/ffi/panda3d.pyc'):
|
if os.path.isfile(GetOutputDir() + '/direct/ffi/panda3d.pyc'):
|
||||||
os.remove(GetOutputDir() + '/direct/ffi/panda3d.pyc')
|
os.remove(GetOutputDir() + '/direct/ffi/panda3d.pyc')
|
||||||
|
|
||||||
|
# These files used to exist; remove them to avoid conflicts.
|
||||||
|
del_files = ['core.py', 'core.pyc', 'core.pyo',
|
||||||
|
'_core.pyd', '_core.so',
|
||||||
|
'direct.py', 'direct.pyc', 'direct.pyo',
|
||||||
|
'_direct.pyd', '_direct.so']
|
||||||
|
|
||||||
|
for basename in del_files:
|
||||||
|
path = os.path.join(GetOutputDir(), 'panda3d', basename)
|
||||||
|
if os.path.isfile(path):
|
||||||
|
print("Removing %s" % (path))
|
||||||
|
os.remove(path)
|
||||||
|
|
||||||
|
# Write an appropriate panda3d/__init__.py
|
||||||
|
p3d_init = """"Python bindings for the Panda3D libraries"
|
||||||
|
"""
|
||||||
|
|
||||||
|
if GetTarget() == 'windows':
|
||||||
|
p3d_init += """
|
||||||
|
import os
|
||||||
|
|
||||||
|
bindir = os.path.join(os.path.dirname(__file__), '..', 'bin')
|
||||||
|
if os.path.isfile(os.path.join(bindir, 'libpanda.dll')):
|
||||||
|
if not os.environ.get('PATH'):
|
||||||
|
os.environ['PATH'] = bindir
|
||||||
|
else:
|
||||||
|
os.environ['PATH'] = bindir + os.pathsep + os.environ['PATH']
|
||||||
|
|
||||||
|
del os, bindir
|
||||||
|
"""
|
||||||
|
|
||||||
|
if not PkgSkip("PYTHON"):
|
||||||
|
ConditionalWriteFile(GetOutputDir() + '/panda3d/__init__.py', p3d_init)
|
||||||
|
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
#
|
#
|
||||||
# Generate the PRC files into the ETC directory.
|
# Generate the PRC files into the ETC directory.
|
||||||
|
@ -1061,7 +1061,6 @@ def MakeBuildTree():
|
|||||||
MakeDirectory(OUTPUTDIR + "/pandac")
|
MakeDirectory(OUTPUTDIR + "/pandac")
|
||||||
MakeDirectory(OUTPUTDIR + "/pandac/input")
|
MakeDirectory(OUTPUTDIR + "/pandac/input")
|
||||||
MakeDirectory(OUTPUTDIR + "/panda3d")
|
MakeDirectory(OUTPUTDIR + "/panda3d")
|
||||||
CreateFile(OUTPUTDIR + "/panda3d/__init__.py")
|
|
||||||
|
|
||||||
if GetTarget() == 'darwin':
|
if GetTarget() == 'darwin':
|
||||||
MakeDirectory(OUTPUTDIR + "/Frameworks")
|
MakeDirectory(OUTPUTDIR + "/Frameworks")
|
||||||
@ -2423,7 +2422,7 @@ def SetupBuildEnvironment(compiler):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Add our output directories to the environment.
|
# Add our output directories to the environment.
|
||||||
builtdir = os.path.join(os.path.abspath(GetOutputDir()))
|
builtdir = GetOutputDir()
|
||||||
AddToPathEnv("PYTHONPATH", builtdir)
|
AddToPathEnv("PYTHONPATH", builtdir)
|
||||||
AddToPathEnv("PANDA_PRC_DIR", os.path.join(builtdir, "etc"))
|
AddToPathEnv("PANDA_PRC_DIR", os.path.join(builtdir, "etc"))
|
||||||
AddToPathEnv("PATH", os.path.join(builtdir, "bin"))
|
AddToPathEnv("PATH", os.path.join(builtdir, "bin"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user