From f5cbba06367274d275f2647623d6015eea8426cc Mon Sep 17 00:00:00 2001 From: brogon Date: Tue, 26 Jul 2022 21:03:26 +0200 Subject: [PATCH] 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 Co-authored-by: Bjoern Schneider --- plugins/python-build/bin/python-build | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index f2156645..e03e4554 100755 --- a/plugins/python-build/bin/python-build +++ b/plugins/python-build/bin/python-build @@ -1639,11 +1639,17 @@ build_package_auto_tcltk() { # 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 +# +# 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 apply_python_patch() { local patchfile + # needed at runtime + shopt -s extglob 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")" cat "${2:--}" >"$patchfile" @@ -1652,6 +1658,7 @@ apply_python_patch() { patch -p$striplevel --force -i "$patchfile" ;; esac + shopt -u extglob } shopt -u extglob