Skip to content

Commit 1bf1eaa

Browse files
committed
mbed-cli should use an explicit python version in subrsocess calls
This commit ensures that all calls to python are explicitly python2
1 parent 3e0fa29 commit 1bf1eaa

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

mbed/mbed.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ def fromrepo(cls, path=None):
916916

917917
repo.path = os.path.abspath(path)
918918
repo.name = os.path.basename(repo.path)
919-
919+
920920
cache_cfg = Global().get_cfg('CACHE', '')
921921
if cache_repositories and cache_cfg and cache_cfg != 'none' and cache_cfg != 'off' and cache_cfg != 'disabled':
922922
loc = cache_cfg if (cache_cfg and cache_cfg != 'on' and cache_cfg != 'enabled') else None
@@ -2175,7 +2175,7 @@ def compile_(toolchain=None, target=None, profile=False, compile_library=False,
21752175
source = [os.path.relpath(program.path, orig_path)]
21762176

21772177
if supported:
2178-
popen(['python', '-u', os.path.join(tools_dir, 'make.py')]
2178+
popen(['python2', '-u', os.path.join(tools_dir, 'make.py')]
21792179
+ (['-S'] if supported else []) + (['-v'] if very_verbose else [])
21802180
+ (['--app-config', app_config] if app_config else [])
21812181
+ args,
@@ -2188,7 +2188,7 @@ def compile_(toolchain=None, target=None, profile=False, compile_library=False,
21882188

21892189
if compile_config:
21902190
# Compile configuration
2191-
popen(['python', os.path.join(tools_dir, 'get_config.py')]
2191+
popen(['python2', os.path.join(tools_dir, 'get_config.py')]
21922192
+ ['-t', tchain, '-m', target]
21932193
+ list(chain.from_iterable(izip(repeat('--profile'), profile or [])))
21942194
+ list(chain.from_iterable(izip(repeat('--source'), source)))
@@ -2199,15 +2199,15 @@ def compile_(toolchain=None, target=None, profile=False, compile_library=False,
21992199
# If the user hasn't supplied a build directory, ignore the default build directory
22002200
if not build:
22012201
program.ignore_build_dir()
2202-
2202+
22032203
build_path = build
22042204

22052205
if compile_library:
22062206
# Compile as a library (current dir is default)
22072207
if not build_path:
22082208
build_path = os.path.join(os.path.relpath(program.path, orig_path), program.build_dir, 'libraries', os.path.basename(orig_path), target, tchain)
22092209

2210-
popen(['python', '-u', os.path.join(tools_dir, 'build.py')]
2210+
popen(['python2', '-u', os.path.join(tools_dir, 'build.py')]
22112211
+ list(chain.from_iterable(izip(repeat('-D'), macros)))
22122212
+ ['-t', tchain, '-m', target]
22132213
+ list(chain.from_iterable(izip(repeat('--profile'), profile or [])))
@@ -2223,7 +2223,7 @@ def compile_(toolchain=None, target=None, profile=False, compile_library=False,
22232223
if not build_path:
22242224
build_path = os.path.join(os.path.relpath(program.path, orig_path), program.build_dir, target, tchain)
22252225

2226-
popen(['python', '-u', os.path.join(tools_dir, 'make.py')]
2226+
popen(['python2', '-u', os.path.join(tools_dir, 'make.py')]
22272227
+ list(chain.from_iterable(izip(repeat('-D'), macros)))
22282228
+ ['-t', tchain, '-m', target]
22292229
+ list(chain.from_iterable(izip(repeat('--profile'), profile or [])))
@@ -2292,7 +2292,7 @@ def test_(toolchain=None, target=None, compile_list=False, run_list=False, compi
22922292
test_spec = os.path.join(build_path, 'test_spec.json')
22932293

22942294
if compile_list:
2295-
popen(['python', '-u', os.path.join(tools_dir, 'test.py'), '--list']
2295+
popen(['python2', '-u', os.path.join(tools_dir, 'test.py'), '--list']
22962296
+ list(chain.from_iterable(izip(repeat('--profile'), profile or [])))
22972297
+ ['-t', tchain, '-m', target]
22982298
+ list(chain.from_iterable(izip(repeat('--source'), source)))
@@ -2307,7 +2307,7 @@ def test_(toolchain=None, target=None, compile_list=False, run_list=False, compi
23072307
if not build:
23082308
program.ignore_build_dir()
23092309

2310-
popen(['python', '-u', os.path.join(tools_dir, 'test.py')]
2310+
popen(['python2', '-u', os.path.join(tools_dir, 'test.py')]
23112311
+ list(chain.from_iterable(izip(repeat('-D'), macros)))
23122312
+ list(chain.from_iterable(izip(repeat('--profile'), profile or [])))
23132313
+ ['-t', tchain, '-m', target]
@@ -2364,7 +2364,7 @@ def export(ide=None, target=None, source=False, clean=False, supported=False):
23642364
env = program.get_env()
23652365

23662366
if supported:
2367-
popen(['python', '-u', os.path.join(tools_dir, 'project.py')]
2367+
popen(['python2', '-u', os.path.join(tools_dir, 'project.py')]
23682368
+ (['-S'] if supported else []) + (['-v'] if very_verbose else []),
23692369
env=env)
23702370
return
@@ -2377,10 +2377,10 @@ def export(ide=None, target=None, source=False, clean=False, supported=False):
23772377

23782378
if not source or len(source) == 0:
23792379
source = [os.path.relpath(program.path, orig_path)]
2380-
2380+
23812381
program.ignore_build_dir()
23822382

2383-
popen(['python', '-u', os.path.join(tools_dir, 'project.py')]
2383+
popen(['python2', '-u', os.path.join(tools_dir, 'project.py')]
23842384
+ list(chain.from_iterable(izip(repeat('-D'), macros)))
23852385
+ ['-i', ide.lower()]
23862386
+ ['-m', target]
@@ -2412,7 +2412,7 @@ def detect():
24122412
# Prepare environment variables
24132413
env = program.get_env()
24142414

2415-
popen(['python', '-u', os.path.join(tools_dir, 'detect_targets.py')]
2415+
popen(['python2', '-u', os.path.join(tools_dir, 'detect_targets.py')]
24162416
+ args,
24172417
env=env)
24182418
else:

0 commit comments

Comments
 (0)