build_library_zip: handle case when byte compilation failed

This commit is contained in:
Oleksii Shevchuk 2020-06-21 14:29:56 +03:00
parent c5af8ee96c
commit e763fbf732
1 changed files with 8 additions and 6 deletions

View File

@ -210,17 +210,19 @@ try:
[PATCHES] + ziproot.split('/')) [PATCHES] + ziproot.split('/'))
ext = '.py' ext = '.py'
print('adding file : {}'.format(zipname))
content.add(zipname)
if ext == '.py' and need_compile: if ext == '.py' and need_compile:
zf.writestr( bytecode = compile_py(os.path.join(file_root, f+ext))
zipname+'o', if not bytecode:
compile_py(os.path.join(file_root, f+ext))) print('[!] Failed to compile: ', f+ext)
continue
zf.writestr(zipname+'o', bytecode)
else: else:
zf.write(os.path.join( zf.write(os.path.join(
file_root, f+ext), zipname) file_root, f+ext), zipname)
print('adding file : {}'.format(zipname))
content.add(zipname)
break break
else: else:
if '<memimport>' in mpath: if '<memimport>' in mpath: