mirror of
https://gitlab.com/scemama/EZFIO.git
synced 2025-01-10 13:08:12 +01:00
Added zlib in archive/unarchive
This commit is contained in:
parent
cf872f6514
commit
a9e41fcb65
@ -4,6 +4,7 @@ import sys
|
|||||||
import os
|
import os
|
||||||
sys.path = [ os.path.dirname(__file__)+"/../Python" ]+sys.path
|
sys.path = [ os.path.dirname(__file__)+"/../Python" ]+sys.path
|
||||||
import cPickle as pickle
|
import cPickle as pickle
|
||||||
|
import zlib
|
||||||
from ezfio import ezfio_obj, ezfio
|
from ezfio import ezfio_obj, ezfio
|
||||||
|
|
||||||
# Hide errors
|
# Hide errors
|
||||||
@ -13,10 +14,17 @@ ezfio.error = f
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
do_verbose = False
|
||||||
|
if "-v" in sys.argv:
|
||||||
|
do_verbose = True
|
||||||
|
sys.argv.remove("-v")
|
||||||
|
|
||||||
if len(sys.argv) == 1:
|
if len(sys.argv) == 1:
|
||||||
print "syntax: %s <EZFIO_Filename>"%(sys.argv[0])
|
print "syntax: %s <EZFIO_Filename>"%(sys.argv[0])
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
ezfio_filename = sys.argv[1]
|
ezfio_filename = sys.argv[1]
|
||||||
|
while ezfio_filename[-1] == "/":
|
||||||
|
ezfio_filename = ezfio_filename[:-1]
|
||||||
|
|
||||||
ezfio.set_filename(ezfio_filename)
|
ezfio.set_filename(ezfio_filename)
|
||||||
|
|
||||||
@ -30,11 +38,13 @@ def main():
|
|||||||
try:
|
try:
|
||||||
exec """d['%s'] = ezfio.%s"""%(f_name,f_name)
|
exec """d['%s'] = ezfio.%s"""%(f_name,f_name)
|
||||||
except:
|
except:
|
||||||
|
if do_verbose:
|
||||||
print "%-40s [%5s]"%(f_name, "Empty")
|
print "%-40s [%5s]"%(f_name, "Empty")
|
||||||
else:
|
else:
|
||||||
|
if do_verbose:
|
||||||
print "%-40s [%5s]"%(f_name, " OK ")
|
print "%-40s [%5s]"%(f_name, " OK ")
|
||||||
|
|
||||||
dump = pickle.dumps(d)
|
dump = zlib.compress(pickle.dumps(d))
|
||||||
file = open(ezfio_filename+".ezar","w")
|
file = open(ezfio_filename+".ezar","w")
|
||||||
file.write(dump)
|
file.write(dump)
|
||||||
file.close()
|
file.close()
|
||||||
|
@ -4,6 +4,7 @@ import sys
|
|||||||
import os
|
import os
|
||||||
sys.path = [ os.path.dirname(__file__)+"/../Python" ]+sys.path
|
sys.path = [ os.path.dirname(__file__)+"/../Python" ]+sys.path
|
||||||
import cPickle as pickle
|
import cPickle as pickle
|
||||||
|
import zlib
|
||||||
from ezfio import ezfio_obj, ezfio
|
from ezfio import ezfio_obj, ezfio
|
||||||
|
|
||||||
# Hide errors
|
# Hide errors
|
||||||
@ -24,7 +25,7 @@ def main():
|
|||||||
|
|
||||||
ezfio.set_filename(ezfio_filename)
|
ezfio.set_filename(ezfio_filename)
|
||||||
|
|
||||||
d = pickle.loads(dump)
|
d = pickle.loads(zlib.decompress(dump))
|
||||||
|
|
||||||
set_functions = d.keys()
|
set_functions = d.keys()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user