various enhancements

This commit is contained in:
Mario Voigt 2025-06-02 23:55:18 +02:00
parent 41d067e88c
commit 2bed325327
4 changed files with 19 additions and 15 deletions

View File

@ -145,17 +145,18 @@ cat ~/.config/inkscape/extensions/mightyscape-1.2/requirements.txt | sed '/^#/d'
: %AppData%\..\Local\Programs\Python\Python313\Scripts
: The python executable should be available with command "py" (or "python" or "python.exe")
: we also install and upgrade pip package manager, if not already done
py -m ensurepip --upgrade
py -m pip install --upgrade pip
py -m venv %AppData%\inkscape\extensions\mightyscape-1.2\venv
: then we clone MightyScape project into extension directory
cd %AppData%\inkscape\extensions\
git clone https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.2.git
%AppData%\inkscape\extensions\mightyscape-1.2\venv\python3 -m pip install --upgrade --quiet --no-cache-dir -r %AppData%\inkscape\extensions\mightyscape-1.2\requirements.txt
: we also install and upgrade pip package manager, if not already done
%AppData%\inkscape\extensions\mightyscape-1.2\venv\Scripts\python.exe -m ensurepip --upgrade
%AppData%\inkscape\extensions\mightyscape-1.2\venv\Scripts\python.exe -m pip install --upgrade pip
: install modules
%AppData%\inkscape\extensions\mightyscape-1.2\venv\Scripts\python.exe -m pip install --upgrade --quiet --no-cache-dir -r %AppData%\inkscape\extensions\mightyscape-1.2\requirements.txt
: use this in case the previous command failed to continue by just skipping errors (less clean installation)
cd %AppData%\inkscape\extensions\mightyscape-1.2\

View File

@ -19,7 +19,7 @@
</page>
<page name="tab_about" gui-text="About">
<label appearance="header">MightyScape Extension Collection</label>
<label>2019 - 2024 / written by Mario Voigt (Stadtfabrikanten e.V. / FabLab Chemnitz)</label>
<label>2019 - 2025 / written by Mario Voigt (Stadtfabrikanten e.V. / FabLab Chemnitz)</label>
<spacer />
<label appearance="header">Online Documentation</label>
<label appearance="url">https://y.stadtfabrikanten.org/mightyscape-overview</label>

View File

@ -32,7 +32,7 @@ class AboutUpgradeMightyScape(inkex.EffectExtension):
restart = False
def install_requirements(self):
requirements = inkex.utils.debug(os.path.abspath(os.path.join(self.ext_path()) + "/../../../requirements.txt"))
requirements = os.path.abspath(os.path.join(self.ext_path()) + "/../../../requirements.txt")
if not os.path.exists(requirements):
inkex.utils.debug("requirements.txt could not be found.")
exit(1)
@ -41,13 +41,16 @@ class AboutUpgradeMightyScape(inkex.EffectExtension):
python_venv = os.path.abspath(os.path.join(os.path.dirname(git.__file__), '../', '../', '../', '../', 'venv', 'Scripts', 'python.exe'))
else: #Linux/MacOS
python_venv = os.path.abspath(os.path.join(os.path.dirname(git.__file__), '../', '../', '../', '../', 'bin', 'python'))
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)
command = "{} -m pip install --upgrade --no-cache-dir -r {}".format(python_venv, requirements)
inkex.utils.debug("Executing: {}".format(command))
proc = subprocess.Popen(command, shell=True, stdout=PIPE, stderr=PIPE, encoding="UTF-8")
stdout, stderr = proc.communicate()
inkex.utils.debug(stdout.decode('UTF-8'))
inkex.utils.debug(stderr.decode('UTF-8'))
try:
inkex.utils.debug(stdout)
inkex.utils.debug(stderr)
except:
pass
proc.wait()
def update(self, local_repo, remote, localCommitCount):

View File

@ -95,7 +95,7 @@ class boxesPyWrapper(inkex.GenerateExtension):
stdout, stderr = proc.communicate()
if stderr.decode('utf-8') != "":
inkex.utils.debug("stderr: {}".format(stderr.decode('utf-8')))
exit(1)
sys.exit(1)
# check output existence
try:
@ -103,7 +103,7 @@ class boxesPyWrapper(inkex.GenerateExtension):
except FileNotFoundError as e:
inkex.utils.debug("There was no " + box_file + " output generated. Cannot continue. Command was:")
inkex.utils.debug(str(cmd))
exit(1)
sys.exit(1)
# write the generated SVG into Inkscape's canvas
p = etree.XMLParser(huge_tree=True)