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
pull/13017/head
Eli Schwartz 12 months ago
parent c99fc40bb7
commit f9eef40982
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 7
      mesonbuild/utils/universal.py

@ -168,8 +168,11 @@ project_meson_versions: T.DefaultDict[str, str] = collections.defaultdict(str)
from glob import glob from glob import glob
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'): if getattr(sys, 'frozen', False):
# using a PyInstaller bundle, e.g. the MSI installed executable # 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'] python_command = [sys.executable, 'runpython']
else: else:
python_command = [sys.executable] python_command = [sys.executable]

Loading…
Cancel
Save