update upgrader

This commit is contained in:
Mario Voigt 2025-06-02 23:14:45 +02:00
parent 623ff11304
commit 2412617ba4
2 changed files with 10 additions and 3 deletions

View File

@ -6,7 +6,7 @@
<param name="tab" type="notebook">
<page name="tab_settings" gui-text="Upgrade Options">
<label appearance="header">Install Updates / Options</label>
<param name="install_requirements" type="bool" gui-text="Install python requirements" gui-description="Installs all python requirements from requirements.txt. This may take up to 10 minutes or may. There will be no visible console output until finished. Please wait until completed.">false</param>
<param name="install_requirements" type="bool" gui-text="Install/upgrade python requirements" gui-description="Installs/upgrades all python requirements from requirements.txt. This may take up to 10 minutes or may. There will be no visible console output until finished. Please wait until completed.">false</param>
<param name="convert_to_git" type="bool" gui-text="Convert to .git" gui-description="If you downloaded MightyScape as .zip or .tar.gz you cannot upgrade using this extension. But you can convert your downloaded directory to a .git one by enabling this option">false</param>
<param name="recreate_remotes" type="bool" gui-text="Recreate remotes" gui-description="Update remotes in git config file (useful if you have an older version of MightyScape or if something changes). Warning: might drop passwords/auth tokens!">false</param>

View File

@ -36,8 +36,15 @@ class AboutUpgradeMightyScape(inkex.EffectExtension):
if not os.path.exists(requirements):
inkex.utils.debug("requirements.txt could not be found.")
exit(1)
command = ["python3 -m pip install --upgrade --quiet --no-cache-dir -r " + requirements]
inkex.utils.debug("Executing: {}".format(command))
if os.name=="nt":
PYTHONBIN = "pythonw.exe"
else: #Linux/MacOS
PYTHONBIN = "python"
python_venv = os.path.abspath(os.path.join(os.path.dirname(git.__file__), '../', '../', '../', '../', 'bin', PYTHONBIN))
command = ["{} -m pip install --upgrade --quiet --no-cache-dir -r ".format(python_venv) + requirements]
inkex.utils.debug("Executing: {}".format(command[0]))
proc = subprocess.Popen(command, shell=True, stdout=PIPE, stderr=PIPE)
stdout, stderr = proc.communicate()
inkex.utils.debug(stdout.decode('UTF-8'))