diff options
| author | Simon <simon@hardwired.org.uk> | 2011-03-22 17:25:29 (GMT) |
|---|---|---|
| committer | Simon <simon@hardwired.org.uk> | 2011-03-22 17:25:29 (GMT) |
| commit | c096b2b14a200a0cc0a08cfea839c9e7f4edf22e (patch) | |
| tree | 6aaca470697115e62c8f5f4c612847499233dac7 /getheader.py | |
| parent | 7d56b3358969164deccb7cc837aa5dd3b59ea4f3 (diff) | |
| parent | ffc3e0a5ee780c05abe5ff53432583c40ed62032 (diff) | |
| download | powder-c096b2b14a200a0cc0a08cfea839c9e7f4edf22e.zip powder-c096b2b14a200a0cc0a08cfea839c9e7f4edf22e.tar.gz | |
More cracker fixes
Diffstat (limited to 'getheader.py')
| -rw-r--r-- | getheader.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/getheader.py b/getheader.py new file mode 100644 index 0000000..536915e --- /dev/null +++ b/getheader.py @@ -0,0 +1,37 @@ +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 +args="-lpython%s -lm -L%s"%(sys.version[:3],os.path.join(sys.exec_prefix,"lib","python%s"%sys.version[:3],"config")) +print " linux args are" +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 + +#unsigned char tpt_console_pyc[] = { 0x1B, 0x57}; +lst=[] +compileall.compile_dir("./src/python", force=1) + +print "generating 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(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" |
