From e66b07e6fb9e7264c23a4cda7f28c538e6229229 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Sat, 15 Apr 2023 23:46:13 -0400 Subject: fix data collection with pyinstaller pyinstaller considers .py files to not be data by default. The entire architecture of pyinstaller is, in fact, different from zipapp or unpacked modules -- because it actually has to use a resource loader with on-disk files *separate* from the module itself. So just because a file gets packaged in the application does not mean it's usable as an importlib.resources compatible resource. Although we collect data files in general, we need to make sure that .py files are collected from scripts, because we may try to run them standalone from an external process. Fixes #11689 --- packaging/hook-mesonbuild.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/hook-mesonbuild.py b/packaging/hook-mesonbuild.py index b076c506d..86e74639f 100644 --- a/packaging/hook-mesonbuild.py +++ b/packaging/hook-mesonbuild.py @@ -21,7 +21,7 @@ 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.scripts', include_py_files=True, excludes=['**/__pycache__']) datas += collect_data_files('mesonbuild.cmake.data') datas += collect_data_files('mesonbuild.dependencies.data') -- cgit v1.2.1