uninstall
This commit is contained in:
parent
a7e29ffea5
commit
0fbb0348a6
@ -3,5 +3,6 @@
|
|||||||
Options:
|
Options:
|
||||||
-h, --help show this help message and exit
|
-h, --help show this help message and exit
|
||||||
-i, --install installs t3make00 (~/.bashrc)
|
-i, --install installs t3make00 (~/.bashrc)
|
||||||
|
-u, --uninstall uninstalls t3make00 (~/.bashrc)
|
||||||
-p PROJECT, --project=PROJECT
|
-p PROJECT, --project=PROJECT
|
||||||
name of the project (defaults to value args[0])
|
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.extractall(path=base_tools)
|
||||||
teensy_tools_tar.close()
|
teensy_tools_tar.close()
|
||||||
|
|
||||||
print "#3 updating PATH"
|
print "#3 updating ~/.bashrc"
|
||||||
|
|
||||||
home = os.path.expanduser("~")
|
home = os.path.expanduser("~")
|
||||||
bashrc = os.path.join(home, ".bashrc")
|
bashrc = os.path.join(home, ".bashrc")
|
||||||
@ -140,10 +140,36 @@ def install():
|
|||||||
else:
|
else:
|
||||||
print "Please add " + basepath + "to your ~/.bashrc PATH"
|
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__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
p = OptionParser();
|
p = OptionParser();
|
||||||
p.add_option('-i', '--install', action="store_true", help="installs t3make00 (~/.bashrc)")
|
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])")
|
p.add_option('-p', '--project', action="store", help="name of the project (defaults to value args[0])")
|
||||||
|
|
||||||
options, args = p.parse_args()
|
options, args = p.parse_args()
|
||||||
@ -152,6 +178,10 @@ if __name__ == '__main__':
|
|||||||
install()
|
install()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
if options.uninstall:
|
||||||
|
uninstall()
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
if not options.project and len(args) == 0:
|
if not options.project and len(args) == 0:
|
||||||
sys.exit("No project specified. Aborting.\nt3make00 --help for usage information.");
|
sys.exit("No project specified. Aborting.\nt3make00 --help for usage information.");
|
||||||
if len(args) > 1:
|
if len(args) > 1:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user