diff options
| author | Lieuwe <lieuwemo@gmail.com> | 2011-03-03 19:33:48 (GMT) |
|---|---|---|
| committer | Lieuwe <lieuwemo@gmail.com> | 2011-03-03 19:33:48 (GMT) |
| commit | eab871c77487714cab68b9e4753a2bcf7ece79f4 (patch) | |
| tree | da70ee33dff5e931415614528a0b224b386670e2 /getheader.py | |
| parent | 9f8811159cc80eed0cf30408fdca139a6604fffe (diff) | |
| download | powder-eab871c77487714cab68b9e4753a2bcf7ece79f4.zip powder-eab871c77487714cab68b9e4753a2bcf7ece79f4.tar.gz | |
getheader now compiles python files
Diffstat (limited to 'getheader.py')
| -rw-r--r-- | getheader.py | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/getheader.py b/getheader.py index 558726c..58af0ef 100644 --- a/getheader.py +++ b/getheader.py @@ -1,5 +1,6 @@ import sys import os.path +import compileall path=os.path.join(sys.exec_prefix,"include","python%s"%sys.version[:3]) #print "headers at ",repr(path) #-lpython2.3 -lm -L/usr/lib/python2.3/config @@ -10,4 +11,28 @@ print args,"-I%s"%path path=os.path.join(sys.exec_prefix,"include") args="-lpython%s -lm -L%s"%(sys.version[:3],os.path.join(sys.exec_prefix,"lib","config"))#,"python%s"%sys.version[:3] print "\n windows args are" -print args,"-I%s"%path
\ No newline at end of file +print args,"-I%s"%path + +#unsigned char tpt_console_pyc[] = { 0x1B, 0x57}; +lst=[] +compileall.compile_dir("./src/python", force=1) + +print "\n\n\ngenerating pyconsole.h" + +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("0x"+hex(ord(char))) +tmp=",".join(lst) +out=''.join(["unsigned char tpt_console_pyc[] = {",tmp,"};"]) +with open("./includes/pyconsole.h","w") as fid: + fid.write(out) +print "done" +
\ No newline at end of file |
