diff options
author | sanbikappa | 2023-08-05 13:28:33 +0800 |
---|---|---|
committer | sanbikappa | 2023-08-05 13:28:33 +0800 |
commit | decdc4280c317e7718d6af21d2a552f29dedd46d (patch) | |
tree | d4ffbb7dca095c41f3244dd70f47f477451dec51 | |
parent | 579598f5ec5f55c5f50e021974471c2b65cbb6bf (diff) | |
download | aur-decdc4280c317e7718d6af21d2a552f29dedd46d.tar.gz |
create patches to replace the API save path
-rw-r--r-- | .SRCINFO | 2 | ||||
-rw-r--r-- | PKGBUILD | 29 |
2 files changed, 26 insertions, 5 deletions
@@ -1,7 +1,7 @@ pkgbase = krita-plugin-pythonplugindevelopertools-git pkgdesc = Python plugin for Krita that assists with making python plugins for Krita pkgver = r37.46a671a - pkgrel = 1 + pkgrel = 2 url = https://github.com/KnowZero/Krita-PythonPluginDeveloperTools install = .install arch = any @@ -3,7 +3,7 @@ pkgname=krita-plugin-pythonplugindevelopertools-git pkgver=r37.46a671a -pkgrel=1 +pkgrel=2 epoch= pkgdesc="Python plugin for Krita that assists with making python plugins for Krita" arch=('any') @@ -22,10 +22,31 @@ pkgver() { } prepare() { - cd "$srcdir/$pkgname-$pkgver" - # set the PluginDevTools.KritaAPI.*.zip file's save path to ~/.cache/krita/ - sed -i 's/os.path.dirname(os.path.realpath(__file__))/os.path.join(os.path.expanduser("~"),".cache","krita","PluginDevTools")/' plugindevtools/PluginDevTools/GetKritaAPI.py + # General users can not download API files to /usr/share/krita/pykrita/ if they do not have sudo permission + # set the save path of PluginDevTools.KritaAPI.*.zip files to ~/.cache/krita/ + + rm -f "$srcdir"/*.patch + # create patchs + cd "$srcdir/$pkgname-$pkgver/plugindevtools/PluginDevTools" + search=$(grep -n os.path.dirname *.py | grep os.path.realpath | grep .KritaAPI. | grep .zip) + echo "$search" | while read -r line;do + file="$(echo "$line" | awk '{sub(/:/,"<mySeparator>")}1' | awk '{sub(/:/,"<mySeparator>")}1' | awk -F'<mySeparator>' '{print $1}')" + line_number="$(echo "$line" | awk '{sub(/:/,"<mySeparator>")}1' | awk '{sub(/:/,"<mySeparator>")}1' | awk -F'<mySeparator>' '{print $2}')" + line_content="$(echo "$line" | awk '{sub(/:/,"<mySeparator>")}1' | awk '{sub(/:/,"<mySeparator>")}1' | awk -F'<mySeparator>' '{print $3}')" + line_replace="$(echo "$line_content" | sed 's|os.path.dirname(os.path.realpath(__file__))|os.path.join(os.path.expanduser("~"),".cache","krita","PluginDevTools")|')" + echo "${line_number}c${line_number}" >> ${file}.patch + echo "< $line_content" >> ${file}.patch + echo "---" >> ${file}.patch + echo "> $line_replace" >> ${file}.patch + done + # patch files + cd "$srcdir/$pkgname-$pkgver/plugindevtools/PluginDevTools" + for i in $(ls *.patch);do + patch ${i%.patch} $i + done + mv *.patch $srcdir/ + cd $srcdir } package() { |