summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz93@gmail.com>2024-03-26 21:26:31 -0400
committerEli Schwartz <eschwartz93@gmail.com>2024-04-15 17:54:27 -0400
commitf9eef40982ba2715aa4ca1d925aca423646c48f3 (patch)
tree01a9fe345f5b9bbce9954a7ab38d3046655d390b
parentc99fc40bb7bacfed4ea79b4b83bec46fdc5018f3 (diff)
downloadmeson-f9eef40982ba2715aa4ca1d925aca423646c48f3.tar.gz
allow any alternative python freeze tool to work with meson
Any code that needs to know mesonlib.python_command currently assumes the PyInstaller bundle reference is added to the sys module, which means that it assumes the only freeze tool used is PyInstaller. Really, all we need to check is sys.frozen as it's never normally set, but always set for a freeze. We don't care if it was PyInstaller specifically, and we don't need its bundle directory. See https://github.com/mesonbuild/meson/discussions/13007
-rw-r--r--mesonbuild/utils/universal.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/mesonbuild/utils/universal.py b/mesonbuild/utils/universal.py
index 324fb94b0..ce9afd96b 100644
--- a/mesonbuild/utils/universal.py
+++ b/mesonbuild/utils/universal.py
@@ -168,8 +168,11 @@ project_meson_versions: T.DefaultDict[str, str] = collections.defaultdict(str)
from glob import glob
-if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
- # using a PyInstaller bundle, e.g. the MSI installed executable
+if getattr(sys, 'frozen', False):
+ # Using e.g. a PyInstaller bundle, such as the MSI installed executable.
+ # It is conventional for freeze programs to set this attribute to indicate
+ # that the program is self hosted, and for example there is no associated
+ # "python" executable.
python_command = [sys.executable, 'runpython']
else:
python_command = [sys.executable]