ScreenTranslator/share/ci/windeploy.py

45 lines
1.4 KiB
Python
Raw Normal View History

2020-03-01 16:30:43 +07:00
import common as c
from config import *
import os
import sys
import shutil
2020-04-12 19:52:42 +07:00
from glob import glob
2020-03-01 16:30:43 +07:00
tag = os.environ.get('TAG', '')
artifact_name = '{}-{}{}-{}.zip'.format(app_name, app_version, tag, os_name)
2020-03-01 16:30:43 +07:00
if len(sys.argv) > 1 and sys.argv[1] == 'artifact_name': # subcommand
c.print(artifact_name)
exit(0)
artifact_path = os.path.abspath(artifact_name)
c.print('>> Making win deploy')
if os_name.startswith('win'):
env_cmd = c.get_msvc_env_cmd(bitness=bitness, msvc_version=msvc_version)
c.apply_cmd_env(env_cmd)
pwd = os.getcwd()
os.chdir(build_dir)
install_dir = os.path.abspath(app_name)
c.recreate_dir(install_dir)
c.run('nmake INSTALL_ROOT="{0}" DESTDIR="{0}" install'.format(install_dir))
c.run('{}/bin/windeployqt.exe "{}"'.format(qt_dir, install_dir))
libs_dir = os.path.join(dependencies_dir, 'bin')
for file in os.scandir(libs_dir):
if file.is_file(follow_symlinks=False) and file.name.endswith('.dll'):
full_name = os.path.join(libs_dir, file.name)
c.print('>> Copying {} to {}'.format(full_name, install_dir))
shutil.copy(full_name, install_dir)
2020-04-12 19:52:42 +07:00
for f in glob(ssl_dir + '/bin/*.dll'):
c.print('>> Copying {} to {}'.format(f, install_dir))
shutil.copy(f, install_dir)
2020-03-01 16:30:43 +07:00
c.archive(c.get_folder_files(os.path.relpath(install_dir)), artifact_path)
2020-04-26 20:30:59 +07:00
bin_path = install_dir + '\\' + bin_name + '.exe'
c.print('>> Md5 {} {}'.format(bin_path, c.md5sum(bin_path)))