| @@ -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 | |
13 | EGG_NAME?= ${DISTNAME:C/-([^0-9])/_\1/g} | | 13 | EGG_NAME?= ${DISTNAME:C/-([^0-9])/_\1/g} |
14 | EGG_INFODIR?= ${EGG_NAME}-py${PYVERSSUFFIX}.egg-info | | 14 | EGG_INFODIR?= ${EGG_NAME}-py${PYVERSSUFFIX}.egg-info |
15 | | | 15 | |
16 | PYDISTUTILSPKG= yes | | 16 | PYDISTUTILSPKG= yes |
17 | PY_PATCHPLIST= yes | | 17 | PY_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 | |
29 | PLIST_SUBST+= EGG_NAME=${EGG_NAME}-py${PYVERSSUFFIX} | | 29 | PLIST_SUBST+= EGG_NAME=${EGG_NAME}-py${PYVERSSUFFIX} |
30 | PLIST_SUBST+= EGG_INFODIR=${EGG_INFODIR} | | 30 | PLIST_SUBST+= EGG_INFODIR=${EGG_INFODIR} |
31 | PRINT_PLIST_AWK+= { gsub(/${EGG_NAME}-py${PYVERSSUFFIX:S,.,\.,g}.egg-info/, \ | | 31 | PRINT_PLIST_AWK+= { gsub(/${EGG_NAME}-py${PYVERSSUFFIX:S,.,\.,g}.egg-info/, \ |
32 | "$${EGG_INFODIR}") } | | 32 | "$${EGG_INFODIR}") } |
33 | PRINT_PLIST_AWK+= { gsub(/${EGG_NAME}-py${PYVERSSUFFIX:S,.,\.,g}-nspkg.pth/, \ | | 33 | PRINT_PLIST_AWK+= { gsub(/${EGG_NAME}-py${PYVERSSUFFIX:S,.,\.,g}-nspkg.pth/, \ |
34 | "$${EGG_NAME}-nspkg.pth") } | | 34 | "$${EGG_NAME}-nspkg.pth") } |
35 | PRINT_PLIST_AWK+= { gsub(/${PYVERSSUFFIX:S,.,\.,g}/, \ | | 35 | PRINT_PLIST_AWK+= { gsub(/${PYVERSSUFFIX:S,.,\.,g}/, \ |
36 | "$${PYVERSSUFFIX}") } | | 36 | "$${PYVERSSUFFIX}") } |
37 | | | 37 | |
38 | USE_PKG_RESOURCES?= no | | 38 | USE_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. |
42 | BOOTSTRAP_SETUPTOOLS?= no | | 42 | BOOTSTRAP_SETUPTOOLS?= no |
43 | .if ${BOOTSTRAP_SETUPTOOLS} == "yes" | | 43 | .if ${BOOTSTRAP_SETUPTOOLS} == "yes" |
44 | TOOL_DEPENDS+= ${PYPKGPREFIX}-expat-[0-9]*:../../textproc/py-expat | | 44 | TOOL_DEPENDS+= ${PYPKGPREFIX}-expat-[0-9]*:../../textproc/py-expat |
45 | do-build: ensurepip | | 45 | do-build: ensurepip |
46 | .PHONY: ensurepip | | 46 | .PHONY: ensurepip |
47 | | | 47 | |
48 | ensurepip: | | 48 | ensurepip: |
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" |
52 | SETUPTOOLS_PATH=../../devel/py-setuptools44 | | 52 | SETUPTOOLS_PATH=../../devel/py-setuptools44 |
53 | . else | | 53 | . else |
54 | SETUPTOOLS_PATH=../../devel/py-setuptools | | 54 | SETUPTOOLS_PATH=../../devel/py-setuptools |
55 | . endif | | 55 | . endif |
56 | . if "${USE_PKG_RESOURCES}" == "yes" | | 56 | . if "${USE_PKG_RESOURCES}" == "yes" |
57 | DEPENDS+= ${PYPKGPREFIX}-setuptools-[0-9]*:${SETUPTOOLS_PATH} | | 57 | DEPENDS+= ${PYPKGPREFIX}-setuptools-[0-9]*:${SETUPTOOLS_PATH} |
58 | . else | | | |
59 | TOOL_DEPENDS+= ${PYPKGPREFIX}-setuptools-[0-9]*:${SETUPTOOLS_PATH} | | | |
60 | . endif | | 58 | . endif |
| | | 59 | TOOL_DEPENDS+= ${PYPKGPREFIX}-setuptools-[0-9]*:${SETUPTOOLS_PATH} |
61 | .endif | | 60 | .endif |
62 | | | 61 | |
63 | INSTALLATION_DIRS+= ${PYSITELIB} | | 62 | INSTALLATION_DIRS+= ${PYSITELIB} |
64 | | | 63 | |
65 | privileged-install-hook: fixup-egg-info | | 64 | privileged-install-hook: fixup-egg-info |
66 | .PHONY: fixup-egg-info | | 65 | .PHONY: fixup-egg-info |
67 | fixup-egg-info: # ensure egg-info directory contents are always 644 | | 66 | fixup-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" |