Allow pypy2 pypy3 patching (#2421)

* Fix: patterns for pypy2.*/pypy3.* versions

* Shrink pypy patterns

* Fix extglob pattern

* Fix: no regex-charclasses like '[:digit:]' in 'extglob', needs also double-activation for parse/runtime stage

Co-authored-by: native-api <vano@mail.mipt.ru>
Co-authored-by: Bjoern Schneider <bjoern.schneider@scribos.com>
This commit is contained in:
brogon 2022-07-26 21:03:26 +02:00 committed by GitHub
parent 16f7ea03e8
commit f5cbba0636
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1639,11 +1639,17 @@ build_package_auto_tcltk() {
# extglob must be set at parse time, not at runtime # extglob must be set at parse time, not at runtime
# https://stackoverflow.com/questions/49283740/bash-script-throws-syntax-errors-when-the-extglob-option-is-set-inside-a-subsh # https://stackoverflow.com/questions/49283740/bash-script-throws-syntax-errors-when-the-extglob-option-is-set-inside-a-subsh
#
# The function is *parsed* with "extglob" only if an outer `shopt -s exglob`
# exists; at *runtime* you still need to activate it *within* the function.
#
shopt -s extglob shopt -s extglob
apply_python_patch() { apply_python_patch() {
local patchfile local patchfile
# needed at runtime
shopt -s extglob
case "$1" in case "$1" in
Python-* | jython-* | pypy-* | pypy[:digit:].+([:digit:])-* | stackless-* ) Python-* | jython-* | pypy-* | pypy[0-9].+([0-9])-* | stackless-* )
patchfile="$(mktemp "${TMP}/python-patch.XXXXXX")" patchfile="$(mktemp "${TMP}/python-patch.XXXXXX")"
cat "${2:--}" >"$patchfile" cat "${2:--}" >"$patchfile"
@ -1652,6 +1658,7 @@ apply_python_patch() {
patch -p$striplevel --force -i "$patchfile" patch -p$striplevel --force -i "$patchfile"
;; ;;
esac esac
shopt -u extglob
} }
shopt -u extglob shopt -u extglob