def setup(*args, **kwargs):
# Checking preconditions and such
signtool_path = get_windows_signtool_path()
print('Using this signtool:', signtool_path)
pfx_path = glob.glob(os.path.join('..', '*.pfx'))
if len(pfx_path) != 1:
raise RuntimeError('Expected to find exactly one PFX in the outer dir, found this: %r' % pfx_path)
pfx_path = pfx_path[0]
print('Using this certificate:', pfx_path)
pfx_password = input('Enter password to read the certificate file: ').strip()
# Freezing
cx_Freeze.setup(*args, **kwargs)
# Code signing the outputs
print('Signing the outputs...')
for out in glob.glob(os.path.join('dist', '*.msi')):
out_copy = '.signed.'.join(out.rsplit('.', 1))
try:
shutil.rmtree(out_copy)
except Exception:
pass
shutil.copy(out, out_copy)
print('Signing file:', out_copy)
while True:
try:
subprocess.check_call([signtool_path, 'sign',
'/f', pfx_path,
'/p', pfx_password,
'/t', WINDOWS_SIGNATURE_TIMESTAMPING_SERVER,
out_copy])
except Exception as ex:
print('SignTool failed:', ex)
if input('Try again? y/[n] ').lower().strip()[0] == 'y':
pass
else:
raise
else:
break
print('All files were signed successfully')
评论列表
文章目录