Skip to content

Commit c689e00

Browse files
committed
Set up environment vars if either 'ARM_PATH', 'GCC_ARM_PATH' or 'IAR_PATH' tool config variables are set
1 parent 1faf380 commit c689e00

File tree

2 files changed

+27
-16
lines changed

2 files changed

+27
-16
lines changed

mbed/mbed.py

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636

3737
# Application version
38-
ver = '0.7.11'
38+
ver = '0.7.13'
3939

4040
# Default paths to Mercurial and Git
4141
hg_cmd = 'hg'
@@ -1174,6 +1174,16 @@ def get_tools_dir(self):
11741174

11751175
return None
11761176

1177+
def get_env(self):
1178+
env = os.environ.copy()
1179+
env['PYTHONPATH'] = os.path.abspath(self.path)
1180+
compilers = ['ARM', 'GCC_ARM', 'IAR']
1181+
for c in compilers:
1182+
if self.get_cfg(c+'_PATH'):
1183+
env[c+'_PATH'] = self.get_cfg(c+'_PATH')
1184+
1185+
return env
1186+
11771187
# Routines after cloning mbed-os
11781188
def post_action(self):
11791189
mbed_tools_path = self.get_tools_dir()
@@ -1888,8 +1898,9 @@ def compile(toolchain=None, mcu=None, source=False, build=False, compile_library
18881898

18891899
with cd(program.path):
18901900
tools_dir = os.path.abspath(program.get_tools())
1891-
env = os.environ.copy()
1892-
env['PYTHONPATH'] = os.path.abspath(program.path)
1901+
1902+
# Prepare environment variables
1903+
env = program.get_env()
18931904

18941905
if not source or len(source) == 0:
18951906
source = [os.path.relpath(program.path, orig_path)]
@@ -1972,10 +1983,10 @@ def test_(toolchain=None, mcu=None, compile_list=False, run_list=False, compile_
19721983
tools_dir = program.get_tools()
19731984
build_and_run_tests = not compile_list and not run_list and not compile_only and not run_only
19741985
relative_orig_path = os.path.relpath(orig_path, program.path)
1975-
1976-
env = os.environ.copy()
1977-
env['PYTHONPATH'] = os.path.abspath(program.path)
1978-
1986+
1987+
# Prepare environment variables
1988+
env = program.get_env()
1989+
19791990
with cd(program.path):
19801991
# Setup the source path if not specified
19811992
if not source or len(source) == 0:
@@ -2043,8 +2054,9 @@ def export(ide=None, mcu=None, source=False, clean=False, supported=False):
20432054
# Change directories to the program root to use mbed OS tools
20442055
with cd(program.path):
20452056
tools_dir = program.get_tools()
2046-
env = os.environ.copy()
2047-
env['PYTHONPATH'] = os.path.abspath(program.path)
2057+
2058+
# Prepare environment variables
2059+
env = program.get_env()
20482060

20492061
if supported:
20502062
popen(['python', '-u', os.path.join(tools_dir, 'project.py')]
@@ -2082,13 +2094,12 @@ def detect():
20822094
with cd(program.path):
20832095
tools_dir = program.get_tools()
20842096

2085-
# Prepare environment variables
2086-
env = os.environ.copy()
2087-
env['PYTHONPATH'] = os.path.abspath(program.path)
2097+
# Prepare environment variables
2098+
env = program.get_env()
20882099

2089-
popen(['python', '-u', os.path.join(tools_dir, 'detect_targets.py')]
2090-
+ args,
2091-
env=env)
2100+
popen(['python', '-u', os.path.join(tools_dir, 'detect_targets.py')]
2101+
+ args,
2102+
env=env)
20922103

20932104

20942105
# Generic config command

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def read(fname):
1919
setup(
2020
name="mbed-cli",
2121
packages=["mbed"],
22-
version="0.7.11",
22+
version="0.7.13",
2323
url='http://github.com/ARMmbed/mbed-cli',
2424
author='ARM mbed',
2525
author_email='[email protected]',

0 commit comments

Comments
 (0)