mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
Fix FreezeTool for linux, and auto-strip .py[cow]? when supplied as start file.
This commit is contained in:
parent
823069d4a6
commit
09d7fb02d8
@ -6,6 +6,7 @@ import sys
|
|||||||
import os
|
import os
|
||||||
import marshal
|
import marshal
|
||||||
import imp
|
import imp
|
||||||
|
from distutils.sysconfig import get_python_inc, get_python_lib, get_python_version
|
||||||
|
|
||||||
import direct
|
import direct
|
||||||
from pandac.PandaModules import *
|
from pandac.PandaModules import *
|
||||||
@ -36,7 +37,9 @@ linkDll = 'error'
|
|||||||
Python = None
|
Python = None
|
||||||
|
|
||||||
# The directory that includes Python.h.
|
# The directory that includes Python.h.
|
||||||
PythonIPath = None
|
PythonIPath = get_python_inc()
|
||||||
|
PythonLPath = get_python_lib()
|
||||||
|
PythonVersion = get_python_version()
|
||||||
|
|
||||||
# The root directory of Microsoft Visual Studio (if relevant)
|
# The root directory of Microsoft Visual Studio (if relevant)
|
||||||
MSVS = None
|
MSVS = None
|
||||||
@ -61,9 +64,9 @@ elif sys.platform == 'darwin':
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
# Linux
|
# Linux
|
||||||
compileObj = "gcc -fPIC -c -o %(basename)s.o -O2 %(filename)s"
|
compileObj = "gcc -fPIC -c -o %(basename)s.o -O2 %(filename)s -I %(pythonIPath)s"
|
||||||
linkExe = "gcc -o %(basename)s %(basename)s.o"
|
linkExe = "gcc -o %(basename)s %(basename)s.o -lpython2.6 -L %(pythonLPath)s"
|
||||||
linkDll = "gcc -shared -o %(basename)s.so %(basename)s.o"
|
linkDll = "gcc -shared -o %(basename)s.so %(basename)s.o -lpython%(pythonVersion)s -L %(pythonLPath)s"
|
||||||
|
|
||||||
# The code from frozenmain.c in the Python source repository.
|
# The code from frozenmain.c in the Python source repository.
|
||||||
frozenMainCode = """
|
frozenMainCode = """
|
||||||
@ -770,6 +773,8 @@ class Freezer:
|
|||||||
'python' : Python,
|
'python' : Python,
|
||||||
'msvs' : MSVS,
|
'msvs' : MSVS,
|
||||||
'pythonIPath' : PythonIPath,
|
'pythonIPath' : PythonIPath,
|
||||||
|
'pythonLPath' : PythonLPath,
|
||||||
|
'pythonVersion' : PythonVersion,
|
||||||
'filename' : filename,
|
'filename' : filename,
|
||||||
'basename' : basename,
|
'basename' : basename,
|
||||||
}
|
}
|
||||||
@ -792,6 +797,8 @@ class Freezer:
|
|||||||
'python' : Python,
|
'python' : Python,
|
||||||
'msvs' : MSVS,
|
'msvs' : MSVS,
|
||||||
'pythonIPath' : PythonIPath,
|
'pythonIPath' : PythonIPath,
|
||||||
|
'pythonLPath' : PythonLPath,
|
||||||
|
'pythonVersion' : PythonVersion,
|
||||||
'filename' : filename,
|
'filename' : filename,
|
||||||
'basename' : basename,
|
'basename' : basename,
|
||||||
}
|
}
|
||||||
|
@ -94,12 +94,18 @@ if __name__ == '__main__':
|
|||||||
basename = os.path.splitext(basename)[0]
|
basename = os.path.splitext(basename)[0]
|
||||||
outputType = 'dll'
|
outputType = 'dll'
|
||||||
|
|
||||||
freezer.addModule(args[0])
|
startfile = args[0]
|
||||||
|
if startfile.endswith('.py') or startfile.endswith('.pyw') or \
|
||||||
|
startfile.endswith('.pyc') or startfile.endswith('.pyo'):
|
||||||
|
startfile = os.path.splitext(startfile)[0]
|
||||||
|
|
||||||
|
freezer.addModule(startfile)
|
||||||
if outputType != 'dll':
|
if outputType != 'dll':
|
||||||
freezer.setMain(args[0])
|
freezer.setMain(startfile)
|
||||||
freezer.done()
|
freezer.done()
|
||||||
|
|
||||||
if outputType == 'mf':
|
if outputType == 'mf':
|
||||||
freezer.writeMultifile(basename)
|
freezer.writeMultifile(basename)
|
||||||
else:
|
else:
|
||||||
freezer.generateCode(basename)
|
freezer.generateCode(basename)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user