aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-11-11 01:53:23 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2017-11-20 23:08:17 +0200
commit5d51bc79c7555e681a0c638da9528458257744ae (patch)
tree9d8e24be05870144a8763a094a8b273fd657c262 /mesonbuild
parentb3dfb80c15cae24c66d07425bb7a327528438a55 (diff)
downloadmeson-5d51bc79c7555e681a0c638da9528458257744ae.zip
meson-5d51bc79c7555e681a0c638da9528458257744ae.tar.gz
meson-5d51bc79c7555e681a0c638da9528458257744ae.tar.bz2
Replaced sys.executable use with the mesonlib equivalent.
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/backend/ninjabackend.py4
-rw-r--r--mesonbuild/backend/vs2010backend.py9
-rw-r--r--mesonbuild/backend/xcodebackend.py2
-rw-r--r--mesonbuild/dependencies/base.py2
-rw-r--r--mesonbuild/environment.py12
-rw-r--r--mesonbuild/mesonmain.py2
-rw-r--r--mesonbuild/scripts/regen_checker.py14
7 files changed, 19 insertions, 26 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index c633daf..cea1b08 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -2524,7 +2524,7 @@ rule FORTRAN_DEP_HACK
gcno_elem = NinjaBuildElement(self.all_outputs, 'meson-clean-gcno', 'CUSTOM_COMMAND', 'PHONY')
script_root = self.environment.get_script_dir()
clean_script = os.path.join(script_root, 'delwithsuffix.py')
- gcno_elem.add_item('COMMAND', [sys.executable, clean_script, '.', 'gcno'])
+ gcno_elem.add_item('COMMAND', mesonlib.python_command + [clean_script, '.', 'gcno'])
gcno_elem.add_item('description', 'Deleting gcno files.')
gcno_elem.write(outfile)
# Alias that runs the target defined above
@@ -2533,7 +2533,7 @@ rule FORTRAN_DEP_HACK
gcda_elem = NinjaBuildElement(self.all_outputs, 'meson-clean-gcda', 'CUSTOM_COMMAND', 'PHONY')
script_root = self.environment.get_script_dir()
clean_script = os.path.join(script_root, 'delwithsuffix.py')
- gcda_elem.add_item('COMMAND', [sys.executable, clean_script, '.', 'gcda'])
+ gcda_elem.add_item('COMMAND', mesonlib.python_command + [clean_script, '.', 'gcda'])
gcda_elem.add_item('description', 'Deleting gcda files.')
gcda_elem.write(outfile)
# Alias that runs the target defined above
diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py
index e4e9696..efa4329 100644
--- a/mesonbuild/backend/vs2010backend.py
+++ b/mesonbuild/backend/vs2010backend.py
@@ -396,10 +396,11 @@ class Vs2010Backend(backends.Backend):
action = ET.SubElement(root, 'ItemDefinitionGroup')
customstep = ET.SubElement(action, 'PostBuildEvent')
cmd_raw = [target.command] + target.args
- cmd = [sys.executable, os.path.join(self.environment.get_script_dir(), 'commandrunner.py'),
- self.environment.get_build_dir(),
- self.environment.get_source_dir(),
- self.get_target_dir(target)] + self.environment.get_build_command()
+ cmd = mesonlib.python_command +
+ [os.path.join(self.environment.get_script_dir(), 'commandrunner.py'),
+ self.environment.get_build_dir(),
+ self.environment.get_source_dir(),
+ self.get_target_dir(target)] + self.environment.get_build_command()
for i in cmd_raw:
if isinstance(i, build.BuildTarget):
cmd.append(os.path.join(self.environment.get_build_dir(), self.get_target_filename(i)))
diff --git a/mesonbuild/backend/xcodebackend.py b/mesonbuild/backend/xcodebackend.py
index 199d7df..ea9be30 100644
--- a/mesonbuild/backend/xcodebackend.py
+++ b/mesonbuild/backend/xcodebackend.py
@@ -567,7 +567,7 @@ class XCodeBackend(backends.Backend):
self.write_line('shellPath = /bin/sh;')
script_root = self.environment.get_script_dir()
test_script = os.path.join(script_root, 'meson_test.py')
- cmd = [sys.executable, test_script, test_data, '--wd', self.environment.get_build_dir()]
+ cmd = mesonlib.python_command[test_script, test_data, '--wd', self.environment.get_build_dir()]
cmdstr = ' '.join(["'%s'" % i for i in cmd])
self.write_line('shellScript = "%s";' % cmdstr)
self.write_line('showEnvVarsInLog = 0;')
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
index fcc74b5..15b47bc 100644
--- a/mesonbuild/dependencies/base.py
+++ b/mesonbuild/dependencies/base.py
@@ -434,7 +434,7 @@ class ExternalProgram:
commands = commands[1:]
# Windows does not ship python3.exe, but we know the path to it
if len(commands) > 0 and commands[0] == 'python3':
- commands[0] = sys.executable
+ commands = mesonlib.python_command + commands[1:]
return commands + [script]
except Exception:
pass
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index d9146eb..9045007 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -325,14 +325,10 @@ class Environment:
return self.coredata
def get_build_command(self, unbuffered=False):
- # If running an executable created with cx_freeze,
- # Python might not be installed so don't prefix
- # the command with it.
- if sys.executable.endswith('meson.exe'):
- return [sys.executable]
- if unbuffered:
- [sys.executable, '-u', self.meson_script_launcher]
- return [sys.executable, self.meson_script_launcher]
+ cmd = mesonlib.meson_command[:]
+ if unbuffered and 'python' in cmd[0]:
+ cmd = [cmd[0],'-u'] + cmd[1:]
+ return cmd
def is_header(self, fname):
return is_header(fname)
diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py
index 0491322..342e98f 100644
--- a/mesonbuild/mesonmain.py
+++ b/mesonbuild/mesonmain.py
@@ -155,7 +155,7 @@ class MesonApp:
def _generate(self, env):
mlog.debug('Build started at', datetime.datetime.now().isoformat())
- mlog.debug('Python binary:', sys.executable)
+ mlog.debug('Main binary:', sys.executable)
mlog.debug('Python system:', platform.system())
mlog.log(mlog.bold('The Meson build system'))
self.check_pkgconfig_envvar(env)
diff --git a/mesonbuild/scripts/regen_checker.py b/mesonbuild/scripts/regen_checker.py
index 53c5428..e8fbd19 100644
--- a/mesonbuild/scripts/regen_checker.py
+++ b/mesonbuild/scripts/regen_checker.py
@@ -32,15 +32,11 @@ def need_regen(regeninfo, regen_timestamp):
return False
def regen(regeninfo, mesonscript, backend):
- if sys.executable.lower().endswith('meson.exe'):
- cmd_exe = [sys.executable]
- else:
- cmd_exe = [sys.executable, mesonscript]
- cmd = cmd_exe + ['--internal',
- 'regenerate',
- regeninfo.build_dir,
- regeninfo.source_dir,
- '--backend=' + backend]
+ cmd = mesonlib.meson_command + ['--internal',
+ 'regenerate',
+ regeninfo.build_dir,
+ regeninfo.source_dir,
+ '--backend=' + backend]
subprocess.check_call(cmd)
def run(args):