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

1.45    ! riastrad    1: # $NetBSD: egg.mk,v 1.44 2024/09/17 16:57:10 wiz 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.35      wiz        43: # py-setuptools needs to be bootstrapped from python itself, without using
                     44: # py-setuptools.
1.27      wiz        45: BOOTSTRAP_SETUPTOOLS?= no
                     46: .if ${BOOTSTRAP_SETUPTOOLS} == "yes"
                     47: do-build: ensurepip
                     48: .PHONY: ensurepip
1.41      wiz        49: .include "../../lang/python/batteries-included.mk"
1.27      wiz        50: 
                     51: ensurepip:
1.40      riastrad   52:        ${SETENV} ${MAKE_ENV} ${TOOL_PYTHONBIN} -m ensurepip --user
1.27      wiz        53: .else
1.31      gdt        54: .  if "${PYVERSSUFFIX}" == "2.7"
1.33      wiz        55: SETUPTOOLS_PATH=../../devel/py-setuptools44
                     56: .  else
                     57: SETUPTOOLS_PATH=../../devel/py-setuptools
                     58: .  endif
                     59: .  if "${USE_PKG_RESOURCES}" == "yes"
1.38      wiz        60: # when packages use pkg_resources, setuptools is needed at runtime
1.33      wiz        61: DEPENDS+=      ${PYPKGPREFIX}-setuptools-[0-9]*:${SETUPTOOLS_PATH}
1.37      riastrad   62: .  endif
1.38      wiz        63: # in all cases (in particular, for cross-compilation), setuptools
                     64: # also needs to be a tool dependency
1.33      wiz        65: TOOL_DEPENDS+= ${PYPKGPREFIX}-setuptools-[0-9]*:${SETUPTOOLS_PATH}
1.27      wiz        66: .endif
1.1       joerg      67: 
1.45    ! riastrad   68: .if ${USE_CROSS_COMPILE:tl} == "yes"
1.40      riastrad   69: .if ${PYTHON_FOR_BUILD_ONLY:Uno:tl} == "no" || \
                     70:     ${PYTHON_FOR_BUILD_ONLY:Uno:tl} == "build"
                     71: _COOKIE.pysetupcross=  ${WRKDIR}/.pysetupcross_done
                     72: pre-configure: ${_COOKIE.pysetupcross}
                     73: ${_COOKIE.pysetupcross}:
                     74:        @${STEP_MSG} "Adjusting Python setup.cfg for cross-compiling"
                     75:        ${RUN} ${PRINTF} "\\n[build]\\nexecutable = '%s'\\n" ${PYTHONBIN:Q} \
                     76:                >>${WRKSRC}/setup.cfg
                     77:        ${RUN} touch $@
                     78: .endif
                     79: .endif
                     80: 
1.1       joerg      81: INSTALLATION_DIRS+=    ${PYSITELIB}
                     82: 
1.22      richard    83: privileged-install-hook:       fixup-egg-info
                     84: .PHONY:                                fixup-egg-info
                     85: fixup-egg-info:        # ensure egg-info directory contents are always 644
1.23      wiz        86:        if ${TEST} -d "${DESTDIR}${PREFIX}/${PYSITELIB}/${EGG_INFODIR}"; then \
1.22      richard    87:            ${FIND} ${DESTDIR}${PREFIX}/${PYSITELIB}/${EGG_INFODIR} -type f \
1.43      nia        88:                -exec ${CHMOD} ${SHAREMODE} '{}' ';' ; \
1.23      wiz        89:        fi
1.22      richard    90: 
1.1       joerg      91: .include "../../lang/python/extension.mk"

CVSweb <webmaster@jp.NetBSD.org>