Switch to using Pyinstaller. Closes #5550.
Cx_freeze has not been updated in a long time and does not even work with Python > 3.5.
This commit is contained in:
parent
31e069e93f
commit
41a0292993
|
@ -56,7 +56,7 @@ class PackageGenerator:
|
||||||
redist_glob = 'C:\\Program Files\\Microsoft Visual Studio\\2017\\Community\\VC\\Redist\\MSVC\\*\\MergeModules\\Microsoft_VC141_CRT_x86.msm'
|
redist_glob = 'C:\\Program Files\\Microsoft Visual Studio\\2017\\Community\\VC\\Redist\\MSVC\\*\\MergeModules\\Microsoft_VC141_CRT_x86.msm'
|
||||||
trials = glob(redist_glob)
|
trials = glob(redist_glob)
|
||||||
if len(trials) != 1:
|
if len(trials) != 1:
|
||||||
sys.exit('There are more than one potential redist dirs.')
|
sys.exit('Could not find unique MSM setup.')
|
||||||
self.redist_path = trials[0]
|
self.redist_path = trials[0]
|
||||||
self.component_num = 0
|
self.component_num = 0
|
||||||
self.feature_properties = {
|
self.feature_properties = {
|
||||||
|
@ -114,20 +114,24 @@ class PackageGenerator:
|
||||||
modules = self.get_all_modules_from_dir('mesonbuild/modules')
|
modules = self.get_all_modules_from_dir('mesonbuild/modules')
|
||||||
modules += self.get_all_modules_from_dir('mesonbuild/scripts')
|
modules += self.get_all_modules_from_dir('mesonbuild/scripts')
|
||||||
modules += self.get_more_modules()
|
modules += self.get_more_modules()
|
||||||
modulestr = ','.join(modules)
|
|
||||||
python = shutil.which('python')
|
pyinstaller = shutil.which('pyinstaller')
|
||||||
cxfreeze = os.path.join(os.path.dirname(python), "Scripts", "cxfreeze")
|
if not pyinstaller:
|
||||||
if not os.path.isfile(cxfreeze):
|
print("ERROR: This script requires pyinstaller.")
|
||||||
print("ERROR: This script requires cx_freeze module")
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
subprocess.check_call([python,
|
pyinstaller_tmpdir = 'pyinst-tmp'
|
||||||
cxfreeze,
|
if os.path.exists(pyinstaller_tmpdir):
|
||||||
'--target-dir',
|
shutil.rmtree(pyinstaller_tmpdir)
|
||||||
main_stage,
|
pyinst_cmd = [pyinstaller,
|
||||||
'--include-modules',
|
'--clean',
|
||||||
modulestr,
|
'--distpath',
|
||||||
'meson.py'])
|
pyinstaller_tmpdir]
|
||||||
|
for m in modules:
|
||||||
|
pyinst_cmd += ['--hidden-import', m]
|
||||||
|
pyinst_cmd += ['meson.py']
|
||||||
|
subprocess.check_call(pyinst_cmd)
|
||||||
|
shutil.move(pyinstaller_tmpdir + '/meson', main_stage)
|
||||||
if not os.path.exists(os.path.join(main_stage, 'meson.exe')):
|
if not os.path.exists(os.path.join(main_stage, 'meson.exe')):
|
||||||
sys.exit('Meson exe missing from staging dir.')
|
sys.exit('Meson exe missing from staging dir.')
|
||||||
os.mkdir(ninja_stage)
|
os.mkdir(ninja_stage)
|
||||||
|
@ -288,7 +292,7 @@ class PackageGenerator:
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if not os.path.exists('meson.py'):
|
if not os.path.exists('meson.py'):
|
||||||
sys.exit(print('Run me in the top level source dir.'))
|
sys.exit(print('Run me in the top level source dir.'))
|
||||||
subprocess.check_call(['pip', 'install', '--upgrade', 'cx_freeze'])
|
subprocess.check_call(['pip', 'install', '--upgrade', 'pyinstaller'])
|
||||||
|
|
||||||
p = PackageGenerator()
|
p = PackageGenerator()
|
||||||
p.build_dist()
|
p.build_dist()
|
||||||
|
|
Loading…
Reference in New Issue