2020-01-27 11:32:17 +01:00
|
|
|
#!/usr/bin/env python3
|
2015-03-03 16:28:24 +01:00
|
|
|
|
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
sys.path = [ os.path.dirname(__file__)+"/../Python" ]+sys.path
|
2020-01-27 11:32:17 +01:00
|
|
|
import pickle 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:
|
2020-01-27 11:32:17 +01:00
|
|
|
print(("syntax: %s <EZFIO_Archive.ezar>"%(sys.argv[0])))
|
2015-03-03 16:28:24 +01:00
|
|
|
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
|
|
|
|
2020-01-27 11:32:17 +01:00
|
|
|
set_functions = list(d.keys())
|
2015-03-03 16:28:24 +01:00
|
|
|
|
|
|
|
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:
|
2020-01-27 11:32:17 +01:00
|
|
|
exec("""ezfio.%s = d['%s']"""%(f_name,f_name))
|
2015-03-03 16:28:24 +01:00
|
|
|
except:
|
|
|
|
nerrors += 1
|
|
|
|
failed.append(f_name)
|
|
|
|
|
|
|
|
if nerrors != 0:
|
2020-01-27 11:32:17 +01:00
|
|
|
print("Unarchive failed:")
|
2015-03-03 16:28:24 +01:00
|
|
|
for i in failed:
|
2020-01-27 11:32:17 +01:00
|
|
|
print(i)
|
2015-03-03 16:28:24 +01:00
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|