[Mesa-dev] [PATCH 45/48] meson: allow python2 to be installed as python

Dylan Baker dylan at pnwbakers.com
Mon Jun 11 22:56:12 UTC 2018


On mac and Windows it may not be installed as python2, so search for
python as well. Also check that what we find actually is python2
---
 meson.build | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index e1b3afbe688..6fd02dd4c6c 100644
--- a/meson.build
+++ b/meson.build
@@ -684,7 +684,22 @@ if with_platform_haiku
   pre_args += '-DHAVE_HAIKU_PLATFORM'
 endif
 
-prog_python2 = find_program('python2')
+if system_has_kms_drm
+  prog_python2 = find_program('python2')
+else
+  # Other OSes (windows and macos) often don't have a python2 binary, MacOS
+  # installs python2 as python, and doesn't provide python3 (thought it can be
+  # installed), and Windows provides neither, and the official packages provide
+  # python.exe for both python 2.x and 3.x.
+  #
+  # Check for both (in case someone has fixed their paths) and assert that the
+  # version is 2.7
+  prog_python2 = find_program('python2', 'python')
+  _py = run_command(prog_python2, ['--version'])
+  if not _py.stderr().contains('2.7')
+    error('Python version is not 2.7.x! Actual: ' + _py.stderr())
+  endif
+endif
 has_mako = run_command(prog_python2, '-c', 'import mako')
 if has_mako.returncode() != 0
   error('Python (2.x) mako module required to build mesa.')
-- 
2.17.1



More information about the mesa-dev mailing list