uninstall
This commit is contained in:
parent
a7e29ffea5
commit
0fbb0348a6
@ -3,5 +3,6 @@
|
||||
Options:
|
||||
-h, --help show this help message and exit
|
||||
-i, --install installs t3make00 (~/.bashrc)
|
||||
-u, --uninstall uninstalls t3make00 (~/.bashrc)
|
||||
-p PROJECT, --project=PROJECT
|
||||
name of the project (defaults to value args[0])
|
||||
32
t3make00
32
t3make00
@ -128,7 +128,7 @@ def install():
|
||||
teensy_tools_tar.extractall(path=base_tools)
|
||||
teensy_tools_tar.close()
|
||||
|
||||
print "#3 updating PATH"
|
||||
print "#3 updating ~/.bashrc"
|
||||
|
||||
home = os.path.expanduser("~")
|
||||
bashrc = os.path.join(home, ".bashrc")
|
||||
@ -140,10 +140,36 @@ def install():
|
||||
else:
|
||||
print "Please add " + basepath + "to your ~/.bashrc PATH"
|
||||
|
||||
print "done."
|
||||
|
||||
def uninstall():
|
||||
|
||||
print "#0 removing arm toolchain and teensy-tools"
|
||||
|
||||
shutil.rmtree(os.path.join(basepath, "tools"))
|
||||
|
||||
print "#1 updating ~/.bashrc"
|
||||
|
||||
home = os.path.expanduser("~")
|
||||
bashrc = os.path.join(home, ".bashrc")
|
||||
|
||||
if os.path.exists(bashrc):
|
||||
import fileinput
|
||||
delete_line = "PATH=$PATH:" + basepath + "\n"
|
||||
deleted = False
|
||||
for l in fileinput.input(bashrc, inplace=1):
|
||||
if l != delete_line: print l
|
||||
else: deleted = True
|
||||
if not deleted:
|
||||
print "Could not update ~/.bashrc porperly.\nPlease make sure to erase " + basepath + " from your ~/.bashrc PATH"
|
||||
|
||||
print "done."
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
p = OptionParser();
|
||||
p.add_option('-i', '--install', action="store_true", help="installs t3make00 (~/.bashrc)")
|
||||
p.add_option('-u', '--uninstall', action="store_true", help="uninstalls t3make00 (~/.bashrc)")
|
||||
p.add_option('-p', '--project', action="store", help="name of the project (defaults to value args[0])")
|
||||
|
||||
options, args = p.parse_args()
|
||||
@ -152,6 +178,10 @@ if __name__ == '__main__':
|
||||
install()
|
||||
sys.exit(1)
|
||||
|
||||
if options.uninstall:
|
||||
uninstall()
|
||||
sys.exit(1)
|
||||
|
||||
if not options.project and len(args) == 0:
|
||||
sys.exit("No project specified. Aborting.\nt3make00 --help for usage information.");
|
||||
if len(args) > 1:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user