Sun Apr 3 11:54:48 2022 UTC ()
python: Fix cross-build with pkg_resources.

setuptools must still be in TOOL_DEPENDS because we run it during the
build; for pkg_resources it must _also_ be in DEPENDS because the
built package needs it to run.


(riastradh)
diff -r1.36 -r1.37 pkgsrc/lang/python/egg.mk

cvs diff -r1.36 -r1.37 pkgsrc/lang/python/egg.mk (switch to unified diff)

--- pkgsrc/lang/python/egg.mk 2022/02/08 17:19:50 1.36
+++ pkgsrc/lang/python/egg.mk 2022/04/03 11:54:48 1.37
@@ -1,73 +1,72 @@ @@ -1,73 +1,72 @@
1# $NetBSD: egg.mk,v 1.36 2022/02/08 17:19:50 gutteridge Exp $ 1# $NetBSD: egg.mk,v 1.37 2022/04/03 11:54:48 riastradh Exp $
2# 2#
3# Common logic to handle Python Eggs 3# Common logic to handle Python Eggs
4# 4#
5.include "../../mk/bsd.fast.prefs.mk" 5.include "../../mk/bsd.fast.prefs.mk"
6.include "../../lang/python/pyversion.mk" 6.include "../../lang/python/pyversion.mk"
7 7
8# This file should be included to package python "distributions" which 8# This file should be included to package python "distributions" which
9# use setuptools to create an egg. 9# use setuptools to create an egg.
10# 10#
11# For wheel (*.whl) support, look at wheel.mk. 11# For wheel (*.whl) support, look at wheel.mk.
12 12
13EGG_NAME?= ${DISTNAME:C/-([^0-9])/_\1/g} 13EGG_NAME?= ${DISTNAME:C/-([^0-9])/_\1/g}
14EGG_INFODIR?= ${EGG_NAME}-py${PYVERSSUFFIX}.egg-info 14EGG_INFODIR?= ${EGG_NAME}-py${PYVERSSUFFIX}.egg-info
15 15
16PYDISTUTILSPKG= yes 16PYDISTUTILSPKG= yes
17PY_PATCHPLIST= yes 17PY_PATCHPLIST= yes
18 18
19# True eggs always have an egg-info directory. egg.mk can also 19# True eggs always have an egg-info directory. egg.mk can also
20# be used for distutils packages, in which case there will be no 20# be used for distutils packages, in which case there will be no
21# egg-info directory. 21# egg-info directory.
22 22
23# Please note that some packages do not provide this directory 23# Please note that some packages do not provide this directory
24# with the last setuptools version that supports python 2.7. 24# with the last setuptools version that supports python 2.7.
25# In this case, the ${EGG_INFODIR} lines in the PLIST need to 25# In this case, the ${EGG_INFODIR} lines in the PLIST need to
26# be prefixed with ${PLIST.py3x} - please always test with both 26# be prefixed with ${PLIST.py3x} - please always test with both
27# python 2.7 and the current python 3.x default! 27# python 2.7 and the current python 3.x default!
28 28
29PLIST_SUBST+= EGG_NAME=${EGG_NAME}-py${PYVERSSUFFIX} 29PLIST_SUBST+= EGG_NAME=${EGG_NAME}-py${PYVERSSUFFIX}
30PLIST_SUBST+= EGG_INFODIR=${EGG_INFODIR} 30PLIST_SUBST+= EGG_INFODIR=${EGG_INFODIR}
31PRINT_PLIST_AWK+= { gsub(/${EGG_NAME}-py${PYVERSSUFFIX:S,.,\.,g}.egg-info/, \ 31PRINT_PLIST_AWK+= { gsub(/${EGG_NAME}-py${PYVERSSUFFIX:S,.,\.,g}.egg-info/, \
32 "$${EGG_INFODIR}") } 32 "$${EGG_INFODIR}") }
33PRINT_PLIST_AWK+= { gsub(/${EGG_NAME}-py${PYVERSSUFFIX:S,.,\.,g}-nspkg.pth/, \ 33PRINT_PLIST_AWK+= { gsub(/${EGG_NAME}-py${PYVERSSUFFIX:S,.,\.,g}-nspkg.pth/, \
34 "$${EGG_NAME}-nspkg.pth") } 34 "$${EGG_NAME}-nspkg.pth") }
35PRINT_PLIST_AWK+= { gsub(/${PYVERSSUFFIX:S,.,\.,g}/, \ 35PRINT_PLIST_AWK+= { gsub(/${PYVERSSUFFIX:S,.,\.,g}/, \
36 "$${PYVERSSUFFIX}") } 36 "$${PYVERSSUFFIX}") }
37 37
38USE_PKG_RESOURCES?= no 38USE_PKG_RESOURCES?= no
39 39
40# py-setuptools needs to be bootstrapped from python itself, without using 40# py-setuptools needs to be bootstrapped from python itself, without using
41# py-setuptools. 41# py-setuptools.
42BOOTSTRAP_SETUPTOOLS?= no 42BOOTSTRAP_SETUPTOOLS?= no
43.if ${BOOTSTRAP_SETUPTOOLS} == "yes" 43.if ${BOOTSTRAP_SETUPTOOLS} == "yes"
44TOOL_DEPENDS+= ${PYPKGPREFIX}-expat-[0-9]*:../../textproc/py-expat 44TOOL_DEPENDS+= ${PYPKGPREFIX}-expat-[0-9]*:../../textproc/py-expat
45do-build: ensurepip 45do-build: ensurepip
46.PHONY: ensurepip 46.PHONY: ensurepip
47 47
48ensurepip: 48ensurepip:
49 ${SETENV} ${MAKE_ENV} ${PYTHONBIN} -m ensurepip --user 49 ${SETENV} ${MAKE_ENV} ${PYTHONBIN} -m ensurepip --user
50.else 50.else
51. if "${PYVERSSUFFIX}" == "2.7" 51. if "${PYVERSSUFFIX}" == "2.7"
52SETUPTOOLS_PATH=../../devel/py-setuptools44 52SETUPTOOLS_PATH=../../devel/py-setuptools44
53. else 53. else
54SETUPTOOLS_PATH=../../devel/py-setuptools 54SETUPTOOLS_PATH=../../devel/py-setuptools
55. endif 55. endif
56. if "${USE_PKG_RESOURCES}" == "yes" 56. if "${USE_PKG_RESOURCES}" == "yes"
57DEPENDS+= ${PYPKGPREFIX}-setuptools-[0-9]*:${SETUPTOOLS_PATH} 57DEPENDS+= ${PYPKGPREFIX}-setuptools-[0-9]*:${SETUPTOOLS_PATH}
58. else 
59TOOL_DEPENDS+= ${PYPKGPREFIX}-setuptools-[0-9]*:${SETUPTOOLS_PATH} 
60. endif 58. endif
 59TOOL_DEPENDS+= ${PYPKGPREFIX}-setuptools-[0-9]*:${SETUPTOOLS_PATH}
