3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-06 17:44:08 +00:00

Fixed Python 2.x vs 3.x issues.

Fixes Z3Prover/bin#2.
This commit is contained in:
Christoph M. Wintersteiger 2015-11-19 23:24:04 +01:00
parent 5948013b1b
commit 3ed5945cb2
3 changed files with 13 additions and 35 deletions

View file

@ -171,32 +171,23 @@ def mk_dist_dir():
if is_verbose():
print("Generated distribution folder at '%s'" % dist_path)
ZIPOUT = None
def mk_zip_visitor(pattern, dir, files):
for filename in files:
if fnmatch(filename, pattern):
fname = os.path.join(dir, filename)
if not os.path.isdir(fname):
ZIPOUT.write(fname)
def get_dist_path():
return get_z3_name()
def mk_zip():
global ZIPOUT
dist_path = get_dist_path()
old = os.getcwd()
try:
os.chdir(DIST_DIR)
zfname = '%s.zip' % dist_path
ZIPOUT = zipfile.ZipFile(zfname, 'w', zipfile.ZIP_DEFLATED)
os.walk(dist_path, mk_zip_visitor, '*')
zipout = zipfile.ZipFile(zfname, 'w', zipfile.ZIP_DEFLATED)
for root, dirs, files in os.walk(dist_path):
for f in files:
zipout.write(os.path.join(root, f))
if is_verbose():
print("Generated '%s'" % zfname)
except:
pass
ZIPOUT = None
os.chdir(old)
def cp_license():

View file

@ -510,15 +510,11 @@ def dos2unix(fname):
if is_verbose():
print("dos2unix '%s'" % fname)
def dos2unix_tree_core(pattern, dir, files):
for filename in files:
if fnmatch(filename, pattern):
fname = os.path.join(dir, filename)
if not os.path.isdir(fname):
dos2unix(fname)
def dos2unix_tree():
os.walk('src', dos2unix_tree_core, '*')
for root, dirs, files in os.walk('src'):
for f in files:
dos2unix(os.path.join(root, f))
def check_eol():
if not IS_WINDOWS:

View file

@ -186,32 +186,23 @@ def mk_dist_dir():
mk_dist_dir_core(False)
mk_dist_dir_core(True)
ZIPOUT = None
def mk_zip_visitor(pattern, dir, files):
for filename in files:
if fnmatch(filename, pattern):
fname = os.path.join(dir, filename)
if not os.path.isdir(fname):
ZIPOUT.write(fname)
def get_dist_path(x64):
return get_z3_name(x64)
def mk_zip_core(x64):
global ZIPOUT
def mk_zip(x64):
dist_path = get_dist_path(x64)
old = os.getcwd()
try:
os.chdir(DIST_DIR)
zfname = '%s.zip' % dist_path
ZIPOUT = zipfile.ZipFile(zfname, 'w', zipfile.ZIP_DEFLATED)
os.walk(dist_path, mk_zip_visitor, '*')
zipout = zipfile.ZipFile(zfname, 'w', zipfile.ZIP_DEFLATED)
for root, dirs, files in os.walk(dist_path):
for f in files:
zipout.write(os.path.join(root, f))
if is_verbose():
print("Generated '%s'" % zfname)
except:
pass
ZIPOUT = None
os.chdir(old)
# Create a zip file for each platform