packaging: make sure pyinstaller sees our distributed data files

Running pyinstaller to create a bundle, and using the resulting
`pyinst-tmp/meson/meson setup ...` with the cmake module revealed that
no data files were being bundled, unlike what we did for setup.cfg. Fix
this oversight.

Fixes #10163
pull/10255/head
Eli Schwartz 2 years ago committed by Jussi Pakkanen
parent e5aa47d8af
commit 7ceec99c55
  1. 7
      packaging/hook-mesonbuild.py
  2. 1
      setup.cfg

@ -7,6 +7,9 @@ PyInstaller hook to make mesonbuild include everything it needs to.
import os
from glob import glob
from PyInstaller.utils.hooks import collect_data_files
datas = []
hiddenimports = []
def get_all_modules_from_dir(dirname):
@ -18,6 +21,10 @@ def get_all_modules_from_dir(dirname):
modules = ['mesonbuild.' + modname + '.' + x for x in modules if not x.startswith('_')]
return modules
datas += collect_data_files('mesonbuild.scripts')
datas += collect_data_files('mesonbuild.cmake.data')
datas += collect_data_files('mesonbuild.dependencies.data')
hiddenimports += get_all_modules_from_dir('mesonbuild/modules')
hiddenimports += get_all_modules_from_dir('mesonbuild/scripts')

@ -47,6 +47,7 @@ typing =
mypy
typing_extensions; python_version <"3.8"
# this must be synced with packaging/hook-mesonbuild.py
[options.package_data]
mesonbuild.scripts = cmd_or_ps.ps1
mesonbuild.cmake.data = *

Loading…
Cancel
Save