forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjGenPyCode.py
More file actions
executable file
·97 lines (80 loc) · 3.06 KB
/
jGenPyCode.py
File metadata and controls
executable file
·97 lines (80 loc) · 3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
##############################################################
#
# This module should be invoked by a shell-script that says:
#
# python -c "import direct.ffi.jGenPyCode" <arguments>
#
# Before invoking python, the shell-script may need to set
# these environment variables, to make sure that everything
# can be located appropriately.
#
# PYTHONPATH
# PATH
# LD_LIBRARY_PATH
#
##############################################################
import sys, os
##############################################################
#
# Locate the 'direct' tree and the 'pandac' tree.
#
##############################################################
DIRECT=None
PANDAC=None
for dir in sys.path:
if (DIRECT is None):
if (dir != "") and os.path.exists(os.path.join(dir,"direct")):
DIRECT=os.path.join(dir,"direct")
if (PANDAC is None):
if (dir != "") and (os.path.exists(os.path.join(dir,"pandac"))):
PANDAC=os.path.join(dir,"pandac")
if (DIRECT is None):
sys.exit("Could not locate the 'direct' python modules")
if (PANDAC is None):
sys.exit("Could not locate the 'pandac' python modules")
##############################################################
#
# Locate direct/src/extensions.
#
# It could be inside the direct tree. It may be underneath
# a 'src' subdirectory. Or, the direct tree may actually be
# a stub that points to the source tree.
#
##############################################################
EXTENSIONS=None
if (EXTENSIONS is None):
if os.path.isdir(os.path.join(DIRECT,"src","extensions_native")):
EXTENSIONS=os.path.join(DIRECT,"src","extensions_native")
if (EXTENSIONS is None):
if os.path.isdir(os.path.join(DIRECT,"extensions_native")):
EXTENSIONS=os.path.join(DIRECT,"extensions_native")
if (EXTENSIONS is None):
if os.path.isdir(os.path.join(DIRECT,"..","..","direct","src","extensions_native")):
EXTENSIONS=os.path.join(DIRECT,"..","..","direct","src","extensions_native")
if (EXTENSIONS is None):
sys.exit("Could not locate direct/src/extensions_native")
##############################################################
#
# Call genpycode with default paths.
#
##############################################################
from direct.ffi import DoGenPyCode
from direct.ffi import FFIConstants
DoGenPyCode.outputCodeDir = PANDAC
DoGenPyCode.outputHTMLDir = os.path.join(PANDAC,"..","doc")
DoGenPyCode.directDir = DIRECT
DoGenPyCode.extensionsDir = EXTENSIONS
DoGenPyCode.interrogateLib = r'libdtoolconfig'
DoGenPyCode.codeLibs = ['libpandaexpress','libpanda','libpandaphysics','libpandafx','libp3direct','libpandaskel','libpandaegg','libpandaode']
DoGenPyCode.etcPath = [os.path.join(PANDAC,"input")]
DoGenPyCode.pythonSourcePath = [DIRECT]
DoGenPyCode.native = 1
#print "outputDir = ", DoGenPyCode.outputDir
#print "directDir = ", DoGenPyCode.directDir
#print "extensionsDir = ", DoGenPyCode.extensionsDir
#print "interrogateLib = ", DoGenPyCode.interrogateLib
#print "codeLibs = ", DoGenPyCode.codeLibs
#print "etcPath = ", DoGenPyCode.etcPath
#print "native = ", DoGenPyCode.native
DoGenPyCode.run()
os._exit(0)