mirror of https://github.com/ARMmbed/mbed-os.git
Fix up subprocess calls
subprocess.call() does not by default return a status value. Update the commands to add shell=True which forces a return value. Also convert the commands to a single string rather than a list as this plays more nicely with both linux and windows. Also fix a spurious :pull/8605/head
parent
a7c777d5c1
commit
b28d0811df
|
@ -168,8 +168,10 @@ def source_repos(config, examples):
|
||||||
if os.path.exists(name):
|
if os.path.exists(name):
|
||||||
print("'%s' example directory already exists. Deleting..." % name)
|
print("'%s' example directory already exists. Deleting..." % name)
|
||||||
rmtree(name)
|
rmtree(name)
|
||||||
|
|
||||||
|
cmd = "mbed-cli import %s" %repo_info['repo']
|
||||||
|
result = subprocess.call(cmd, shell=True)
|
||||||
|
|
||||||
result = subprocess.call(["mbed-cli", "import", repo_info['repo']])
|
|
||||||
if result:
|
if result:
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -191,8 +193,9 @@ def clone_repos(config, examples , retry = 3):
|
||||||
if os.path.exists(name):
|
if os.path.exists(name):
|
||||||
print("'%s' example directory already exists. Deleting..." % name)
|
print("'%s' example directory already exists. Deleting..." % name)
|
||||||
rmtree(name)
|
rmtree(name)
|
||||||
|
cmd = "%s clone %s" %(repo_info['type'], repo_info['repo'])
|
||||||
for i in range(0, retry):
|
for i in range(0, retry):
|
||||||
if subprocess.call([repo_info['type'], "clone", repo_info['repo']]) == 0:
|
if not subprocess.call(cmd, shell=True):
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
print("ERROR : unable to clone the repo {}".format(name))
|
print("ERROR : unable to clone the repo {}".format(name))
|
||||||
|
@ -213,7 +216,7 @@ def deploy_repos(config, examples):
|
||||||
if name in examples:
|
if name in examples:
|
||||||
if os.path.exists(name):
|
if os.path.exists(name):
|
||||||
os.chdir(name)
|
os.chdir(name)
|
||||||
result = subprocess.call(["mbed-cli", "deploy"])
|
result = subprocess.call("mbed-cli deploy", shell=True)
|
||||||
os.chdir("..")
|
os.chdir("..")
|
||||||
if result:
|
if result:
|
||||||
print("mbed-cli deploy command failed for '%s'" % name)
|
print("mbed-cli deploy command failed for '%s'" % name)
|
||||||
|
@ -415,10 +418,11 @@ def update_mbedos_version(config, tag, examples):
|
||||||
update_dir = basename(repo_info['repo']) + "/mbed-os"
|
update_dir = basename(repo_info['repo']) + "/mbed-os"
|
||||||
print("\nChanging dir to %s\n" % update_dir)
|
print("\nChanging dir to %s\n" % update_dir)
|
||||||
os.chdir(update_dir)
|
os.chdir(update_dir)
|
||||||
result = subprocess.call(["mbed-cli", "update", tag, "--clean"])
|
cmd = "mbed-cli update %s --clean" %tag
|
||||||
|
result = subprocess.call(cmd, shell=True)
|
||||||
os.chdir("../..")
|
os.chdir("../..")
|
||||||
if result:
|
if result:
|
||||||
return result:
|
return result
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
Loading…
Reference in New Issue