summaryrefslogtreecommitdiff
path: root/init.sh
diff options
context:
space:
mode:
authorRasmus Andersson <rasmus@notion.se>2019-01-05 22:41:37 +0300
committerRasmus Andersson <rasmus@notion.se>2019-01-05 22:41:37 +0300
commitdee86b504c021bd465e124360a035d72e7abaa6d (patch)
tree87c6bf1b9495a31b8ba1758f840edbdac5e7e493 /init.sh
parentf15b156c4d2bfe939a070286514ba84d9fea95ea (diff)
downloadinter-dee86b504c021bd465e124360a035d72e7abaa6d.tar.xz
patches ufo2ft and drops python 2 env for OTF compilation
Diffstat (limited to 'init.sh')
-rwxr-xr-xinit.sh45
1 files changed, 14 insertions, 31 deletions
diff --git a/init.sh b/init.sh
index 5e702c676..f0dcd4cd9 100755
--- a/init.sh
+++ b/init.sh
@@ -108,31 +108,11 @@ else
done
fi
- # --------------------
- # ISSUE #110 (bug in ufo2ft) requires Python 2 for OTF CFF compilation
- # See also: https://github.com/googlei18n/ufo2ft/issues/306
- PYTHON2=
- if (which python2 >/dev/null); then
- PYTHON2=$(which python2)
- elif (which python >/dev/null) && (python --version | grep -q 'ython 2'); then
- PYTHON2=$(which python)
- else
- echo "Unable to find Python 2 (tried python2 and python)." >&2
- echo "Python 2 is required to compile OTF files because of a Python-3 bug in a third-party library." >&2
- exit 1
- fi
- # ln -svf "$PYTHON2" "$VENV_DIR/bin/python2"
- VENV2_DIR=$BUILD_DIR/venv2
- if [[ ! -d "$VENV2_DIR/bin" ]]; then
- require_virtualenv
- $virtualenv "--python=$PYTHON2" "$VENV2_DIR"
- fi
# ——————————————————————————————————————————————————————————————————
- # check pip requirements
+ # python dependencies
-
- # primary env
+ # install if deps changed
REQUIREMENTS_FILE=$SRCDIR/requirements.txt
UPDATE_TIMESTAMP_FILE="$VENV_DIR/last-pip-run.mark"
if [ "$REQUIREMENTS_FILE" -nt "$UPDATE_TIMESTAMP_FILE" ]; then
@@ -141,21 +121,24 @@ else
date '+%s' > "$UPDATE_TIMESTAMP_FILE"
fi
- # secondary env (Python 2)
- REQUIREMENTS2_FILE=$SRCDIR/requirements2.txt
- UPDATE_TIMESTAMP2_FILE="$VENV2_DIR/last-pip-run.mark"
- if [ "$REQUIREMENTS2_FILE" -nt "$UPDATE_TIMESTAMP2_FILE" ]; then
- echo "$VENV2_DIR/bin/pip install -r $REQUIREMENTS2_FILE"
- "$VENV2_DIR/bin/pip" install -r "$REQUIREMENTS2_FILE"
- date '+%s' > "$UPDATE_TIMESTAMP2_FILE"
+ # patch ufo2ft [BUG #110]
+ P1_FILE="$VENV_DIR/lib/python/site-packages/ufo2ft/outlineCompiler.py"
+ P1_BACKUP="$P1_FILE.orig"
+ if [[ ! -f "$P1_BACKUP" ]]; then
+ echo "Patching $P1_FILE (backup at $P1_BACKUP)"
+ mv "$P1_FILE" "$P1_BACKUP"
+ patch "$P1_BACKUP" -o "$P1_FILE" -u -i misc/ufo2ft-2.5.0-outlineCompiler.patch
fi
+
# ——————————————————————————————————————————————————————————————————
- # active primary env (Python 3)
+ # activate env (for rest of this script)
source "$VENV_DIR/bin/activate"
+
# ——————————————————————————————————————————————————————————————————
- # deps
+ # other toolchain dependencies
+
DEPS_DIR=$BUILD_DIR/deps
PATCH_DIR=$(pwd)/misc/patches
mkdir -p "$DEPS_DIR"