diff options
| author | Simon <simon@hardwired.org.uk> | 2011-03-22 17:58:52 (GMT) |
|---|---|---|
| committer | Simon <simon@hardwired.org.uk> | 2011-03-22 17:58:52 (GMT) |
| commit | 2e401babb793238564ca640fc802a52ab7f6c293 (patch) | |
| tree | 87a9b471e82604e76f96d556f5771322fb31818a /addzip.py | |
| parent | c096b2b14a200a0cc0a08cfea839c9e7f4edf22e (diff) | |
| parent | 04a9cbcb8855e64db660a8c6e23d79114b4afd83 (diff) | |
| download | powder-2e401babb793238564ca640fc802a52ab7f6c293.zip powder-2e401babb793238564ca640fc802a52ab7f6c293.tar.gz | |
Python console
Diffstat (limited to 'addzip.py')
| -rw-r--r-- | addzip.py | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/addzip.py b/addzip.py new file mode 100644 index 0000000..b80d346 --- /dev/null +++ b/addzip.py @@ -0,0 +1,49 @@ +import zipfile +import os +import os.path +import sys + +if(len(sys.argv)>1 and sys.argv[1]=="--clean"): + print "cleaning" + for dirpath,dirnames,filenames in os.walk("./src/python/stdlib"): + for fname in filenames: + if(fname.endswith(".pyc") or fname.endswith(".pyo")): + os.remove(os.path.join(dirpath,fname)) + raise SystemExit + +print "zipping stdlib" +fid=zipfile.ZipFile("./build/tptPython.zip","w",zipfile.ZIP_DEFLATED) + +#ZipFile.write(filename) +files=os.walk("./src/python/stdlib") +num=0 +pn=0 +for dirpath,dirnames,filenames in files: + for fname in filenames: + if(fname.endswith(".py")): + continue + fid.write(os.path.join(dirpath,fname)) + num+=1 + if(num-5>=pn): + pn=num + print "%d done."%num + +print "writing zipfile" +fid.close() + +raise SystemExit + +"""not needed.""" +print "generating pystdlib.h" +with open("stdlib.zip","r") as fid: + with open("./includes/pystdlib.h","w") as outfid: + outfid.write("unsigned char tpt_console_stdlib[] = {") + tmp=0 + for char in fid.read(): + outfid.write(hex(ord(char))) + outfid.write(",") + tmp+=1 + outfid.write("};\n") + outfid.write("size_t tpt_console_stdlibsize=%d;"%tmp) +print "done" + |
