no need to include tpt_console.py on 64bit anymore.
This commit is contained in:
parent
59c0414ab4
commit
34051303cf
BIN
build/powder
BIN
build/powder
Binary file not shown.
63
getheader.py
63
getheader.py
@ -13,26 +13,53 @@ args="-lpython%s -lm -L%s"%(sys.version[:3],os.path.join(sys.exec_prefix,"lib","
|
|||||||
print "\n windows args are"
|
print "\n windows args are"
|
||||||
print args,"-I%s"%path
|
print args,"-I%s"%path
|
||||||
|
|
||||||
#unsigned char tpt_console_pyc[] = { 0x1B, 0x57};
|
ext=False
|
||||||
lst=[]
|
#see if we're on 64bit.
|
||||||
compileall.compile_dir("./src/python", force=1)
|
with open("./includes/defines.h") as fid:
|
||||||
|
for line in fid:
|
||||||
|
if(line.startswith("#define") and line.count("PYEXT")>0):
|
||||||
|
print "using external console.py"
|
||||||
|
ext=True
|
||||||
|
|
||||||
print "generating pyconsole.h"
|
if(ext):
|
||||||
|
print "external"
|
||||||
|
with open("./src/python/tpt_console.py") as fid:
|
||||||
|
consolepy=fid.read()
|
||||||
|
script="""
|
||||||
|
import tempfile,os.path,sys
|
||||||
|
dir=tempfile.gettempdir()
|
||||||
|
sys.path.append(dir)
|
||||||
|
tmp=%s
|
||||||
|
print "making console.py @ %%s"%%os.path.join(dir,"tpt_console.py")
|
||||||
|
with open(os.path.join(dir,"tpt_console.py"),"w") as fid:
|
||||||
|
fid.write(tmp)
|
||||||
|
"""%repr(consolepy)
|
||||||
|
tmp=[hex(ord(char)) for char in script]
|
||||||
|
out=["unsigned char tpt_console_py[] = {",','.join(tmp),"};"]
|
||||||
|
with open("./includes/pyconsole.h","w") as fid:
|
||||||
|
fid.write(''.join(out))
|
||||||
|
else:
|
||||||
|
print "internal"
|
||||||
|
#unsigned char tpt_console_pyc[] = { 0x1B, 0x57};
|
||||||
|
lst=[]
|
||||||
|
compileall.compile_dir("./src/python", force=1)
|
||||||
|
|
||||||
fname="./src/python/tpt_console.pyc"
|
print "generating pyconsole.h"
|
||||||
try:
|
|
||||||
fid=open(fname,"r")
|
|
||||||
except IOError:
|
|
||||||
fname="./src/python/tpt_console.pyo"
|
|
||||||
finally:
|
|
||||||
fid.close()
|
|
||||||
|
|
||||||
with open(fname,"r") as fid:
|
fname="./src/python/tpt_console.pyc"
|
||||||
for char in fid.read():
|
try:
|
||||||
lst.append(hex(ord(char)))
|
fid=open(fname,"r")
|
||||||
tmp=",".join(lst)
|
except IOError:
|
||||||
out=''.join(["#include <Python.h>\nunsigned char tpt_console_pyc[] = {",tmp,"};"])
|
fname="./src/python/tpt_console.pyo"
|
||||||
with open("./includes/pyconsole.h","w") as fid:
|
finally:
|
||||||
fid.write(out)
|
fid.close()
|
||||||
|
|
||||||
|
with open(fname,"r") as fid:
|
||||||
|
for char in fid.read():
|
||||||
|
lst.append(hex(ord(char)))
|
||||||
|
tmp=",".join(lst)
|
||||||
|
out=''.join(["#include <Python.h>\nunsigned char tpt_console_pyc[] = {",tmp,"};"])
|
||||||
|
with open("./includes/pyconsole.h","w") as fid:
|
||||||
|
fid.write(out)
|
||||||
print "done"
|
print "done"
|
||||||
|
|
@ -68,7 +68,9 @@ extern unsigned char ZSIZE;
|
|||||||
#define BRUSH_NUM 2
|
#define BRUSH_NUM 2
|
||||||
|
|
||||||
#define PYCONSOLE
|
#define PYCONSOLE
|
||||||
//#define PYEXT //enable this on 64bit to prevent segfault
|
//#define PYEXT
|
||||||
|
//WARNING pyext must be defined on 64bit!
|
||||||
|
//also, don't add a comment on that line, it breaks.
|
||||||
|
|
||||||
#ifdef PIX16
|
#ifdef PIX16
|
||||||
typedef unsigned short pixel;
|
typedef unsigned short pixel;
|
||||||
|
File diff suppressed because one or more lines are too long
@ -27,10 +27,8 @@
|
|||||||
|
|
||||||
#ifdef PYCONSOLE
|
#ifdef PYCONSOLE
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
#ifndef PYEXT
|
|
||||||
#include "pyconsole.h"
|
#include "pyconsole.h"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -2009,6 +2007,7 @@ int main(int argc, char *argv[])
|
|||||||
PyRun_SimpleString("print 'python present.'");
|
PyRun_SimpleString("print 'python present.'");
|
||||||
//load the console module and whatnot
|
//load the console module and whatnot
|
||||||
#ifdef PYEXT
|
#ifdef PYEXT
|
||||||
|
PyRun_SimpleString(tpt_console_py);
|
||||||
printf("using external python console file.\n");
|
printf("using external python console file.\n");
|
||||||
pname=PyString_FromString("tpt_console");//create string object
|
pname=PyString_FromString("tpt_console");//create string object
|
||||||
pmodule = PyImport_Import(pname);//import module
|
pmodule = PyImport_Import(pname);//import module
|
||||||
|
Reference in New Issue
Block a user