@@ -1099,6 +1099,7 @@ class Program(object):
1099
1099
name = None
1100
1100
is_cwd = False
1101
1101
is_repo = False
1102
+ is_classic = False
1102
1103
1103
1104
def __init__ (self , path = None , print_warning = False ):
1104
1105
path = os .path .abspath (path or os .getcwd ())
@@ -1117,6 +1118,7 @@ def __init__(self, path=None, print_warning=False):
1117
1118
break
1118
1119
1119
1120
self .name = os .path .basename (self .path )
1121
+ self .is_classic = os .path .isfile (os .path .join (self .path , 'mbed.bld' ))
1120
1122
1121
1123
# is_cwd flag indicates that current dir is assumed to be root, not root repo
1122
1124
if self .is_cwd and print_warning :
@@ -1179,9 +1181,7 @@ def get_tools_dir(self):
1179
1181
def post_action (self ):
1180
1182
mbed_tools_path = self .get_tools_dir ()
1181
1183
1182
- if not mbed_tools_path :
1183
- if not os .path .exists (os .path .join (self .path , '.temp' )):
1184
- os .mkdir (os .path .join (self .path , '.temp' ))
1184
+ if not mbed_tools_path and self .is_classic :
1185
1185
self .add_tools (os .path .join (self .path , '.temp' ))
1186
1186
mbed_tools_path = self .get_tools_dir ()
1187
1187
@@ -1221,11 +1221,13 @@ def post_action(self):
1221
1221
"You can install all missing modules by running \" pip install -r %s\" in \" %s\" " % (', ' .join (missing ), fname , mbed_os_path ))
1222
1222
1223
1223
def add_tools (self , path ):
1224
+ if not os .path .exists (path ):
1225
+ os .mkdir (path )
1224
1226
with cd (path ):
1225
1227
tools_dir = 'tools'
1226
1228
if not os .path .exists (tools_dir ):
1227
1229
try :
1228
- action ("Couldn't find build tools in your program. Downloading the mbed SDK tools..." )
1230
+ action ("Couldn't find build tools in your program. Downloading the mbed 2.0 SDK tools..." )
1229
1231
repo = Repo .fromurl (mbed_sdk_tools_url )
1230
1232
repo .clone (mbed_sdk_tools_url , tools_dir )
1231
1233
except Exception :
0 commit comments