61.endif 60.endif
62 61
63INSTALLATION_DIRS+= ${PYSITELIB} 62INSTALLATION_DIRS+= ${PYSITELIB}
64 63
65privileged-install-hook: fixup-egg-info 64privileged-install-hook: fixup-egg-info
66.PHONY: fixup-egg-info 65.PHONY: fixup-egg-info
67fixup-egg-info: # ensure egg-info directory contents are always 644 66fixup-egg-info: # ensure egg-info directory contents are always 644
68 if ${TEST} -d "${DESTDIR}${PREFIX}/${PYSITELIB}/${EGG_INFODIR}"; then \ 67 if ${TEST} -d "${DESTDIR}${PREFIX}/${PYSITELIB}/${EGG_INFODIR}"; then \
69 ${FIND} ${DESTDIR}${PREFIX}/${PYSITELIB}/${EGG_INFODIR} -type f \ 68 ${FIND} ${DESTDIR}${PREFIX}/${PYSITELIB}/${EGG_INFODIR} -type f \
70 -exec ${CHMOD} ${SHAREMODE} '{}' +; \ 69 -exec ${CHMOD} ${SHAREMODE} '{}' +; \
71 fi 70 fi
72 71
73.include "../../lang/python/extension.mk" 72.include "../../lang/python/extension.mk"