various enhancements
This commit is contained in:
parent
41d067e88c
commit
2bed325327
11
README.md
11
README.md
@ -145,17 +145,18 @@ cat ~/.config/inkscape/extensions/mightyscape-1.2/requirements.txt | sed '/^#/d'
|
|||||||
: %AppData%\..\Local\Programs\Python\Python313\Scripts
|
: %AppData%\..\Local\Programs\Python\Python313\Scripts
|
||||||
: The python executable should be available with command "py" (or "python" or "python.exe")
|
: 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
|
py -m venv %AppData%\inkscape\extensions\mightyscape-1.2\venv
|
||||||
|
|
||||||
: then we clone MightyScape project into extension directory
|
: then we clone MightyScape project into extension directory
|
||||||
cd %AppData%\inkscape\extensions\
|
cd %AppData%\inkscape\extensions\
|
||||||
git clone https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.2.git
|
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)
|
: use this in case the previous command failed to continue by just skipping errors (less clean installation)
|
||||||
cd %AppData%\inkscape\extensions\mightyscape-1.2\
|
cd %AppData%\inkscape\extensions\mightyscape-1.2\
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
</page>
|
</page>
|
||||||
<page name="tab_about" gui-text="About">
|
<page name="tab_about" gui-text="About">
|
||||||
<label appearance="header">MightyScape Extension Collection</label>
|
<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 />
|
<spacer />
|
||||||
<label appearance="header">Online Documentation</label>
|
<label appearance="header">Online Documentation</label>
|
||||||
<label appearance="url">https://y.stadtfabrikanten.org/mightyscape-overview</label>
|
<label appearance="url">https://y.stadtfabrikanten.org/mightyscape-overview</label>
|
||||||
|
@ -32,7 +32,7 @@ class AboutUpgradeMightyScape(inkex.EffectExtension):
|
|||||||
restart = False
|
restart = False
|
||||||
|
|
||||||
def install_requirements(self):
|
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):
|
if not os.path.exists(requirements):
|
||||||
inkex.utils.debug("requirements.txt could not be found.")
|
inkex.utils.debug("requirements.txt could not be found.")
|
||||||
exit(1)
|
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'))
|
python_venv = os.path.abspath(os.path.join(os.path.dirname(git.__file__), '../', '../', '../', '../', 'venv', 'Scripts', 'python.exe'))
|
||||||
else: #Linux/MacOS
|
else: #Linux/MacOS
|
||||||
python_venv = os.path.abspath(os.path.join(os.path.dirname(git.__file__), '../', '../', '../', '../', 'bin', 'python'))
|
python_venv = os.path.abspath(os.path.join(os.path.dirname(git.__file__), '../', '../', '../', '../', 'bin', 'python'))
|
||||||
|
command = "{} -m pip install --upgrade --no-cache-dir -r {}".format(python_venv, requirements)
|
||||||
command = ["{} -m pip install --upgrade --quiet --no-cache-dir -r ".format(python_venv) + requirements]
|
inkex.utils.debug("Executing: {}".format(command))
|
||||||
inkex.utils.debug("Executing: {}".format(command[0]))
|
proc = subprocess.Popen(command, shell=True, stdout=PIPE, stderr=PIPE, encoding="UTF-8")
|
||||||
proc = subprocess.Popen(command, shell=True, stdout=PIPE, stderr=PIPE)
|
|
||||||
stdout, stderr = proc.communicate()
|
stdout, stderr = proc.communicate()
|
||||||
inkex.utils.debug(stdout.decode('UTF-8'))
|
try:
|
||||||
inkex.utils.debug(stderr.decode('UTF-8'))
|
inkex.utils.debug(stdout)
|
||||||
|
inkex.utils.debug(stderr)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
proc.wait()
|
proc.wait()
|
||||||
|
|
||||||
def update(self, local_repo, remote, localCommitCount):
|
def update(self, local_repo, remote, localCommitCount):
|
||||||
|
@ -95,7 +95,7 @@ class boxesPyWrapper(inkex.GenerateExtension):
|
|||||||
stdout, stderr = proc.communicate()
|
stdout, stderr = proc.communicate()
|
||||||
if stderr.decode('utf-8') != "":
|
if stderr.decode('utf-8') != "":
|
||||||
inkex.utils.debug("stderr: {}".format(stderr.decode('utf-8')))
|
inkex.utils.debug("stderr: {}".format(stderr.decode('utf-8')))
|
||||||
exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# check output existence
|
# check output existence
|
||||||
try:
|
try:
|
||||||
@ -103,7 +103,7 @@ class boxesPyWrapper(inkex.GenerateExtension):
|
|||||||
except FileNotFoundError as e:
|
except FileNotFoundError as e:
|
||||||
inkex.utils.debug("There was no " + box_file + " output generated. Cannot continue. Command was:")
|
inkex.utils.debug("There was no " + box_file + " output generated. Cannot continue. Command was:")
|
||||||
inkex.utils.debug(str(cmd))
|
inkex.utils.debug(str(cmd))
|
||||||
exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# write the generated SVG into Inkscape's canvas
|
# write the generated SVG into Inkscape's canvas
|
||||||
p = etree.XMLParser(huge_tree=True)
|
p = etree.XMLParser(huge_tree=True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user