Annotation of pkgsrc/lang/python/egg.mk, revision 1.46

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

CVSweb <webmaster@jp.NetBSD.org>