-
Notifications
You must be signed in to change notification settings - Fork 0
/
apply_patches.sh
44 lines (31 loc) · 1.23 KB
/
apply_patches.sh
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
#!/bin/bash
# This patches issues with kivy and pytest that prevent the Pycharm Debugger from working because of posixpath.sep
# This modifies packages installed in a virtualenv
# These are generated with diff --text --unified --new-file {{old_file}} {{new_file}} > {{diff.patch}}
set -euo pipefail
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
VENV_PATH=$(readlink -f "$SCRIPT_DIR"/../../venv)
if [[ ! -e $VENV_PATH ]]; then
echo Could not find "$VENV_PATH"
exit 1
fi
SITE_PKG_PATH=$(find "$VENV_PATH" -name "site-packages")
if [[ ! -e $SITE_PKG_PATH ]]; then
echo Could not find site-packages for "$VENV_PATH"
exit 1
fi
declare -A patchTargets
patchTargets[flatDirs.patch]="$SITE_PKG_PATH/pythonforandroid/bootstraps/common/build/templates/build.tmpl.gradle"
for patchFile in "${!patchTargets[@]}"; do
target="${patchTargets[$patchFile]}"
if [[ ! -e "$target" ]]; then
echo Could not find target for "$patchFile", "$target"
else
patch --batch -s -i "$patchFile" "$target"
fi
done
#patchTargets[filechooser.patch]="$SITE_PKG_PATH/kivy/uix/filechooser.py"
#patchTargets[app.patch]="$SITE_PKG_PATH/kivy/app.py"
#patchTargets[pathlib.patch]="$SITE_PKG_PATH/_pytest/pathlib.py"
#
#