1
1
Fork 0

Implement easy uninstaller

develop
corentin 11 months ago
parent 3f84549704
commit eae028eb24
  1. 19
      bip/mink/start.py
  2. 6
      bip/mink/uninstall.py
  3. 2
      builtins/commands/uninstall.py
  4. 8
      scripts/windows/entry.py
  5. 2
      scripts/windows/uninstall.bat

@ -6,8 +6,10 @@ from bip.wink.constants import CURRENT_OS
scripts_dir = os.path.join(bip_root_directory, "scripts", CURRENT_OS.lower())
invisible = os.path.join(scripts_dir, "invisible.vbs")
start = os.path.join(scripts_dir, "start.bat")
update = os.path.join(scripts_dir, "update.bat")
uninstall = os.path.join(scripts_dir, "uninstall.bat")
def launcher(debug=False):
@ -32,9 +34,24 @@ def updater():
raise NotImplementedError(message)
def uninstaller():
if CURRENT_OS == "Windows":
command = 'cd "{}" && wscript.exe "{}" "{}"'.format(
scripts_dir, invisible, update
)
subprocess.run(command, shell=True)
else:
message = "start_updater is not implemented for {}.".format(CURRENT_OS)
raise NotImplementedError(message)
def start_launcher(debug=False):
return launcher(debug)
def start_updater():
return updater()
return updater()
def start_uninstaller():
return uninstaller()

@ -22,4 +22,8 @@ def run():
if os.path.isfile(path):
os.remove(path)
elif os.path.isdir(path):
shutil.rmtree(path)
shutil.rmtree(path)
if __name__ == "__main__":
run()

@ -24,6 +24,6 @@ def run(controller, **kwargs):
if not controller.confirm_message(title, description):
return SUCCESS
mink.uninstall.run()
mink.start.uninstaller()
controller.quit()
return SUCCESS

@ -10,6 +10,7 @@ from PySide2.QtWidgets import QApplication, QMessageBox
# Modes
LAUNCH = 'launch'
UPDATE = 'update'
UNINSTALL = 'uninstall'
parser = argparse.ArgumentParser(description="Start Bip")
parser.add_argument(
@ -23,8 +24,8 @@ parser.add_argument(
args = parser.parse_args()
mode = args.mode
if mode not in (LAUNCH, UPDATE):
raise ValueError('Unknown mode: "{}". Accepted modes are: {}, {}'.format(mode, LAUNCH, UPDATE))
if mode not in (LAUNCH, UPDATE, UNINSTALL):
raise ValueError('Unknown mode: "{}". Accepted modes are: {}, {}, {}'.format(mode, LAUNCH, UPDATE, UNINSTALL))
if 'BIP_PACKAGE' in os.environ:
@ -37,6 +38,7 @@ apps = str(Path(bip) / "apps")
launcher_script = str(Path(apps) / "launcher" / "__main__.py")
updater_script = str(Path(apps) / "updater" / "__main__.py")
uninstaller_script = str(Path(bip) / "bip" / "mink" / "uninstall.py")
script = launcher_script
@ -44,6 +46,8 @@ if mode == LAUNCH:
script = launcher_script
elif mode == UPDATE:
script = updater_script
elif mode == UNINSTALL:
script = uninstaller_script
def main():

@ -0,0 +1,2 @@
::"%USERPROFILE%\AppData\Local\Blink\python\Scripts\activate.bat" && pythonw entry.py --mode update
"%BIP_PATH%\python\Scripts\activate.bat" && pythonw entry.py --mode uninstall
Loading…
Cancel
Save