pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/lang/python
Module Name: pkgsrc
Committed By: riastradh
Date: Tue Jun 27 10:31:21 UTC 2023
Modified Files:
pkgsrc/lang/python: application.mk egg.mk extension.mk pyversion.mk
srcdist.mk tool.mk wheel.mk
Log Message:
lang/python: Handle TOOLBASE/LOCALBASE split.
New TOOL_PYTHONBIN is for executing at build-time, old PYTHONBIN is
a path that will work at run-time and can be baked into the package.
To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 pkgsrc/lang/python/application.mk
cvs rdiff -u -r1.39 -r1.40 pkgsrc/lang/python/egg.mk
cvs rdiff -u -r1.60 -r1.61 pkgsrc/lang/python/extension.mk
cvs rdiff -u -r1.149 -r1.150 pkgsrc/lang/python/pyversion.mk
cvs rdiff -u -r1.42 -r1.43 pkgsrc/lang/python/srcdist.mk
cvs rdiff -u -r1.3 -r1.4 pkgsrc/lang/python/tool.mk
cvs rdiff -u -r1.7 -r1.8 pkgsrc/lang/python/wheel.mk
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/lang/python/application.mk
diff -u pkgsrc/lang/python/application.mk:1.13 pkgsrc/lang/python/application.mk:1.14
--- pkgsrc/lang/python/application.mk:1.13 Tue Mar 24 04:40:34 2020
+++ pkgsrc/lang/python/application.mk Tue Jun 27 10:31:21 2023
@@ -1,4 +1,4 @@
-# $NetBSD: application.mk,v 1.13 2020/03/24 04:40:34 rillig Exp $
+# $NetBSD: application.mk,v 1.14 2023/06/27 10:31:21 riastradh Exp $
#
# Replace the #! interpreter for Python scripts.
#
@@ -18,6 +18,7 @@
.include "../../lang/python/pyversion.mk"
+# XXX Handle TOOL_PYTHONBIN replacement too.
.if defined(REPLACE_PYTHON)
REPLACE_INTERPRETER+= python
REPLACE.python.old= .*python3\{0,1\}[^ ]*
Index: pkgsrc/lang/python/egg.mk
diff -u pkgsrc/lang/python/egg.mk:1.39 pkgsrc/lang/python/egg.mk:1.40
--- pkgsrc/lang/python/egg.mk:1.39 Tue Sep 6 09:05:59 2022
+++ pkgsrc/lang/python/egg.mk Tue Jun 27 10:31:21 2023
@@ -1,4 +1,4 @@
-# $NetBSD: egg.mk,v 1.39 2022/09/06 09:05:59 nia Exp $
+# $NetBSD: egg.mk,v 1.40 2023/06/27 10:31:21 riastradh Exp $
#
# Common logic to handle Python Eggs
#
@@ -46,7 +46,7 @@ do-build: ensurepip
.PHONY: ensurepip
ensurepip:
- ${SETENV} ${MAKE_ENV} ${PYTHONBIN} -m ensurepip --user
+ ${SETENV} ${MAKE_ENV} ${TOOL_PYTHONBIN} -m ensurepip --user
.else
. if "${PYVERSSUFFIX}" == "2.7"
SETUPTOOLS_PATH=../../devel/py-setuptools44
@@ -62,6 +62,19 @@ DEPENDS+= ${PYPKGPREFIX}-setuptools-[0-9
TOOL_DEPENDS+= ${PYPKGPREFIX}-setuptools-[0-9]*:${SETUPTOOLS_PATH}
.endif
+.if ${USE_CROSS_COMPILE:U:tl} == "yes"
+.if ${PYTHON_FOR_BUILD_ONLY:Uno:tl} == "no" || \
+ ${PYTHON_FOR_BUILD_ONLY:Uno:tl} == "build"
+_COOKIE.pysetupcross= ${WRKDIR}/.pysetupcross_done
+pre-configure: ${_COOKIE.pysetupcross}
+${_COOKIE.pysetupcross}:
+ @${STEP_MSG} "Adjusting Python setup.cfg for cross-compiling"
+ ${RUN} ${PRINTF} "\\n[build]\\nexecutable = '%s'\\n" ${PYTHONBIN:Q} \
+ >>${WRKSRC}/setup.cfg
+ ${RUN} touch $@
+.endif
+.endif
+
INSTALLATION_DIRS+= ${PYSITELIB}
privileged-install-hook: fixup-egg-info
Index: pkgsrc/lang/python/extension.mk
diff -u pkgsrc/lang/python/extension.mk:1.60 pkgsrc/lang/python/extension.mk:1.61
--- pkgsrc/lang/python/extension.mk:1.60 Tue Sep 6 09:05:59 2022
+++ pkgsrc/lang/python/extension.mk Tue Jun 27 10:31:21 2023
@@ -1,4 +1,4 @@
-# $NetBSD: extension.mk,v 1.60 2022/09/06 09:05:59 nia Exp $
+# $NetBSD: extension.mk,v 1.61 2023/06/27 10:31:21 riastradh Exp $
.include "../../lang/python/pyversion.mk"
@@ -20,6 +20,9 @@ PYSETUPBUILDARGS?= # empty
PYSETUPBUILDARGS+= -j${MAKE_JOBS}
. endif
. endif
+. if ${USE_CROSS_COMPILE:U:tl} == "yes"
+PYSETUPBUILDARGS+= --executable=${PYTHONBIN:Q}
+. endif
PYSETUPARGS?= # empty
PYSETUPINSTALLARGS?= # empty
PYSETUPOPTARGS?= -c -O1
@@ -31,17 +34,20 @@ PYSETUPTESTARGS?= # empty
PYSETUPSUBDIR?= # empty
do-build:
- (cd ${WRKSRC}/${PYSETUPSUBDIR} && ${SETENV} ${MAKE_ENV} ${PYTHONBIN} \
- ${PYSETUP} ${PYSETUPARGS} ${PYSETUPBUILDTARGET} ${PYSETUPBUILDARGS})
+ (cd ${WRKSRC}/${PYSETUPSUBDIR} && ${SETENV} ${MAKE_ENV} \
+ ${TOOL_PYTHONBIN} ${PYSETUP} ${PYSETUPARGS} ${PYSETUPBUILDTARGET} \
+ ${PYSETUPBUILDARGS})
do-install:
(cd ${WRKSRC}/${PYSETUPSUBDIR} && ${SETENV} ${INSTALL_ENV} ${MAKE_ENV} \
- ${PYTHONBIN} ${PYSETUP} ${PYSETUPARGS} "install" ${_PYSETUPINSTALLARGS})
+ ${TOOL_PYTHONBIN} ${PYSETUP} ${PYSETUPARGS} "install" \
+ ${_PYSETUPINSTALLARGS})
. if !target(do-test) && !(defined(TEST_TARGET) && !empty(TEST_TARGET))
do-test:
- (cd ${WRKSRC}/${PYSETUPSUBDIR} && ${SETENV} ${TEST_ENV} ${PYTHONBIN} \
- ${PYSETUP} ${PYSETUPARGS} ${PYSETUPTESTTARGET} ${PYSETUPTESTARGS})
+ (cd ${WRKSRC}/${PYSETUPSUBDIR} && ${SETENV} ${TEST_ENV} \
+ ${TOOL_PYTHONBIN} ${PYSETUP} ${PYSETUPARGS} ${PYSETUPTESTTARGET} \
+ ${PYSETUPTESTARGS})
. endif
.endif
@@ -72,6 +78,6 @@ EARLY_PRINT_PLIST_AWK+= gsub(/\.cpython-
DISTUTILS_BUILDDIR_IN_TEST_ENV?= no
.if ${DISTUTILS_BUILDDIR_IN_TEST_ENV} == "yes"
-DISTUTILS_BUILDDIR_CMD= cd ${WRKSRC} && ${PYTHONBIN} ${.CURDIR}/../../lang/python/distutils-builddir.py
+DISTUTILS_BUILDDIR_CMD= cd ${WRKSRC} && ${TOOL_PYTHONBIN} ${.CURDIR}/../../lang/python/distutils-builddir.py
TEST_ENV+= PYTHONPATH=${DISTUTILS_BUILDDIR_CMD:sh}
.endif
Index: pkgsrc/lang/python/pyversion.mk
diff -u pkgsrc/lang/python/pyversion.mk:1.149 pkgsrc/lang/python/pyversion.mk:1.150
--- pkgsrc/lang/python/pyversion.mk:1.149 Wed Jun 14 11:06:46 2023
+++ pkgsrc/lang/python/pyversion.mk Tue Jun 27 10:31:21 2023
@@ -1,4 +1,4 @@
-# $NetBSD: pyversion.mk,v 1.149 2023/06/14 11:06:46 riastradh Exp $
+# $NetBSD: pyversion.mk,v 1.150 2023/06/27 10:31:21 riastradh Exp $
# This file should be included by packages as a way to depend on
# python when none of the other methods are appropriate, e.g. a
@@ -196,19 +196,40 @@ TEST_DEPENDS+= ${PYDEPENDENCY}
BUILDLINK_DEPMETHOD.python?= build
. endif
. include "${PYPKGSRCDIR}/buildlink3.mk"
+. if ${USE_CROSS_COMPILE:U:tl} == "yes"
+TOOL_DEPENDS+= ${PYDEPENDENCY}
+MAKE_ENV+= PYTHONPATH=${WRKDIR:Q}/.pysite:${_CROSS_DESTDIR:Q}${LOCALBASE:Q}/${PYLIB:Q}
+pre-configure: ${WRKDIR}/.pysite/sitecustomize.py
+${WRKDIR}/.pysite/sitecustomize.py:
+ @${STEP_MSG} "Creating Python sitecustomize.py for cross-compiling"
+ ${RUN} ${MKDIR} ${.TARGET:H}
+ ${RUN} ( \
+ ${ECHO} "import sys" && \
+ for v in \
+ sys.base_exec_prefix \
+ sys.base_prefix \
+ sys.exec_prefix \
+ sys.prefix \
+ ; do \
+ ${PRINTF} "%s = '%s'\\n" "$$v" ${LOCALBASE:Q}; \
+ done; \
+ ) >${.TARGET}.tmp
+ ${RUN} ${MV} -f ${.TARGET}.tmp ${.TARGET}
+. endif
. endif
.endif
PYTHONBIN= ${LOCALBASE}/bin/python${PYVERSSUFFIX}
-.if exists(${PYTHONBIN}m)
-PYTHONCONFIG= ${LOCALBASE}/bin/python${PYVERSSUFFIX}m-config
+TOOL_PYTHONBIN= ${TOOLBASE}/bin/python${PYVERSSUFFIX}
+.if exists(${TOOL_PYTHONBIN}m)
+PYTHONCONFIG= ${TOOLBASE}/bin/python${PYVERSSUFFIX}m-config
.else
-PYTHONCONFIG= ${LOCALBASE}/bin/python${PYVERSSUFFIX}-config
+PYTHONCONFIG= ${TOOLBASE}/bin/python${PYVERSSUFFIX}-config
.endif
PY_COMPILE_ALL= \
- ${PYTHONBIN} ${PREFIX}/lib/python${PYVERSSUFFIX}/compileall.py -q
+ ${TOOL_PYTHONBIN} ${PREFIX}/lib/python${PYVERSSUFFIX}/compileall.py -q
PY_COMPILE_O_ALL= \
- ${PYTHONBIN} -O ${PREFIX}/lib/python${PYVERSSUFFIX}/compileall.py -q
+ ${TOOL_PYTHONBIN} -O ${PREFIX}/lib/python${PYVERSSUFFIX}/compileall.py -q
PYINC= include/python${PYVERSSUFFIX}
PYLIB= lib/python${PYVERSSUFFIX}
@@ -221,7 +242,7 @@ PRINT_PLIST_AWK+= /^${PYSITELIB:S|/|\\/|
PRINT_PLIST_AWK+= /^${PYLIB:S|/|\\/|g}/ \
{ gsub(/${PYLIB:S|/|\\/|g}/, "$${PYLIB}") }
-ALL_ENV+= PYTHON=${PYTHONBIN}
+ALL_ENV+= PYTHON=${TOOL_PYTHONBIN}
.if defined(USE_CMAKE) || defined(BUILD_USES_CMAKE)
# used by FindPython
CMAKE_ARGS+= -DPython_EXECUTABLE:FILEPATH=${PYTHONBIN}
@@ -253,7 +274,8 @@ _PKG_VARS.pyversion= \
_SYS_VARS.pyversion= \
PYTHON_VERSION PYTHON_VERSION_REQD PYPACKAGE PYVERSSUFFIX PYPKGSRCDIR \
PYPKGPREFIX PYTHONBIN PYTHONCONFIG PY_COMPILE_ALL \
- PY_COMPILE_O_ALL PYINC PYLIB PYSITELIB CMAKE_ARGS
+ PY_COMPILE_O_ALL PYINC PYLIB PYSITELIB CMAKE_ARGS \
+ TOOL_PYTHONBIN
_USE_VARS.pyversion= \
PKGNAME_REQD PKGNAME_OLD LOCALBASE PREFIX BUILDLINK_DIR PKGNAME
_DEF_VARS.pyversion= \
Index: pkgsrc/lang/python/srcdist.mk
diff -u pkgsrc/lang/python/srcdist.mk:1.42 pkgsrc/lang/python/srcdist.mk:1.43
--- pkgsrc/lang/python/srcdist.mk:1.42 Tue Sep 6 09:05:59 2022
+++ pkgsrc/lang/python/srcdist.mk Tue Jun 27 10:31:21 2023
@@ -1,4 +1,4 @@
-# $NetBSD: srcdist.mk,v 1.42 2022/09/06 09:05:59 nia Exp $
+# $NetBSD: srcdist.mk,v 1.43 2023/06/27 10:31:21 riastradh Exp $
.include "../../lang/python/pyversion.mk"
@@ -15,6 +15,15 @@ WRKSRC= ${WRKDIR}/${PYSUBDIR}
BUILDLINK_API_DEPENDS.${PYPACKAGE}+= ${PYPACKAGE}>=${PY_DISTVERSION}
BUILDLINK_ABI_DEPENDS.${PYPACKAGE}+= ${PYPACKAGE}>=${PY_DISTVERSION}
+.include "../../mk/bsd.prefs.mk"
+
+.if ${USE_CROSS_COMPILE:U:tl} == "yes"
+TOOL_DEPENDS+= ${PYDEPENDENCY}
+DEPENDS+= ${PYDEPENDENCY}
+ALL_ENV+= _PYTHON_PROJECT_BASE=${WRKSRC:Q}
+CPPFLAGS+= -I${LOCALBASE:Q}/${PYINC:Q}
+.endif
+
python-std-patchsetup:
${SED} ${PY_SETUP_SUBST:S/=/@!/:S/$/!g/:S/^/ -e s!@/} \
<${FILESDIR}/setup.py >${WRKSRC}/setup.py
Index: pkgsrc/lang/python/tool.mk
diff -u pkgsrc/lang/python/tool.mk:1.3 pkgsrc/lang/python/tool.mk:1.4
--- pkgsrc/lang/python/tool.mk:1.3 Sun Dec 15 23:59:00 2019
+++ pkgsrc/lang/python/tool.mk Tue Jun 27 10:31:21 2023
@@ -1,4 +1,4 @@
-# $NetBSD: tool.mk,v 1.3 2019/12/15 23:59:00 gutteridge Exp $
+# $NetBSD: tool.mk,v 1.4 2023/06/27 10:31:21 riastradh Exp $
#
# Create `python' interpreter wrapper for applicable Python bin.
#
@@ -22,8 +22,8 @@ buildlink-bin-python:
.for bin in python python${PYVERSSUFFIX:R}
${RUN} \
t=${BUILDLINK_DIR}/bin/${bin}; \
- if ${TEST} -f "${PYTHONBIN}" -a ! -f $$t; then \
- ${LN} -sf "${PYTHONBIN}" $$t; \
+ if ${TEST} -f "${TOOL_PYTHONBIN}" -a ! -f $$t; then \
+ ${LN} -sf "${TOOL_PYTHONBIN}" $$t; \
fi
.endfor
Index: pkgsrc/lang/python/wheel.mk
diff -u pkgsrc/lang/python/wheel.mk:1.7 pkgsrc/lang/python/wheel.mk:1.8
--- pkgsrc/lang/python/wheel.mk:1.7 Sun May 22 19:32:41 2022
+++ pkgsrc/lang/python/wheel.mk Tue Jun 27 10:31:21 2023
@@ -1,4 +1,4 @@
-# $NetBSD: wheel.mk,v 1.7 2022/05/22 19:32:41 kleink Exp $
+# $NetBSD: wheel.mk,v 1.8 2023/06/27 10:31:21 riastradh Exp $
#
# Initial mk for building and installing python wheels
#
@@ -44,7 +44,8 @@ TOOL_DEPENDS+= ${PYPKGPREFIX}-build>=0:.
.if !target(do-build)
do-build:
- ${RUN} cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${PYTHONBIN} -m build --wheel --skip-dependency-check --no-isolation
+ ${RUN} cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${TOOL_PYTHONBIN} \
+ -m build --wheel --skip-dependency-check --no-isolation
.endif
.endif
@@ -77,4 +78,6 @@ INSTALL_ENV+= PIP_NO_CACHEDIR=1
do-install:
${RUN} cd ${WRKDIR} && \
${SETENV} ${INSTALL_ENV} \
- ${PYTHONBIN} -m pip install --no-cache-dir --no-deps --root ${DESTDIR:Q} --prefix ${PREFIX:Q} --compile --force-reinstall -I ${WHEELFILE}
+ ${TOOL_PYTHONBIN} -m pip install --no-cache-dir --no-deps \
+ --root ${DESTDIR:Q} --prefix ${PREFIX:Q} --compile \
+ --force-reinstall -I --executable=${PYTHONBIN:Q} ${WHEELFILE}
Home |
Main Index |
Thread Index |
Old Index