Tue Jan 25 13:21:21 2022 UTC ()
python/wheel.mk: add PLIST code for pyc/pyo

TODO: clean up/merge with extension.mk


(wiz)
diff -r1.3 -r1.4 pkgsrc/lang/python/wheel.mk

cvs diff -r1.3 -r1.4 pkgsrc/lang/python/wheel.mk (expand / switch to unified diff)

--- pkgsrc/lang/python/wheel.mk 2022/01/13 21:23:25 1.3
+++ pkgsrc/lang/python/wheel.mk 2022/01/25 13:21:21 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: wheel.mk,v 1.3 2022/01/13 21:23:25 wiz Exp $ 1# $NetBSD: wheel.mk,v 1.4 2022/01/25 13:21:21 wiz Exp $
2# 2#
3# Initial mk for building and installing python wheels 3# Initial mk for building and installing python wheels
4# 4#
5# Variables: 5# Variables:
6#  6#
7# WHEELFILE: path to the wheelfile to be installed 7# WHEELFILE: path to the wheelfile to be installed
8# only needs to be set if do-build is redefined 8# only needs to be set if do-build is redefined
9# 9#
10# MASTER_SITE_WHEEL: master site to grab wheels directly  10# MASTER_SITE_WHEEL: master site to grab wheels directly
11# use like ${MASTER_SITE_WHEEL:=project/} 11# use like ${MASTER_SITE_WHEEL:=project/}
12# uses debian pypi redirector so that there 12# uses debian pypi redirector so that there
13# is no need for hashes in urls. 13# is no need for hashes in urls.
14# 14#
@@ -44,21 +44,34 @@ TOOL_DEPENDS+= ${PYPKGPREFIX}-build>=0:. @@ -44,21 +44,34 @@ TOOL_DEPENDS+= ${PYPKGPREFIX}-build>=0:.
44 44
45.if !target(do-build) 45.if !target(do-build)
46do-build: 46do-build:
47 ${RUN} cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${PYTHONBIN} -m build --wheel --skip-dependency-check --no-isolation 47 ${RUN} cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${PYTHONBIN} -m build --wheel --skip-dependency-check --no-isolation
48.endif 48.endif
49 49
50.endif 50.endif
51 51
52WHEEL_NAME?= ${DISTNAME:C/-([^0-9])/_\1/g} 52WHEEL_NAME?= ${DISTNAME:C/-([^0-9])/_\1/g}
53_WHEEL_INFODIR= ${WHEEL_NAME}.dist-info 53_WHEEL_INFODIR= ${WHEEL_NAME}.dist-info
54PLIST_SUBST+= PYSITELIB=${PYSITELIB} 54PLIST_SUBST+= PYSITELIB=${PYSITELIB}
55PLIST_SUBST+= WHEEL_INFODIR=${_WHEEL_INFODIR} 55PLIST_SUBST+= WHEEL_INFODIR=${_WHEEL_INFODIR}
56 56
 57# from extension.mk
 58
 59# Python>=3.2 bytecode file location change
 60# http://www.python.org/dev/peps/pep-3147/
 61.if empty(_PYTHON_VERSION:M2?)
 62PLIST_AWK+= -f ${PKGSRCDIR}/lang/python/plist-python.awk
 63PLIST_AWK_ENV+= PYVERS="${PYVERSSUFFIX:S/.//}"
 64EARLY_PRINT_PLIST_AWK+= /^[^@]/ && /[^\/]+\.py[co]$$/ {
 65EARLY_PRINT_PLIST_AWK+= gsub(/__pycache__\//, "")
 66EARLY_PRINT_PLIST_AWK+= gsub(/opt-1\.pyc$$/, "pyo")
 67EARLY_PRINT_PLIST_AWK+= gsub(/\.cpython-${_PYTHON_VERSION}/, "")}
 68.endif
 69
57PRINT_PLIST_AWK+= { gsub(/${_WHEEL_INFODIR:S,.,\.,g}/, "$${WHEEL_INFODIR}") } 70PRINT_PLIST_AWK+= { gsub(/${_WHEEL_INFODIR:S,.,\.,g}/, "$${WHEEL_INFODIR}") }
58 71
59INSTALL_ENV+= PIP_NO_CACHEDIR=1 72INSTALL_ENV+= PIP_NO_CACHEDIR=1
60 73
61do-install: 74do-install:
62 ${RUN} cd ${WRKDIR} && \ 75 ${RUN} cd ${WRKDIR} && \
63 ${SETENV} ${INSTALL_ENV} \ 76 ${SETENV} ${INSTALL_ENV} \
64 ${PYTHONBIN} -m pip install --no-cache-dir --no-deps --root ${DESTDIR:Q} --prefix ${PREFIX:Q} --compile --force-reinstall -I ${WHEELFILE} 77 ${PYTHONBIN} -m pip install --no-cache-dir --no-deps --root ${DESTDIR:Q} --prefix ${PREFIX:Q} --compile --force-reinstall -I ${WHEELFILE}