--- a/uninstall.py Wed May 08 18:42:59 2013 +0200 +++ b/uninstall.py Sun May 12 19:02:13 2013 +0200 @@ -15,6 +15,9 @@ import glob import distutils.sysconfig +# get a local eric5config.py out of the way +if os.path.exists("eric5config.py"): + os.rename("eric5config.py", "eric5config.py.orig") from eric5config import getConfig # Define the globals. @@ -23,6 +26,17 @@ progLanguages = ["Python", "Ruby"] +def exit(rcode=0): + """ + Exit the uninstall script. + """ + # restore the local eric5config.py + if os.path.exists("eric5config.py.orig"): + if os.path.exists("eric5config.py"): + os.remove("eric5config.py") + os.rename("eric5config.py.orig", "eric5config.py") + + def usage(rcode=2): """Display a usage message and exit. @@ -35,7 +49,7 @@ print("where:") print(" -h display this help message") - sys.exit(rcode) + exit(rcode) def initGlobals(): @@ -141,7 +155,7 @@ shutil.rmtree("/Developer/Applications/Eric5") if os.path.exists("/Applications/eric5.app"): shutil.rmtree("/Applications/eric5.app") - + def main(argv): """The main function of the script. @@ -174,7 +188,9 @@ except OSError as msg: sys.stderr.write('OSError: {0}\nTry uninstall with admin rights.\n'.format(msg)) - + exit(0) + + if __name__ == "__main__": try: main(sys.argv)