Annotation of pkgsrc/lang/python/egg.mk, revision 1.42
1.42 ! wiz 1: # $NetBSD: egg.mk,v 1.41 2023/10/23 06:35:59 wiz Exp $
! 2: #
! 3: # The method used in this Makefile fragment is obsolete.
! 4: # Please use wheel.mk instead.
! 5:
1.1 joerg 6: #
7: # Common logic to handle Python Eggs
8: #
1.8 joerg 9: .include "../../mk/bsd.fast.prefs.mk"
1.14 drochner 10: .include "../../lang/python/pyversion.mk"
1.1 joerg 11:
1.11 gdt 12:
1.20 wiz 13: EGG_NAME?= ${DISTNAME:C/-([^0-9])/_\1/g}
1.18 rodent 14: EGG_INFODIR?= ${EGG_NAME}-py${PYVERSSUFFIX}.egg-info
1.6 epg 15:
1.39 nia 16: PYDISTUTILSPKG?= yes
17: PY_PATCHPLIST?= yes
1.1 joerg 18:
1.36 gutterid 19: # True eggs always have an egg-info directory. egg.mk can also
1.35 wiz 20: # be used for distutils packages, in which case there will be no
1.13 gdt 21: # egg-info directory.
22:
1.35 wiz 23: # Please note that some packages do not provide this directory
24: # with the last setuptools version that supports python 2.7.
25: # In this case, the ${EGG_INFODIR} lines in the PLIST need to
26: # be prefixed with ${PLIST.py3x} - please always test with both
27: # python 2.7 and the current python 3.x default!
1.13 gdt 28:
1.2 joerg 29: PLIST_SUBST+= EGG_NAME=${EGG_NAME}-py${PYVERSSUFFIX}
1.18 rodent 30: PLIST_SUBST+= EGG_INFODIR=${EGG_INFODIR}
1.28 rillig 31: PRINT_PLIST_AWK+= { gsub(/${EGG_NAME}-py${PYVERSSUFFIX:S,.,\.,g}.egg-info/, \
1.5 epg 32: "$${EGG_INFODIR}") }
1.28 rillig 33: PRINT_PLIST_AWK+= { gsub(/${EGG_NAME}-py${PYVERSSUFFIX:S,.,\.,g}-nspkg.pth/, \
1.5 epg 34: "$${EGG_NAME}-nspkg.pth") }
1.28 rillig 35: PRINT_PLIST_AWK+= { gsub(/${PYVERSSUFFIX:S,.,\.,g}/, \
1.24 richard 36: "$${PYVERSSUFFIX}") }
1.1 joerg 37:
1.33 wiz 38: USE_PKG_RESOURCES?= no
39:
1.35 wiz 40: # py-setuptools needs to be bootstrapped from python itself, without using
41: # py-setuptools.
1.27 wiz 42: BOOTSTRAP_SETUPTOOLS?= no
43: .if ${BOOTSTRAP_SETUPTOOLS} == "yes"
44: do-build: ensurepip
45: .PHONY: ensurepip
1.41 wiz 46: .include "../../lang/python/batteries-included.mk"
1.27 wiz 47:
48: ensurepip:
1.40 riastrad 49: ${SETENV} ${MAKE_ENV} ${TOOL_PYTHONBIN} -m ensurepip --user
1.27 wiz 50: .else
1.31 gdt 51: . if "${PYVERSSUFFIX}" == "2.7"
1.33 wiz 52: SETUPTOOLS_PATH=../../devel/py-setuptools44
53: . else
54: SETUPTOOLS_PATH=../../devel/py-setuptools
55: . endif
56: . if "${USE_PKG_RESOURCES}" == "yes"
1.38 wiz 57: # when packages use pkg_resources, setuptools is needed at runtime
1.33 wiz 58: DEPENDS+= ${PYPKGPREFIX}-setuptools-[0-9]*:${SETUPTOOLS_PATH}
1.37 riastrad 59: . endif
1.38 wiz 60: # in all cases (in particular, for cross-compilation), setuptools
61: # also needs to be a tool dependency
1.33 wiz 62: TOOL_DEPENDS+= ${PYPKGPREFIX}-setuptools-[0-9]*:${SETUPTOOLS_PATH}
1.27 wiz 63: .endif
1.1 joerg 64:
1.40 riastrad 65: .if ${USE_CROSS_COMPILE:U:tl} == "yes"
66: .if ${PYTHON_FOR_BUILD_ONLY:Uno:tl} == "no" || \
67: ${PYTHON_FOR_BUILD_ONLY:Uno:tl} == "build"
68: _COOKIE.pysetupcross= ${WRKDIR}/.pysetupcross_done
69: pre-configure: ${_COOKIE.pysetupcross}
70: ${_COOKIE.pysetupcross}:
71: @${STEP_MSG} "Adjusting Python setup.cfg for cross-compiling"
72: ${RUN} ${PRINTF} "\\n[build]\\nexecutable = '%s'\\n" ${PYTHONBIN:Q} \
73: >>${WRKSRC}/setup.cfg
74: ${RUN} touch $@
75: .endif
76: .endif
77:
1.1 joerg 78: INSTALLATION_DIRS+= ${PYSITELIB}
79:
1.22 richard 80: privileged-install-hook: fixup-egg-info
81: .PHONY: fixup-egg-info
82: fixup-egg-info: # ensure egg-info directory contents are always 644
1.23 wiz 83: if ${TEST} -d "${DESTDIR}${PREFIX}/${PYSITELIB}/${EGG_INFODIR}"; then \
1.22 richard 84: ${FIND} ${DESTDIR}${PREFIX}/${PYSITELIB}/${EGG_INFODIR} -type f \
1.26 wiz 85: -exec ${CHMOD} ${SHAREMODE} '{}' +; \
1.23 wiz 86: fi
1.22 richard 87:
1.1 joerg 88: .include "../../lang/python/extension.mk"
CVSweb <webmaster@jp.NetBSD.org>