From 37183898698ad289dbc3a12704f76106f43231d3 Mon Sep 17 00:00:00 2001 From: Adirio Date: Fri, 3 Mar 2017 10:08:20 +0100 Subject: [PATCH 1/5] Single subprocess import call needed to be renamed to spcall as there is already another call function --- hello-world.py | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/hello-world.py b/hello-world.py index c4c6e52..0a316ce 100644 --- a/hello-world.py +++ b/hello-world.py @@ -1,6 +1,4 @@ -import subprocess -from subprocess import Popen -from subprocess import PIPE +from subprocess import call as spcall, Popen, PIPE import sys import shlex import time @@ -48,9 +46,9 @@ def call(cmd): """"""""""""""""" Main program starts here """"""""""""""""" system = platform.system() if ( system == "Windows"): - statementStatus = subprocess.call("cls", shell=True) + statementStatus = spcall("cls", shell=True) else: - statementStatus = subprocess.call("reset", shell=True) + statementStatus = spcall("reset", shell=True) import os hostname = os.uname()[1] @@ -74,19 +72,19 @@ def call(cmd): choice = raw_input("$") if choice == "1" : dropbox=True - statementStatus = subprocess.call("killall -q dropbox", shell=True) - statementStatus = subprocess.call("./.dropbox-dist/dropboxd&", shell=True) + statementStatus = spcall("killall -q dropbox", shell=True) + statementStatus = spcall("./.dropbox-dist/dropboxd&", shell=True) print("Dropbox daemon started") print("") raw_input("Press Enter to continue...") - statementStatus = subprocess.call("reset", shell=True) + statementStatus = spcall("reset", shell=True) elif choice == "2" : print("Okay, we won't start the dropbox daemon.") print("We'll put your work in /predix/dropbox in case you change your mind.") print("To launch the Dropbox daemon enter: ./predix/.dropbox-dist/dropboxd") print("") raw_input("Press Enter to continue...") - statementStatus = subprocess.call("reset", shell=True) + statementStatus = spcall("reset", shell=True) else : system.exit("Sorry, I did not understand. To restart the script enter: python " + turorialFile + ".py ") elif choice == "2" : @@ -94,7 +92,7 @@ def call(cmd): print("To launch the Dropbox daemon enter: ./predix/.dropbox-dist/dropboxd") print("") raw_input("Press Enter to continue...") - statementStatus = subprocess.call("reset", shell=True) + statementStatus = spcall("reset", shell=True) else : system.exit("Sorry, I did not understand. To restart the script enter: python " + turorialFile + ".py ") @@ -153,11 +151,11 @@ def call(cmd): if not "Predix" in result : print("installing the Predix plugin for the Cloud Foundry cli") if system == "Windows" : - statementStatus = subprocess.call("cf install-plugin https://github.com/PredixDev/cf-predix/releases/download/1.0.0/predix_win64.exe", shell=True) + statementStatus = spcall("cf install-plugin https://github.com/PredixDev/cf-predix/releases/download/1.0.0/predix_win64.exe", shell=True) elif system == "Darwin" : - statementStatus = subprocess.call("cf install-plugin https://github.com/PredixDev/cf-predix/releases/download/1.0.0/predix_osx", shell=True) + statementStatus = spcall("cf install-plugin https://github.com/PredixDev/cf-predix/releases/download/1.0.0/predix_osx", shell=True) elif system == "Linux" : - statementStatus = subprocess.call("cf install-plugin https://github.com/PredixDev/cf-predix/releases/download/1.0.0/predix_linux64", shell=True) + statementStatus = spcall("cf install-plugin https://github.com/PredixDev/cf-predix/releases/download/1.0.0/predix_linux64", shell=True) else : system.exit("sorry, I did not understand") print("Success, you have the Predix CLI") @@ -169,7 +167,7 @@ def call(cmd): result, err, exitcode=call('cf target') if "Not logged in" in result: print("Let's log in to Cloud Foundry") - statementStatus = subprocess.call("cf predix", shell=True) + statementStatus = spcall("cf predix", shell=True) if statementStatus == 1 : print("Error logging in to CF") print("") @@ -186,17 +184,17 @@ def call(cmd): if system == "Windows" : if os.path.exists(gitRepo): os.system("rmdir /S /Q " + gitRepo) - statementStatus = subprocess.call('git clone https://github.com/PredixDev/' + gitRepo + '.git', shell=True) + statementStatus = spcall('git clone https://github.com/PredixDev/' + gitRepo + '.git', shell=True) elif system == "Darwin" : if os.path.exists(gitRepo): - statementStatus = subprocess.call("rm -rf " + gitRepo) - statementStatus = subprocess.call('git clone https://github.com/PredixDev/' + gitRepo + '.git', shell=True) + statementStatus = spcall("rm -rf " + gitRepo) + statementStatus = spcall('git clone https://github.com/PredixDev/' + gitRepo + '.git', shell=True) else: print('For linux we assume you are on a DevBox and will place the app in /predix/Dropbox') if os.path.exists("/predix/Dropbox/" + gitRepo): - statementStatus = subprocess.call("rm -rf /predix/Dropbox/" + gitRepo, shell=True) - statementStatus = subprocess.call('cd /predix/Dropbox; git clone https://github.com/PredixDev/' + gitRepo + '.git', shell=True) - result = subprocess.call('rm -rf ' + gitRepo,shell=True) + statementStatus = spcall("rm -rf /predix/Dropbox/" + gitRepo, shell=True) + statementStatus = spcall('cd /predix/Dropbox; git clone https://github.com/PredixDev/' + gitRepo + '.git', shell=True) + result = spcall('rm -rf ' + gitRepo,shell=True) # print("result="+result + " err="+err+"enderr", "exitcode=") # print(exitcode) if statementStatus == 1 : @@ -209,11 +207,11 @@ def call(cmd): print("e.g. enter: cf push ") choice = raw_input("$") if system == "Windows" : - statementStatus = subprocess.call("cd " + gitRepo + " & " + choice, shell=True) + statementStatus = spcall("cd " + gitRepo + " & " + choice, shell=True) elif system == "Darwin" : - statementStatus = subprocess.call("cd " + gitRepo + ";" + choice, shell=True) + statementStatus = spcall("cd " + gitRepo + ";" + choice, shell=True) else: - statementStatus = subprocess.call("cd /predix/Dropbox/" + gitRepo + ";" + choice, shell=True) + statementStatus = spcall("cd /predix/Dropbox/" + gitRepo + ";" + choice, shell=True) # print("result="+result + " err="+err+"enderr", "exitcode=") # print(exitcode) if statementStatus == 1 : From 6febf4f7cc328b330df93c6500d5685ef830ddd3 Mon Sep 17 00:00:00 2001 From: Adirio Date: Fri, 3 Mar 2017 10:09:55 +0100 Subject: [PATCH 2/5] Fix: str system was being used as module sys --- hello-world.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hello-world.py b/hello-world.py index 0a316ce..b81346e 100644 --- a/hello-world.py +++ b/hello-world.py @@ -86,7 +86,7 @@ def call(cmd): raw_input("Press Enter to continue...") statementStatus = spcall("reset", shell=True) else : - system.exit("Sorry, I did not understand. To restart the script enter: python " + turorialFile + ".py ") + sys.exit("Sorry, I did not understand. To restart the script enter: python " + turorialFile + ".py ") elif choice == "2" : print("Okay, we'll put your work in /predix/dropbox in case you change your mind.") print("To launch the Dropbox daemon enter: ./predix/.dropbox-dist/dropboxd") @@ -94,7 +94,7 @@ def call(cmd): raw_input("Press Enter to continue...") statementStatus = spcall("reset", shell=True) else : - system.exit("Sorry, I did not understand. To restart the script enter: python " + turorialFile + ".py ") + sys.exit("Sorry, I did not understand. To restart the script enter: python " + turorialFile + ".py ") print ("$ Welcome to Predix") print ("$ Would you to like me to walk you through " + tutorialName + "?") @@ -109,7 +109,7 @@ def call(cmd): print("") sys.exit() else : - system.exit("Sorry, I did not understand. To restart the script enter: python " + tutorialFile + ".py ") + sys.exit("Sorry, I did not understand. To restart the script enter: python " + tutorialFile + ".py ") print("") time.sleep(1) @@ -157,7 +157,7 @@ def call(cmd): elif system == "Linux" : statementStatus = spcall("cf install-plugin https://github.com/PredixDev/cf-predix/releases/download/1.0.0/predix_linux64", shell=True) else : - system.exit("sorry, I did not understand") + sys.exit("sorry, I did not understand") print("Success, you have the Predix CLI") print("") time.sleep(1.5) From 030e49453d78df6ef645b0ed7dbc2d34a1f96859 Mon Sep 17 00:00:00 2001 From: Adirio Date: Fri, 3 Mar 2017 10:13:04 +0100 Subject: [PATCH 3/5] Enhancement: call function It was using a dict with worst case complexity for append and get equal to O(n) while list has O(1) for this operations, which are the only ones being used. Additionally this removes the need of carrying a counter. --- hello-world.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/hello-world.py b/hello-world.py index b81346e..7414080 100644 --- a/hello-world.py +++ b/hello-world.py @@ -26,19 +26,16 @@ def call(cmd): if "|" in cmd: cmd_parts = cmd.split('|') else: - cmd_parts = [] - cmd_parts.append(cmd) - i = 0 - p = {} + cmd_parts = [cmd] + p = [] for cmd_part in cmd_parts: #print(cmd_part) cmd_part = cmd_part.strip() - if i == 0: - p[i]=Popen(shlex.split(cmd_part),stdin=None, stdout=PIPE, stderr=PIPE) + if len(p): + p.append(Popen(shlex.split(cmd_part), stdin=p[-1].stdout, stdout=PIPE, stderr=PIPE)) else: - p[i]=Popen(shlex.split(cmd_part),stdin=p[i-1].stdout, stdout=PIPE, stderr=PIPE) - i = i +1 - (output, err) = p[i-1].communicate() + p.append(Popen(shlex.split(cmd_part), stdin=None, stdout=PIPE, stderr=PIPE)) + (output, err) = p[-1].communicate() exit_code = p[0].wait() return str(output).strip(), str(err), exit_code From 16ddac579dd3e9e9d2919ac701bea6710f6a9784 Mon Sep 17 00:00:00 2001 From: Adirio Date: Fri, 3 Mar 2017 10:14:29 +0100 Subject: [PATCH 4/5] Removed unused import: shutils --- hello-world.py | 1 - 1 file changed, 1 deletion(-) diff --git a/hello-world.py b/hello-world.py index 7414080..91ee9b3 100644 --- a/hello-world.py +++ b/hello-world.py @@ -4,7 +4,6 @@ import time import os import platform -import shutil def doesItExist(command, name, sectionNumber ) : '''handle duplicates due to similar spellings, avoid using regular expressions''' From fcba7b65c173f8d51924886b12f357278677b6e1 Mon Sep 17 00:00:00 2001 From: Adirio Date: Fri, 3 Mar 2017 10:24:40 +0100 Subject: [PATCH 5/5] PEP 8 styling (partial) - Double blank lane wrapping module level functions - 4-space indentation - no-space after "(" - single-space after "," - single-space before and after "=" - single-space before and after "+" - no-space before ")" - no-space before ":" - no-space between "print" and "(" --- hello-world.py | 261 +++++++++++++++++++++++++------------------------ 1 file changed, 132 insertions(+), 129 deletions(-) diff --git a/hello-world.py b/hello-world.py index 91ee9b3..0789680 100644 --- a/hello-world.py +++ b/hello-world.py @@ -5,108 +5,111 @@ import os import platform -def doesItExist(command, name, sectionNumber ) : - '''handle duplicates due to similar spellings, avoid using regular expressions''' - result, err, exitcode = call(command) - #print("result="+result + " err="+err+"enderr") - if ( err != "") : - return False - - rows = result.split('\n') - for row in rows: - #print("row=" +row) - existingSection = row.split(" ")[sectionNumber] - #print("existingSection"+existingSection) - if existingSection == name : - return True + +def doesItExist(command, name, sectionNumber): + '''Handle duplicates due to similar spellings, avoid using regular expressions.''' + result, err, exitcode = call(command) + #print("result=" + result + " err=" + err + "enderr") + if (err != ""): + return False + + rows = result.split('\n') + for row in rows: + #print("row=" + row) + existingSection = row.split(" ")[sectionNumber] + #print("existingSection" + existingSection) + if existingSection == name: + return True + def call(cmd): - """Runs the given command locally and returns the output, err and exit_code, handles Pipes.""" - if "|" in cmd: - cmd_parts = cmd.split('|') - else: - cmd_parts = [cmd] - p = [] - for cmd_part in cmd_parts: - #print(cmd_part) - cmd_part = cmd_part.strip() - if len(p): - p.append(Popen(shlex.split(cmd_part), stdin=p[-1].stdout, stdout=PIPE, stderr=PIPE)) - else: - p.append(Popen(shlex.split(cmd_part), stdin=None, stdout=PIPE, stderr=PIPE)) - (output, err) = p[-1].communicate() - exit_code = p[0].wait() - - return str(output).strip(), str(err), exit_code + """Runs the given command locally and returns the output, err and exit_code, handles Pipes.""" + if "|" in cmd: + cmd_parts = cmd.split('|') + else: + cmd_parts = [cmd] + p = [] + for cmd_part in cmd_parts: + #print(cmd_part) + cmd_part = cmd_part.strip() + if len(p): + p.append(Popen(shlex.split(cmd_part), stdin=p[-1].stdout, stdout=PIPE, stderr=PIPE)) + else: + p.append(Popen(shlex.split(cmd_part), stdin=None, stdout=PIPE, stderr=PIPE)) + (output, err) = p[-1].communicate() + exit_code = p[0].wait() + + return str(output).strip(), str(err), exit_code + """"""""""""""""" Main program starts here """"""""""""""""" system = platform.system() -if ( system == "Windows"): - statementStatus = spcall("cls", shell=True) +if (system == "Windows"): + statementStatus = spcall("cls", shell=True) else: - statementStatus = spcall("reset", shell=True) + statementStatus = spcall("reset", shell=True) import os hostname = os.uname()[1] -tutorialFile="hello-world" -tutorialName="Hello World" -gitRepo="Predix-HelloWorld-WebApp" +tutorialFile = "hello-world" +tutorialName = "Hello World" +gitRepo = "Predix-HelloWorld-WebApp" -print ("$ Welcome to Predix") +print("$ Welcome to Predix") """"""""""""""""" Dropbox """"""""""""""""" if hostname == "predix-devbox" : - print ("$ Would you to like save your work in your Dropbox account?") - print ("1. Yes") - print ("2. No thanks") - choice = raw_input("$") - if choice == "1" : - dropbox=True - print("Okay, do you agree to the EULA located at /predix/Dropbox/predix-dropbox-eula.txt?.") - print ("1. Yes") - print ("2. No") - choice = raw_input("$") - if choice == "1" : - dropbox=True - statementStatus = spcall("killall -q dropbox", shell=True) - statementStatus = spcall("./.dropbox-dist/dropboxd&", shell=True) - print("Dropbox daemon started") - print("") - raw_input("Press Enter to continue...") - statementStatus = spcall("reset", shell=True) - elif choice == "2" : - print("Okay, we won't start the dropbox daemon.") - print("We'll put your work in /predix/dropbox in case you change your mind.") - print("To launch the Dropbox daemon enter: ./predix/.dropbox-dist/dropboxd") - print("") - raw_input("Press Enter to continue...") - statementStatus = spcall("reset", shell=True) - else : - sys.exit("Sorry, I did not understand. To restart the script enter: python " + turorialFile + ".py ") - elif choice == "2" : - print("Okay, we'll put your work in /predix/dropbox in case you change your mind.") - print("To launch the Dropbox daemon enter: ./predix/.dropbox-dist/dropboxd") - print("") - raw_input("Press Enter to continue...") - statementStatus = spcall("reset", shell=True) - else : - sys.exit("Sorry, I did not understand. To restart the script enter: python " + turorialFile + ".py ") - -print ("$ Welcome to Predix") -print ("$ Would you to like me to walk you through " + tutorialName + "?") -print ("1. Yes, walk me through it") -print ("2. Actually, I want to do the steps myself.") + print("$ Would you to like save your work in your Dropbox account?") + print("1. Yes") + print("2. No thanks") + choice = raw_input("$") + if choice == "1": + dropbox = True + print("Okay, do you agree to the EULA located at /predix/Dropbox/predix-dropbox-eula.txt?.") + print("1. Yes") + print("2. No") + choice = raw_input("$") + if choice == "1": + dropbox = True + statementStatus = spcall("killall -q dropbox", shell=True) + statementStatus = spcall("./.dropbox-dist/dropboxd&", shell=True) + print("Dropbox daemon started") + print("") + raw_input("Press Enter to continue...") + statementStatus = spcall("reset", shell=True) + elif choice == "2": + print("Okay, we won't start the dropbox daemon.") + print("We'll put your work in /predix/dropbox in case you change your mind.") + print("To launch the Dropbox daemon enter: ./predix/.dropbox-dist/dropboxd") + print("") + raw_input("Press Enter to continue...") + statementStatus = spcall("reset", shell=True) + else: + sys.exit("Sorry, I did not understand. To restart the script enter: python " + turorialFile + ".py ") + elif choice == "2": + print("Okay, we'll put your work in /predix/dropbox in case you change your mind.") + print("To launch the Dropbox daemon enter: ./predix/.dropbox-dist/dropboxd") + print("") + raw_input("Press Enter to continue...") + statementStatus = spcall("reset", shell=True) + else: + sys.exit("Sorry, I did not understand. To restart the script enter: python " + turorialFile + ".py ") + +print("$ Welcome to Predix") +print("$ Would you to like me to walk you through " + tutorialName + "?") +print("1. Yes, walk me through it") +print("2. Actually, I want to do the steps myself.") choice = raw_input("$") -if choice == "1" : +if choice == "1": + print("") +elif choice == "2": + print("Okay, follow the instructions in the " + tutorialName + " tutorial (https://www.predix.io/resources/tutorials/tutorial-details.html?tutorial_id=1475). Good Luck!") + print("To restart the script enter: python " + tutorialFile + ".py") + print("") + sys.exit() +else: + sys.exit("Sorry, I did not understand. To restart the script enter: python " + tutorialFile + ".py ") print("") -elif choice == "2" : - print("Okay, follow the instructions in the " + tutorialName + " tutorial (https://www.predix.io/resources/tutorials/tutorial-details.html?tutorial_id=1475). Good Luck!") - print("To restart the script enter: python " + tutorialFile + ".py") - print("") - sys.exit() -else : - sys.exit("Sorry, I did not understand. To restart the script enter: python " + tutorialFile + ".py ") - print("") time.sleep(1) @@ -115,8 +118,8 @@ def call(cmd): result, err, exitcode = call('curl google.com') # print("result="+result + " err="+err+"enderr", "exitcode=") # print(exitcode) -if exitcode >= 1 : - sys.exit("Internet access not found. Are you behind a proxy? If so, set environment variables, e.g. HTTP_PROXY=http://myproxy.mycompany.com:8080, HTTPS_PROXY=$HTTP_PROXY. Or perhaps you left the office and need to unset the environment variables, e.g. unset HTTP_PROXY, etc.") +if exitcode >= 1: + sys.exit("Internet access not found. Are you behind a proxy? If so, set environment variables, e.g. HTTP_PROXY=http://myproxy.mycompany.com:8080, HTTPS_PROXY=$HTTP_PROXY. Or perhaps you left the office and need to unset the environment variables, e.g. unset HTTP_PROXY, etc.") print("Internet access successful") print("") time.sleep(1.5) @@ -124,9 +127,9 @@ def call(cmd): """"""""""""""""" Check for Github """"""""""""""""" print("Let's see if you can download from GitHub") try: - result, err, exitcode=call("git --version") + result, err, exitcode = call("git --version") except: - sys.exit("GIT CLI does not exist, please install it. Visit the Development Environment tutorials. (https://www.predix.io/resources/tutorials/journey.html#1607) ") + sys.exit("GIT CLI does not exist, please install it. Visit the Development Environment tutorials. (https://www.predix.io/resources/tutorials/journey.html#1607) ") print("Success, you have the Git CLI") print("") time.sleep(1.5) @@ -134,26 +137,26 @@ def call(cmd): """"""""""""""""" Check for CF CLI """"""""""""""""" print("Let's see if you have the Cloud Foundry CLI") try: - result, err, exitcode=call('cf --version') + result, err, exitcode = call('cf --version') except: - sys.exit("Cloud Foundry CLI does not exist, please install it. Visit the Development Environment tutorials. (https://www.predix.io/resources/tutorials/journey.html#1607) ") + sys.exit("Cloud Foundry CLI does not exist, please install it. Visit the Development Environment tutorials. (https://www.predix.io/resources/tutorials/journey.html#1607) ") print("Success, you have the Cloud Foundry CLI") print("") time.sleep(1.5) """"""""""""""""" Check for Predix Plugin """"""""""""""""" print("Let's see if you have the Predix CLI Plugin") -result, err, exitcode=call('cf plugins') -if not "Predix" in result : +result, err, exitcode = call('cf plugins') +if not "Predix" in result: print("installing the Predix plugin for the Cloud Foundry cli") - if system == "Windows" : - statementStatus = spcall("cf install-plugin https://github.com/PredixDev/cf-predix/releases/download/1.0.0/predix_win64.exe", shell=True) - elif system == "Darwin" : - statementStatus = spcall("cf install-plugin https://github.com/PredixDev/cf-predix/releases/download/1.0.0/predix_osx", shell=True) - elif system == "Linux" : - statementStatus = spcall("cf install-plugin https://github.com/PredixDev/cf-predix/releases/download/1.0.0/predix_linux64", shell=True) - else : - sys.exit("sorry, I did not understand") + if system == "Windows": + statementStatus = spcall("cf install-plugin https://github.com/PredixDev/cf-predix/releases/download/1.0.0/predix_win64.exe", shell=True) + elif system == "Darwin": + statementStatus = spcall("cf install-plugin https://github.com/PredixDev/cf-predix/releases/download/1.0.0/predix_osx", shell=True) + elif system == "Linux": + statementStatus = spcall("cf install-plugin https://github.com/PredixDev/cf-predix/releases/download/1.0.0/predix_linux64", shell=True) + else: + sys.exit("Sorry, I did not understand") print("Success, you have the Predix CLI") print("") time.sleep(1.5) @@ -164,8 +167,8 @@ def call(cmd): if "Not logged in" in result: print("Let's log in to Cloud Foundry") statementStatus = spcall("cf predix", shell=True) - if statementStatus == 1 : - print("Error logging in to CF") + if statementStatus == 1: + print("Error logging in to CF") print("") else: print "Great, you are already logged in" @@ -177,24 +180,24 @@ def call(cmd): print ('git clone https://github.com/PredixDev/' + gitRepo + '.git') print("") print(system) -if system == "Windows" : - if os.path.exists(gitRepo): - os.system("rmdir /S /Q " + gitRepo) - statementStatus = spcall('git clone https://github.com/PredixDev/' + gitRepo + '.git', shell=True) -elif system == "Darwin" : - if os.path.exists(gitRepo): - statementStatus = spcall("rm -rf " + gitRepo) - statementStatus = spcall('git clone https://github.com/PredixDev/' + gitRepo + '.git', shell=True) +if system == "Windows": + if os.path.exists(gitRepo): + os.system("rmdir /S /Q " + gitRepo) + statementStatus = spcall('git clone https://github.com/PredixDev/' + gitRepo + '.git', shell=True) +elif system == "Darwin": + if os.path.exists(gitRepo): + statementStatus = spcall("rm -rf " + gitRepo) + statementStatus = spcall('git clone https://github.com/PredixDev/' + gitRepo + '.git', shell=True) else: - print('For linux we assume you are on a DevBox and will place the app in /predix/Dropbox') - if os.path.exists("/predix/Dropbox/" + gitRepo): - statementStatus = spcall("rm -rf /predix/Dropbox/" + gitRepo, shell=True) - statementStatus = spcall('cd /predix/Dropbox; git clone https://github.com/PredixDev/' + gitRepo + '.git', shell=True) - result = spcall('rm -rf ' + gitRepo,shell=True) -# print("result="+result + " err="+err+"enderr", "exitcode=") + print('For linux we assume you are on a DevBox and will place the app in /predix/Dropbox') + if os.path.exists("/predix/Dropbox/" + gitRepo): + statementStatus = spcall("rm -rf /predix/Dropbox/" + gitRepo, shell=True) + statementStatus = spcall('cd /predix/Dropbox; git clone https://github.com/PredixDev/' + gitRepo + '.git', shell=True) + result = spcall('rm -rf ' + gitRepo,shell=True) +# print("result=" + result + " err=" + err + "enderr", "exitcode=") # print(exitcode) -if statementStatus == 1 : - sys.exit("Unable to git clone the project") +if statementStatus == 1: + sys.exit("Unable to git clone the project") print("") time.sleep(1.5) @@ -202,16 +205,16 @@ def call(cmd): print("Please push " + tutorialName + " to the cloud. Give it a unique name or it won't be able to hand out a URL for your app. ") print("e.g. enter: cf push ") choice = raw_input("$") -if system == "Windows" : - statementStatus = spcall("cd " + gitRepo + " & " + choice, shell=True) -elif system == "Darwin" : - statementStatus = spcall("cd " + gitRepo + ";" + choice, shell=True) +if system == "Windows": + statementStatus = spcall("cd " + gitRepo + " & " + choice, shell=True) +elif system == "Darwin": + statementStatus = spcall("cd " + gitRepo + ";" + choice, shell=True) else: - statementStatus = spcall("cd /predix/Dropbox/" + gitRepo + ";" + choice, shell=True) -# print("result="+result + " err="+err+"enderr", "exitcode=") + statementStatus = spcall("cd /predix/Dropbox/" + gitRepo + ";" + choice, shell=True) +# print("result=" + result + " err=" + err + "enderr", "exitcode=") # print(exitcode) -if statementStatus == 1 : - sys.exit("unable to push your app to the cloud") +if statementStatus == 1: + sys.exit("Unable to push your app to the cloud") print("") """"""""""""""""" Wrap it up """""""""""""""""