mirror of https://github.com/ArduPilot/ardupilot
waf: use the current python interpreter for sub-commands
This commit is contained in:
parent
36af9eecdf
commit
a4e50e1626
|
@ -54,7 +54,7 @@ class upload_fw(Task.Task):
|
||||||
def run(self):
|
def run(self):
|
||||||
upload_tools = self.env.get_flat('UPLOAD_TOOLS')
|
upload_tools = self.env.get_flat('UPLOAD_TOOLS')
|
||||||
src = self.inputs[0]
|
src = self.inputs[0]
|
||||||
return self.exec_command("python '{}/px_uploader.py' '{}'".format(upload_tools, src))
|
return self.exec_command("{} '{}/px_uploader.py' '{}'".format(self.env.get_flat('PYTHON'), upload_tools, src))
|
||||||
|
|
||||||
def exec_command(self, cmd, **kw):
|
def exec_command(self, cmd, **kw):
|
||||||
kw['stdout'] = sys.stdout
|
kw['stdout'] = sys.stdout
|
||||||
|
@ -93,7 +93,7 @@ class generate_bin(Task.Task):
|
||||||
|
|
||||||
class generate_apj(Task.Task):
|
class generate_apj(Task.Task):
|
||||||
color='CYAN'
|
color='CYAN'
|
||||||
run_str="python '${UPLOAD_TOOLS}/px_mkfw.py' --image '${SRC}' --prototype '${BUILDROOT}/apj.prototype' > '${TGT}'"
|
run_str="${PYTHON} '${UPLOAD_TOOLS}/px_mkfw.py' --image '${SRC}' --prototype '${BUILDROOT}/apj.prototype' > '${TGT}'"
|
||||||
always_run = True
|
always_run = True
|
||||||
def keyword(self):
|
def keyword(self):
|
||||||
return "Generating"
|
return "Generating"
|
||||||
|
@ -277,8 +277,9 @@ def configure(cfg):
|
||||||
hwdef_out = env.BUILDROOT
|
hwdef_out = env.BUILDROOT
|
||||||
if not os.path.exists(hwdef_out):
|
if not os.path.exists(hwdef_out):
|
||||||
os.mkdir(hwdef_out)
|
os.mkdir(hwdef_out)
|
||||||
|
python = sys.executable
|
||||||
try:
|
try:
|
||||||
cmd = "python '{0}' -D '{1}' '{2}' {3}".format(hwdef_script, hwdef_out, env.HWDEF, env.BOOTLOADER_OPTION)
|
cmd = "{0} '{1}' -D '{2}' '{3}' {4}".format(python, hwdef_script, hwdef_out, env.HWDEF, env.BOOTLOADER_OPTION)
|
||||||
ret = subprocess.call(cmd, shell=True)
|
ret = subprocess.call(cmd, shell=True)
|
||||||
except Exception:
|
except Exception:
|
||||||
cfg.fatal("Failed to process hwdef.dat")
|
cfg.fatal("Failed to process hwdef.dat")
|
||||||
|
@ -300,7 +301,8 @@ def build(bld):
|
||||||
bld(
|
bld(
|
||||||
# build hwdef.h and apj.prototype from hwdef.dat. This is needed after a waf clean
|
# build hwdef.h and apj.prototype from hwdef.dat. This is needed after a waf clean
|
||||||
source=bld.path.ant_glob(bld.env.HWDEF),
|
source=bld.path.ant_glob(bld.env.HWDEF),
|
||||||
rule="python '${AP_HAL_ROOT}/hwdef/scripts/chibios_hwdef.py' -D '${BUILDROOT}' '%s' %s" % (bld.env.HWDEF, bld.env.BOOTLOADER_OPTION),
|
rule="%s '${AP_HAL_ROOT}/hwdef/scripts/chibios_hwdef.py' -D '${BUILDROOT}' '%s' %s" % (
|
||||||
|
bld.env.get_flat('PYTHON'), bld.env.HWDEF, bld.env.BOOTLOADER_OPTION),
|
||||||
group='dynamic_sources',
|
group='dynamic_sources',
|
||||||
target=[bld.bldnode.find_or_declare('hwdef.h'),
|
target=[bld.bldnode.find_or_declare('hwdef.h'),
|
||||||
bld.bldnode.find_or_declare('apj.prototype'),
|
bld.bldnode.find_or_declare('apj.prototype'),
|
||||||
|
|
|
@ -8,8 +8,10 @@ import sys
|
||||||
d = p.dirname(p.realpath(__file__))
|
d = p.dirname(p.realpath(__file__))
|
||||||
waf_light = p.join(d, 'modules', 'waf', 'waf-light')
|
waf_light = p.join(d, 'modules', 'waf', 'waf-light')
|
||||||
|
|
||||||
|
python = sys.executable
|
||||||
|
|
||||||
try:
|
try:
|
||||||
subprocess.check_call(['python', waf_light] + sys.argv[1:])
|
subprocess.check_call([python, waf_light] + sys.argv[1:])
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
if e.returncode != 2 or p.isfile(waf_light):
|
if e.returncode != 2 or p.isfile(waf_light):
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
Loading…
Reference in New Issue