aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.rst15
-rwxr-xr-xsetup.py40
2 files changed, 10 insertions, 45 deletions
diff --git a/README.rst b/README.rst
index 52414a5..3cfd64a 100644
--- a/README.rst
+++ b/README.rst
@@ -52,8 +52,7 @@ Gerbolyze works in three steps.
Quick Start Installation
------------------------
-This will install gerbolyze and svg-flatten into a Python virtualenv and install usvg into your ``~/.cargo`` if not yet
-installed somewhere else.
+This will install gerbolyze and svg-flatten into a Python virtualenv and install usvg into your ``~/.cargo``.
Debian
~~~~~~
@@ -68,13 +67,16 @@ Note:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
+ rustup install stable
+ rustup default stable
+ cargo install usvg
+
git clone --recurse-submodules https://git.jaseg.de/gerbolyze.git
cd gerbolyze
python3 -m venv
source venv/bin/activate
- # may take a while during usvg install
python3 setup.py install
Fedora
@@ -83,13 +85,13 @@ Fedora
.. code-block:: shell
sudo dnf install python3 make clang opencv-devel pugixml-devel pango-devel cairo-devel rust cargo
+ cargo install usvg
git clone --recurse-submodules https://git.jaseg.de/gerbolyze.git
cd gerbolyze
python3 -m venv
source venv/bin/activate
- # may take a while during usvg install
python3 setup.py install
Arch
@@ -99,12 +101,15 @@ Arch
sudo pacman -S pugixml opencv pango cairo git python make clang rustup cargo
+ rustup install stable
+ rustup default stable
+ cargo install usvg
+
git clone --recurse-submodules https://git.jaseg.de/gerbolyze.git
cd gerbolyze
python3 -m venv
source venv/bin/activate
- # may take a while during usvg install
python3 setup.py install
Features
diff --git a/setup.py b/setup.py
index ffe9287..46ce755 100755
--- a/setup.py
+++ b/setup.py
@@ -53,50 +53,10 @@ def has_usvg():
else:
return False
-def install_usvg():
- try:
- subprocess.run(['cargo'], check=True, capture_output=True)
-
- except subprocess.CalledProcessError as e:
- if b'no default toolchain set' in e.stderr:
- print('No rust installation found. Calling rustup.')
-
- try:
- subprocess.run(['rustup', 'install', 'stable'], check=True)
- subprocess.run(['rustup', 'default', 'stable'], check=True)
-
- except subprocess.FileNotFoundError as e:
- print('Cannot find rustup executable. svg-flatten needs usvg, which we install via rustup. Please install rustup or install usvg manually.', file=sys.stderr)
- sys.exit(1)
-
- except subprocess.CalledProcessError as e:
- print('Error installing usvg:', e.returncode, file=sys.stderr)
- sys.exit(1)
-
- else:
- print('Error installing usvg:', e.returncode, file=sys.stderr)
- print(e.stdout.decode())
- print(e.stderr.decode())
- sys.exit(1)
-
- except subprocess.FileNotFoundError as e:
- print('Cannot find cargo executable. svg-flatten needs usvg, which we install via cargo. Please install cargo or install usvg manually.', file=sys.stderr)
- sys.exit(1)
-
- try:
- subprocess.run(['cargo', 'install', 'usvg'], check=True)
-
- except subprocess.CalledProcessError as e:
- print('Error installing usvg:', e.returncode, file=sys.stderr)
- sys.exit(1)
-
class CustomInstall(install):
"""Custom handler for the 'install' command."""
def run(self):
compile_and_install_svgflatten()
- if not has_usvg():
- print('usvg not found. Installing.')
- install_usvg()
super().run()
setup(