1
- #!/usr/bin/env python
1
+ #!/usr/bin/env python2
2
2
3
3
# Copyright (c) 2016 ARM Limited, All Rights Reserved
4
4
# SPDX-License-Identifier: Apache-2.0
42
42
# Default paths to Mercurial and Git
43
43
hg_cmd = 'hg'
44
44
git_cmd = 'git'
45
+ python_cmd = sys .executable
45
46
46
47
ignores = [
47
48
# Version control folders
@@ -916,7 +917,7 @@ def fromrepo(cls, path=None):
916
917
917
918
repo .path = os .path .abspath (path )
918
919
repo .name = os .path .basename (repo .path )
919
-
920
+
920
921
cache_cfg = Global ().get_cfg ('CACHE' , '' )
921
922
if cache_repositories and cache_cfg and cache_cfg != 'none' and cache_cfg != 'off' and cache_cfg != 'disabled' :
922
923
loc = cache_cfg if (cache_cfg and cache_cfg != 'on' and cache_cfg != 'enabled' ) else None
@@ -2175,7 +2176,7 @@ def compile_(toolchain=None, target=None, profile=False, compile_library=False,
2175
2176
source = [os .path .relpath (program .path , orig_path )]
2176
2177
2177
2178
if supported :
2178
- popen (['python' , '-u' , os .path .join (tools_dir , 'make.py' )]
2179
+ popen ([python_cmd , '-u' , os .path .join (tools_dir , 'make.py' )]
2179
2180
+ (['-S' ] if supported else []) + (['-v' ] if very_verbose else [])
2180
2181
+ (['--app-config' , app_config ] if app_config else [])
2181
2182
+ args ,
@@ -2188,7 +2189,7 @@ def compile_(toolchain=None, target=None, profile=False, compile_library=False,
2188
2189
2189
2190
if compile_config :
2190
2191
# Compile configuration
2191
- popen (['python' , os .path .join (tools_dir , 'get_config.py' )]
2192
+ popen ([python_cmd , os .path .join (tools_dir , 'get_config.py' )]
2192
2193
+ ['-t' , tchain , '-m' , target ]
2193
2194
+ list (chain .from_iterable (izip (repeat ('--profile' ), profile or [])))
2194
2195
+ list (chain .from_iterable (izip (repeat ('--source' ), source )))
@@ -2199,15 +2200,15 @@ def compile_(toolchain=None, target=None, profile=False, compile_library=False,
2199
2200
# If the user hasn't supplied a build directory, ignore the default build directory
2200
2201
if not build :
2201
2202
program .ignore_build_dir ()
2202
-
2203
+
2203
2204
build_path = build
2204
2205
2205
2206
if compile_library :
2206
2207
# Compile as a library (current dir is default)
2207
2208
if not build_path :
2208
2209
build_path = os .path .join (os .path .relpath (program .path , orig_path ), program .build_dir , 'libraries' , os .path .basename (orig_path ), target , tchain )
2209
2210
2210
- popen (['python' , '-u' , os .path .join (tools_dir , 'build.py' )]
2211
+ popen ([python_cmd , '-u' , os .path .join (tools_dir , 'build.py' )]
2211
2212
+ list (chain .from_iterable (izip (repeat ('-D' ), macros )))
2212
2213
+ ['-t' , tchain , '-m' , target ]
2213
2214
+ list (chain .from_iterable (izip (repeat ('--profile' ), profile or [])))
@@ -2223,7 +2224,7 @@ def compile_(toolchain=None, target=None, profile=False, compile_library=False,
2223
2224
if not build_path :
2224
2225
build_path = os .path .join (os .path .relpath (program .path , orig_path ), program .build_dir , target , tchain )
2225
2226
2226
- popen (['python' , '-u' , os .path .join (tools_dir , 'make.py' )]
2227
+ popen ([python_cmd , '-u' , os .path .join (tools_dir , 'make.py' )]
2227
2228
+ list (chain .from_iterable (izip (repeat ('-D' ), macros )))
2228
2229
+ ['-t' , tchain , '-m' , target ]
2229
2230
+ list (chain .from_iterable (izip (repeat ('--profile' ), profile or [])))
@@ -2292,7 +2293,7 @@ def test_(toolchain=None, target=None, compile_list=False, run_list=False, compi
2292
2293
test_spec = os .path .join (build_path , 'test_spec.json' )
2293
2294
2294
2295
if compile_list :
2295
- popen (['python' , '-u' , os .path .join (tools_dir , 'test.py' ), '--list' ]
2296
+ popen ([python_cmd , '-u' , os .path .join (tools_dir , 'test.py' ), '--list' ]
2296
2297
+ list (chain .from_iterable (izip (repeat ('--profile' ), profile or [])))
2297
2298
+ ['-t' , tchain , '-m' , target ]
2298
2299
+ list (chain .from_iterable (izip (repeat ('--source' ), source )))
@@ -2307,7 +2308,7 @@ def test_(toolchain=None, target=None, compile_list=False, run_list=False, compi
2307
2308
if not build :
2308
2309
program .ignore_build_dir ()
2309
2310
2310
- popen (['python' , '-u' , os .path .join (tools_dir , 'test.py' )]
2311
+ popen ([python_cmd , '-u' , os .path .join (tools_dir , 'test.py' )]
2311
2312
+ list (chain .from_iterable (izip (repeat ('-D' ), macros )))
2312
2313
+ list (chain .from_iterable (izip (repeat ('--profile' ), profile or [])))
2313
2314
+ ['-t' , tchain , '-m' , target ]
@@ -2364,7 +2365,7 @@ def export(ide=None, target=None, source=False, clean=False, supported=False):
2364
2365
env = program .get_env ()
2365
2366
2366
2367
if supported :
2367
- popen (['python' , '-u' , os .path .join (tools_dir , 'project.py' )]
2368
+ popen ([python_cmd , '-u' , os .path .join (tools_dir , 'project.py' )]
2368
2369
+ (['-S' ] if supported else []) + (['-v' ] if very_verbose else []),
2369
2370
env = env )
2370
2371
return
@@ -2377,10 +2378,10 @@ def export(ide=None, target=None, source=False, clean=False, supported=False):
2377
2378
2378
2379
if not source or len (source ) == 0 :
2379
2380
source = [os .path .relpath (program .path , orig_path )]
2380
-
2381
+
2381
2382
program .ignore_build_dir ()
2382
2383
2383
- popen (['python' , '-u' , os .path .join (tools_dir , 'project.py' )]
2384
+ popen ([python_cmd , '-u' , os .path .join (tools_dir , 'project.py' )]
2384
2385
+ list (chain .from_iterable (izip (repeat ('-D' ), macros )))
2385
2386
+ ['-i' , ide .lower ()]
2386
2387
+ ['-m' , target ]
@@ -2412,7 +2413,7 @@ def detect():
2412
2413
# Prepare environment variables
2413
2414
env = program .get_env ()
2414
2415
2415
- popen (['python' , '-u' , os .path .join (tools_dir , 'detect_targets.py' )]
2416
+ popen ([python_cmd , '-u' , os .path .join (tools_dir , 'detect_targets.py' )]
2416
2417
+ args ,
2417
2418
env = env )
2418
2419
else :
0 commit comments