Annotation of pkgsrc/lang/python/wheel.mk, revision 1.15

1.15    ! gdt         1: # $NetBSD: wheel.mk,v 1.14 2024/01/23 19:59:25 adam Exp $
1.1       nros        2: #
1.10      wiz         3: # Build and install Python wheels
1.1       nros        4: #
1.15    ! gdt         5: # PEP-518 defines how packages specify their build system
        !             6: # requirements, via the build section in pyproject.toml.  The default
        !             7: # in the PEP (used when the build section is not present) is
        !             8: # setuptools and wheel, but setuptools as of 70.1 has enough wheel
        !             9: # functionality that wheel is not required.  Some packages use
        !            10: # different build systems, e.g. flit.
        !            11: #
        !            12: # wheel.mk does not look for and parse pyproject.toml, and does not
        !            13: # support variables to declare the needed tools.  Therefore, packages
        !            14: # including wheel.mk must TOOL_DEPENDS on the needed build tools.
        !            15: # A typical package will need:
        !            16: #   TOOL_DEPENDS+=  ${PYPKGPREFIX}-setuptools>=70.1:../../devel/py-setuptools
        !            17: 
1.1       nros       18: # Variables:
1.10      wiz        19: #
1.1       nros       20: # WHEELFILE:           path to the wheelfile to be installed
                     21: #                      only needs to be set if do-build is redefined
                     22: #
1.11      wiz        23: # USE_PYTEST:          If set to yes, depend on py-test and use it for testing.
                     24: #                      Default: yes
                     25: #
1.12      thor       26: # WHEEL_ARGS:          additional arguments to pass during build of the wheel
1.1       nros       27: 
1.10      wiz        28: PY_PATCHPLIST?=        yes
1.14      adam       29: PYSETUPSUBDIR?=        # empty
1.1       nros       30: 
1.14      adam       31: WHEELFILE?=    ${WRKSRC}/${PYSETUPSUBDIR}/dist/*.whl
1.10      wiz        32: WHEEL_NAME?=   ${DISTNAME:C/-([^0-9])/_\1/g}
                     33: _WHEEL_INFODIR=        ${WHEEL_NAME}.dist-info
                     34: PLIST_SUBST+=  WHEEL_INFODIR=${_WHEEL_INFODIR}
1.12      thor       35: WHEEL_ARGS?=   # empty
1.1       nros       36: 
1.10      wiz        37: PRINT_PLIST_AWK+=      { gsub(/${_WHEEL_INFODIR:S,.,\.,g}/, "$${WHEEL_INFODIR}") }
1.1       nros       38: 
1.10      wiz        39: .if !target(do-build)
1.1       nros       40: TOOL_DEPENDS+= ${PYPKGPREFIX}-build>=0:../../devel/py-build
                     41: do-build:
1.14      adam       42:        ${RUN} cd ${WRKSRC}/${PYSETUPSUBDIR} && \
                     43:        ${SETENV} ${MAKE_ENV} ${TOOL_PYTHONBIN} \
                     44:                -m build --wheel --skip-dependency-check --no-isolation ${WHEEL_ARGS}
1.1       nros       45: .endif
                     46: 
1.10      wiz        47: .if !target(do-install)
                     48: TOOL_DEPENDS+= ${PYPKGPREFIX}-installer>=0.7.0nb1:../../misc/py-installer
                     49: do-install:
1.14      adam       50:        ${RUN} cd ${WRKSRC}/${PYSETUPSUBDIR} && \
                     51:        ${SETENV} ${INSTALL_ENV} ${TOOL_PYTHONBIN} \
                     52:                -m installer --destdir ${DESTDIR:Q} --prefix ${PREFIX:Q} ${WHEELFILE}
1.1       nros       53: .endif
                     54: 
1.11      wiz        55: USE_PYTEST?=   yes
                     56: .if !target(do-test) && ${USE_PYTEST:Myes}
                     57: TEST_DEPENDS+= ${PYPKGPREFIX}-test-[0-9]*:../../devel/py-test
                     58: do-test:
1.14      adam       59:        ${RUN} cd ${WRKSRC}/${PYSETUPSUBDIR} && \
                     60:        ${SETENV} ${TEST_ENV} pytest-${PYVERSSUFFIX}
1.11      wiz        61: .endif
                     62: 
1.10      wiz        63: .include "../../lang/python/extension.mk"

CVSweb <webmaster@jp.NetBSD.org>