Skip to content

Commit

Permalink
allow any alternative python freeze tool to work with meson
Browse files Browse the repository at this point in the history
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 #13007
  • Loading branch information
eli-schwartz committed Mar 27, 2024
1 parent 58c768a commit 1465c76
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions mesonbuild/utils/universal.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,11 @@ class _VerPickleLoadable(Protocol):

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]
Expand Down

0 comments on commit 1465c76

Please sign in to comment.