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

1.34    ! wiz         1: # $NetBSD: egg.mk,v 1.33 2022/01/05 15:41:32 wiz Exp $
1.1       joerg       2: #
                      3: # Common logic to handle Python Eggs
                      4: #
1.8       joerg       5: .include "../../mk/bsd.fast.prefs.mk"
1.14      drochner    6: .include "../../lang/python/pyversion.mk"
1.1       joerg       7: 
1.11      gdt         8: # This file should be included to package python "distributions" which
1.13      gdt         9: # use setuptools to create an egg.  Some distributions use distutils,
                     10: # which creates an egg-info file; those should use distutils.mk
1.11      gdt        11: 
1.20      wiz        12: EGG_NAME?=     ${DISTNAME:C/-([^0-9])/_\1/g}
1.18      rodent     13: EGG_INFODIR?=  ${EGG_NAME}-py${PYVERSSUFFIX}.egg-info
1.6       epg        14: 
1.1       joerg      15: PYDISTUTILSPKG=        yes
                     16: PY_PATCHPLIST= yes
                     17: 
1.13      gdt        18: # True eggs always have an egg-info directory, and thus there is no
                     19: # PLIST conditional (as in distutils.mk for old versions of python).
                     20: # Note that we substitute EGG_INFODIR rather than EGG_FILE, because
                     21: # the egg information in an egg comprises multiple files in an
                     22: # egg-info directory.
                     23: 
1.18      rodent     24: # The PLIST substitution of EGG_NAME is not necessary. However, it
                     25: # is convenient. See lang/ruby/gem.mk and PLIST files for ruby gem
                     26: # packages to understand other examples of this feature in non-python
                     27: # packages.
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.27      wiz        40: # py-setuptools depends on a couple py-* packages that need to be installed
                     41: # beforehand. Of course, those can not be built and installed using py-setuptools
                     42: # itself; so use the setuptools version included with python itself for installing
                     43: # them.
                     44: BOOTSTRAP_SETUPTOOLS?= no
                     45: .if ${BOOTSTRAP_SETUPTOOLS} == "yes"
1.32      wiz        46: TOOL_DEPENDS+=         ${PYPKGPREFIX}-expat-[0-9]*:../../textproc/py-expat
1.27      wiz        47: do-build: ensurepip
                     48: .PHONY: ensurepip
                     49: 
                     50: ensurepip:
                     51:        ${SETENV} ${MAKE_ENV} ${PYTHONBIN} -m ensurepip --user
                     52: .else
1.31      gdt        53: .  if "${PYVERSSUFFIX}" == "2.7"
1.33      wiz        54: SETUPTOOLS_PATH=../../devel/py-setuptools44
                     55: .  else
                     56: SETUPTOOLS_PATH=../../devel/py-setuptools
                     57: .  endif
                     58: .  if "${USE_PKG_RESOURCES}" == "yes"
                     59: DEPENDS+=      ${PYPKGPREFIX}-setuptools-[0-9]*:${SETUPTOOLS_PATH}
1.29      wiz        60: .  else
1.33      wiz        61: TOOL_DEPENDS+= ${PYPKGPREFIX}-setuptools-[0-9]*:${SETUPTOOLS_PATH}
1.29      wiz        62: .  endif
1.27      wiz        63: .endif
1.1       joerg      64: 
                     65: INSTALLATION_DIRS+=    ${PYSITELIB}
                     66: 
1.22      richard    67: privileged-install-hook:       fixup-egg-info
                     68: .PHONY:                                fixup-egg-info
                     69: fixup-egg-info:        # ensure egg-info directory contents are always 644
1.23      wiz        70:        if ${TEST} -d "${DESTDIR}${PREFIX}/${PYSITELIB}/${EGG_INFODIR}"; then \
1.22      richard    71:            ${FIND} ${DESTDIR}${PREFIX}/${PYSITELIB}/${EGG_INFODIR} -type f \
1.26      wiz        72:                -exec ${CHMOD} ${SHAREMODE} '{}' +; \
1.23      wiz        73:        fi
1.22      richard    74: 
1.1       joerg      75: .include "../../lang/python/extension.mk"

CVSweb <webmaster@jp.NetBSD.org>