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 args,"-I%s"%path
|
||||
|
||||
#unsigned char tpt_console_pyc[] = { 0x1B, 0x57};
|
||||
lst=[]
|
||||
compileall.compile_dir("./src/python", force=1)
|
||||
ext=False
|
||||
#see if we're on 64bit.
|
||||
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"
|
||||
try:
|
||||
fid=open(fname,"r")
|
||||
except IOError:
|
||||
fname="./src/python/tpt_console.pyo"
|
||||
finally:
|
||||
fid.close()
|
||||
print "generating pyconsole.h"
|
||||
|
||||
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)
|
||||
fname="./src/python/tpt_console.pyc"
|
||||
try:
|
||||
fid=open(fname,"r")
|
||||
except IOError:
|
||||
fname="./src/python/tpt_console.pyo"
|
||||
finally:
|
||||
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"
|
||||
|
@ -68,7 +68,9 @@ extern unsigned char ZSIZE;
|
||||
#define BRUSH_NUM 2
|
||||
|
||||
#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
|
||||
typedef unsigned short pixel;
|
||||
|
File diff suppressed because one or more lines are too long
@ -27,10 +27,8 @@
|
||||
|
||||
#ifdef PYCONSOLE
|
||||
#include "Python.h"
|
||||
#ifndef PYEXT
|
||||
#include "pyconsole.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -2009,6 +2007,7 @@ int main(int argc, char *argv[])
|
||||
PyRun_SimpleString("print 'python present.'");
|
||||
//load the console module and whatnot
|
||||
#ifdef PYEXT
|
||||
PyRun_SimpleString(tpt_console_py);
|
||||
printf("using external python console file.\n");
|
||||
pname=PyString_FromString("tpt_console");//create string object
|
||||
pmodule = PyImport_Import(pname);//import module
|
||||
|
Reference in New Issue
Block a user