Repository navigation
Expand file tree
/
Copy pathlaunch.sh
More file actions
executable file
·48 lines (48 loc) · 2.18 KB
/
Copy pathlaunch.sh
File metadata and controls
executable file
·48 lines (48 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env bash
# Xenosaga I Extractor — Linux launcher.
# Run: ./launch.sh (or double-click where your file manager allows it)
# Installs the kit's packages (requirements.txt: numpy, fonttools, uharfbuzz)
# for this user the first time they are missing (or into a kit-local .venv
# when that Python refuses user installs, PEP 668).
set -e
cd "$(dirname "$0")"
PY=""
if command -v python3 >/dev/null 2>&1; then
PY=python3
elif command -v python >/dev/null 2>&1; then
PY=python
fi
if [ -z "$PY" ]; then
echo "Python 3 is not installed. Install it with your package manager"
echo "(e.g. sudo apt install python3) and run this launcher again."
exit 1
fi
CHECK="import numpy, fontTools, uharfbuzz"
# a kit-local virtual environment made by an earlier run (see below) wins
if [ -x .venv/bin/python ] && .venv/bin/python -c "$CHECK" >/dev/null 2>&1; then
PY=.venv/bin/python
elif ! "$PY" -c "$CHECK" >/dev/null 2>&1; then
echo "Installing the kit's Python packages (numpy, fonttools, uharfbuzz) for this user..."
if "$PY" -m pip install --user -r requirements.txt; then
:
else
# Homebrew's Python and Debian/Ubuntu's system Python refuse
# "pip install --user" (PEP 668, "externally-managed-environment");
# a virtual environment inside the kit folder always works
echo "pip could not install for this user (on Homebrew and Debian/Ubuntu Pythons this is"
echo "PEP 668, \"externally-managed-environment\"). Installing into a private environment"
echo "in this folder instead (.venv)..."
if "$PY" -m venv .venv && .venv/bin/python -m pip install -r requirements.txt \
&& .venv/bin/python -c "$CHECK" >/dev/null 2>&1; then
PY=.venv/bin/python
else
echo "Could not install the packages in requirements.txt."
echo "(On Debian/Ubuntu, venv needs: sudo apt install python3-venv; pip needs internet access.)"
echo "To install by hand into the kit folder:"
echo " $PY -m venv .venv && .venv/bin/python -m pip install -r requirements.txt"
echo "then run this launcher again."
exit 1
fi
fi
fi
exec "$PY" gui.py "$@"