buildtools/wafsamba: Ensure we detect the correct python.
authorNoel Power <noel.power@suse.com>
Thu, 29 Nov 2018 15:12:10 +0000 (15:12 +0000)
committerNoel Power <npower@samba.org>
Mon, 10 Dec 2018 09:38:25 +0000 (10:38 +0100)
In order to support a default python3 build we need to ensure
we detect python3 if no PYTHON env variable is set up.

Currently we detect python with

conf.find_program('python', var='PYTHON', mandatory=mandatory)

which uses PYTHON as as hint and falls back to the program name
'python' otherwise

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
buildtools/wafsamba/samba_python.py

index bca863bea8709cf9b3a34af5fa5daed46349b2fd..7879a1abd8672d46fbba56632ba70f461ba5604a 100644 (file)
@@ -1,6 +1,6 @@
 # waf build tool for building IDL files with pidl
 
-import os
+import os, sys
 from waflib import Build, Logs, Utils, Configure, Errors
 from waflib.Configure import conf
 
@@ -28,6 +28,8 @@ def SAMBA_CHECK_PYTHON(conf, mandatory=True, version=(2,4,2)):
         interpreters.append(conf.env['PYTHON'])
         conf.setenv('default')
 
+    if not os.getenv('PYTHON', None):
+        conf.env['PYTHON'] = sys.executable
     conf.find_program('python', var='PYTHON', mandatory=mandatory)
     conf.load('python')
     path_python = conf.find_program('python')