aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2023-04-16 00:00:55 -0400
committerJussi Pakkanen <jpakkane@gmail.com>2023-04-17 11:36:55 +0300
commitc39ee881a1959ae37aded8e0c24cec23b2bd6a90 (patch)
tree52fd0200239a66503eb1e010c49d65efca9d515a
parente66b07e6fb9e7264c23a4cda7f28c538e6229229 (diff)
downloadmeson-c39ee881a1959ae37aded8e0c24cec23b2bd6a90.zip
meson-c39ee881a1959ae37aded8e0c24cec23b2bd6a90.tar.gz
meson-c39ee881a1959ae37aded8e0c24cec23b2bd6a90.tar.bz2
select the correct python_command for pyinstaller builds, even on not-Windows
Checking the executable basename sort of works, at least for Windows, since Windows always happens to use exactly this approach. However, the official pyinstaller documentation suggests a very different approach: https://pyinstaller.org/en/stable/runtime-information.html This approach is more robust since it works on any OS, and in particular it allows me to test the PyInstaller bundle functionality on Linux, even though we don't officially distribute it as such.
-rw-r--r--mesonbuild/utils/universal.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/mesonbuild/utils/universal.py b/mesonbuild/utils/universal.py
index 8c35803..fc217c8 100644
--- a/mesonbuild/utils/universal.py
+++ b/mesonbuild/utils/universal.py
@@ -176,8 +176,8 @@ project_meson_versions = collections.defaultdict(str) # type: T.DefaultDict[str
from glob import glob
-if os.path.basename(sys.executable) == 'meson.exe':
- # In Windows and using the MSI installed executable.
+if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
+ # using a PyInstaller bundle, e.g. the MSI installed executable
python_command = [sys.executable, 'runpython']
else:
python_command = [sys.executable]