|
|
2012-09-03
, 14:46
|
|
|
Posts: 1,012 |
Thanked: 817 times |
Joined on Jul 2007
@ France
|
#2
|
| The Following 2 Users Say Thank You to Khertan For This Useful Post: | ||
|
|
2012-09-03
, 15:36
|
|
|
Posts: 640 |
Thanked: 435 times |
Joined on Oct 2011
@ rajvoSa BA
|
#3
|
http://khertan.net/pypackager
create digisigsums and md5sums in control/ then pack control/ and data/ into control.tar.gz & data.tar.gz and then assemble all into .ar
but seems like making tgz's is not as it should be...:S
so, i would really need someone's help here
here's raw code:
import os, time import tarfile as tf print "tar.gz-ing :D" tmp = "temp/" if os.path.exists(tmp): pass else: os.mkdir(tmp) datafle = "data.tar.gz" controlfle = "control.tar.gz" blacklist = ["Thumbs.db", "desktop.ini"] blacklistlnk = ".lnk" def getfiles(a, dirx, files): for inn in files: if len(dirx) >= 1: # this part is created because we need to chdir into data and into control to collect files into archive pth=dirx+"/" else: pth = dirx +"/" if os.path.isfile(pth+inn): if inn in blacklist: print "skipping " + pth+inn else: if inn.endswith(blacklistlnk): print "skipping " + pth+inn else: print pth+inn tar.add(pth+inn) # create data.tar.bz os.chdir("temp") tar = tf.open(datafle, "w:gz") os.chdir("../data/") # tar.add("") #should do job?, but there's .db and .ini files that's hidden, under win32 so we'll do my way :D os.path.walk("", getfiles, None) tar.close() os.chdir("..") # create control.tar.bz os.chdir("temp") tar = tf.open(controlfle, "w:gz") os.chdir("../control/") os.path.walk("", getfiles, None) tar.close() os.chdir("..")