@@ -1618,7 +1618,7 @@ def requirements_contains(self, library_name):
1618
1618
with open (os .path .join (req_path , req_file ), 'r' ) as f :
1619
1619
return library_name in f .read ()
1620
1620
1621
- def check_requirements (self , show_warning_only = False ):
1621
+ def check_requirements (self , require_install = False ):
1622
1622
skip_requirements = self .get_cfg ("NO_REQUIREMENTS" , False )
1623
1623
if skip_requirements :
1624
1624
action ("Skipping installed requirements check due to configuration flag." )
@@ -1641,7 +1641,7 @@ def check_requirements(self, show_warning_only=False):
1641
1641
if not pkg in installed_packages :
1642
1642
missing .append (pkg )
1643
1643
1644
- if missing and install_requirements and not show_warning_only :
1644
+ if missing and install_requirements and require_install :
1645
1645
try :
1646
1646
action ("Auto-installing missing Python modules (%s)..." % ', ' .join (missing ))
1647
1647
pquery ([python_cmd , '-m' , 'pip' , 'install' , '-q' , '-r' , os .path .join (req_path , req_file )])
@@ -1661,10 +1661,10 @@ def check_requirements(self, show_warning_only=False):
1661
1661
elif os .name == 'posix' :
1662
1662
msg += "\n On Posix systems (Linux, etc) you might have to switch to superuser account or use \" sudo\" "
1663
1663
1664
- if show_warning_only :
1665
- warning (msg )
1666
- else :
1664
+ if require_install :
1667
1665
error (msg , 1 )
1666
+ else :
1667
+ warning (msg )
1668
1668
1669
1669
return True
1670
1670
@@ -1686,7 +1686,7 @@ def post_action(self, check_reqs=True):
1686
1686
shutil .copy (os .path .join (mbed_tools_path , 'default_settings.py' ), os .path .join (self .path , 'mbed_settings.py' ))
1687
1687
1688
1688
if check_reqs :
1689
- self .check_requirements ()
1689
+ self .check_requirements (True )
1690
1690
1691
1691
def add_tools (self , path ):
1692
1692
if not os .path .exists (path ):
@@ -2637,7 +2637,7 @@ def compile_(toolchain=None, target=None, profile=False, compile_library=False,
2637
2637
args = remainder
2638
2638
# Find the root of the program
2639
2639
program = Program (getcwd (), True )
2640
- program .check_requirements (True )
2640
+ program .check_requirements ()
2641
2641
# Remember the original path. this is needed for compiling only the libraries and tests for the current folder.
2642
2642
orig_path = getcwd ()
2643
2643
orig_target = target
@@ -2799,7 +2799,7 @@ def test_(toolchain=None, target=None, compile_list=False, run_list=False,
2799
2799
args = remainder
2800
2800
# Find the root of the program
2801
2801
program = Program (getcwd (), True )
2802
- program .check_requirements (True )
2802
+ program .check_requirements ()
2803
2803
# Check if current Mbed OS support icetea
2804
2804
icetea_supported = program .requirements_contains ('icetea' )
2805
2805
@@ -2982,7 +2982,7 @@ def test_(toolchain=None, target=None, compile_list=False, run_list=False,
2982
2982
def dev_mgmt (toolchain = None , target = None , source = False , profile = False , build = False ):
2983
2983
orig_path = getcwd ()
2984
2984
program = Program (getcwd (), True )
2985
- program .check_requirements ()
2985
+ program .check_requirements (True )
2986
2986
with cd (program .path ):
2987
2987
tools_dir = program .get_tools ()
2988
2988
@@ -3039,7 +3039,7 @@ def export(ide=None, target=None, source=False, profile=["debug"], clean=False,
3039
3039
# Find the root of the program
3040
3040
program = Program (getcwd (), True )
3041
3041
if not no_requirements :
3042
- program .check_requirements (True )
3042
+ program .check_requirements ()
3043
3043
# Remember the original path. this is needed for compiling only the libraries and tests for the current folder.
3044
3044
orig_path = getcwd ()
3045
3045
orig_target = target
@@ -3093,7 +3093,7 @@ def detect():
3093
3093
args = remainder
3094
3094
# Find the root of the program
3095
3095
program = Program (getcwd (), False )
3096
- program .check_requirements (True )
3096
+ program .check_requirements ()
3097
3097
# Change directories to the program root to use mbed OS tools
3098
3098
with cd (program .path ):
3099
3099
tools_dir = program .get_tools_dir ()
0 commit comments