2018-04-30 19:49:11 +02:00
|
|
|
#!/usr/bin/env python2
|
2015-03-03 16:28:24 +01:00
|
|
|
|
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
sys.path = [ os.path.dirname(__file__)+"/../Python" ]+sys.path
|
|
|
|
import cPickle as pickle
|
2015-03-03 18:11:32 +01:00
|
|
|
import zlib
|
2015-03-03 16:28:24 +01:00
|
|
|
from ezfio import ezfio_obj, ezfio
|
|
|
|
|
|
|
|
# Hide errors
|
2015-03-09 17:59:15 +01:00
|
|
|
def f(where,txt):
|
|
|
|
raise IOError
|
|
|
|
ezfio.error = f
|
2015-03-03 16:28:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
if len(sys.argv) == 1:
|
|
|
|
print "syntax: %s <EZFIO_Archive.ezar>"%(sys.argv[0])
|
|
|
|
sys.exit(1)
|
|
|
|
ezfio_filename = sys.argv[1].split(".ezar")[0]
|
|
|
|
|
|
|
|
file = open(ezfio_filename+".ezar","r")
|
|
|
|
dump = file.read()
|
|
|
|
file.close()
|
|
|
|
|
|
|
|
ezfio.set_filename(ezfio_filename)
|
|
|
|
|
2015-03-03 18:11:32 +01:00
|
|
|
d = pickle.loads(zlib.decompress(dump))
|
2015-03-03 16:28:24 +01:00
|
|
|
|
|
|
|
set_functions = d.keys()
|
|
|
|
|
|
|
|
nerrors_old = len(d)+1
|
|
|
|
nerrors = nerrors_old+1
|
|
|
|
while nerrors != nerrors_old:
|
|
|
|
nerrors_old = nerrors
|
|
|
|
nerrors = 0
|
|
|
|
failed = []
|
|
|
|
for f_name in set_functions:
|
|
|
|
try:
|
|
|
|
exec """ezfio.%s = d['%s']"""%(f_name,f_name)
|
|
|
|
except:
|
|
|
|
nerrors += 1
|
|
|
|
failed.append(f_name)
|
|
|
|
|
|
|
|
if nerrors != 0:
|
|
|
|
print "Unarchive failed:"
|
|
|
|
for i in failed:
|
|
|
|
print i
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|