summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2019-06-25 11:09:31 -0700
committerJussi Pakkanen <jpakkane@gmail.com>2019-06-26 11:51:54 +0300
commit41a0292993f6caa00fd7dea3bfe922220cd2d4e1 (patch)
treea169e244867f5951190c9e1e0c31ac10feefba4b
parent31e069e93f1ab73214a10c3928e9dba4e7c7bb6c (diff)
downloadmeson-41a0292993f6caa00fd7dea3bfe922220cd2d4e1.tar.gz
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.
-rwxr-xr-xmsi/createmsi.py32
1 files changed, 18 insertions, 14 deletions
diff --git a/msi/createmsi.py b/msi/createmsi.py
index 9e6c24ff7..1e3aea5c4 100755
--- a/msi/createmsi.py
+++ b/msi/createmsi.py
@@ -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'
trials = glob(redist_glob)
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.component_num = 0
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/scripts')
modules += self.get_more_modules()
- modulestr = ','.join(modules)
- python = shutil.which('python')
- cxfreeze = os.path.join(os.path.dirname(python), "Scripts", "cxfreeze")
- if not os.path.isfile(cxfreeze):
- print("ERROR: This script requires cx_freeze module")
+
+ pyinstaller = shutil.which('pyinstaller')
+ if not pyinstaller:
+ print("ERROR: This script requires pyinstaller.")
sys.exit(1)
- subprocess.check_call([python,
- cxfreeze,
- '--target-dir',
- main_stage,
- '--include-modules',
- modulestr,
- 'meson.py'])
+ pyinstaller_tmpdir = 'pyinst-tmp'
+ if os.path.exists(pyinstaller_tmpdir):
+ shutil.rmtree(pyinstaller_tmpdir)
+ pyinst_cmd = [pyinstaller,
+ '--clean',
+ '--distpath',
+ 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')):
sys.exit('Meson exe missing from staging dir.')
os.mkdir(ninja_stage)
@@ -288,7 +292,7 @@ class PackageGenerator:
if __name__ == '__main__':
if not os.path.exists('meson.py'):
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.build_dist()