--- pkgsrc/lang/python/plist-python.awk 2012/05/13 12:54:54 1.1 +++ pkgsrc/lang/python/plist-python.awk 2023/10/26 10:10:23 1.4 @@ -1,4 +1,4 @@ -# $NetBSD: plist-python.awk,v 1.1 2012/05/13 12:54:54 obache Exp $ +# $NetBSD: plist-python.awk,v 1.4 2023/10/26 10:10:23 wiz Exp $ # # Copyright (c) 2012 The NetBSD Foundation, Inc. # All rights reserved. @@ -27,24 +27,25 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. -### This awk script handles python bytcode file entries in PLISTs. This script +### This awk script handles Python bytecode file entries in PLISTs. This script ### requires the following scripts to be included: ### ### plist-functions.awk (print_entry) ### ### Certain environment variables must be set prior to running this script: ### -### PY_SOABI is the python SO ABI. +### PYVERS ### BEGIN { - PYTHON_SOABI = getenv_or_die("PYTHON_SOABI") + PYVERS = getenv_or_die("PYVERS") } -### -### For each python bytecode file entry, convert directory and file name -### using cache sub directory and SOABI. +### For each Python bytecode file entry, convert directory and file name. ### /^[^@]/ && /[^\/]+\.py[co]$/ { sub(/[^\/]+\.py[co]$/, "__pycache__/&") - sub(/\.py[co]$/, "." PYTHON_SOABI "&") + sub(/\.py[co]$/, ".cpython-" PYVERS "&") + if (PYVERS ~ /^3[0-9]+$/ && $0 ~ /\.pyo$/) { + sub(/\.pyo$/, ".opt-1.pyc") + } }