pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/lang/python Add lang/python/wheel.mk to support python...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d1e9caa97db4
branches:  trunk
changeset: 371677:d1e9caa97db4
user:      nros <nros%pkgsrc.org@localhost>
date:      Tue Jan 11 21:37:06 2022 +0000

description:
Add lang/python/wheel.mk to support python packages using pep517(pyproject.toml)

support using pep517 and pep518 style building in python packages.

diffstat:

 lang/python/wheel.mk |  64 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 64 insertions(+), 0 deletions(-)

diffs (68 lines):

diff -r 8036d5f95431 -r d1e9caa97db4 lang/python/wheel.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python/wheel.mk      Tue Jan 11 21:37:06 2022 +0000
@@ -0,0 +1,64 @@
+# $NetBSD: wheel.mk,v 1.1 2022/01/11 21:37:06 nros Exp $
+#
+# Initial mk for building and installing python wheels
+#
+# Variables:
+# 
+# WHEELFILE:           path to the wheelfile to be installed
+#                      only needs to be set if do-build is redefined
+#
+# MASTER_SITE_WHEEL:   master site to grab wheels directly 
+#                      use like ${MASTER_SITE_WHEEL:=project/}
+#                      uses debian pypi redirector so that there
+#                      is no need for hashes in urls.
+#
+# TODO:                fix BUILDDIR support
+#                      
+# Feel free to contribute to this file
+#                      
+
+.include "../../lang/python/pyversion.mk"
+
+TOOL_DEPENDS+= ${PYPKGPREFIX}-pip>=0:../../devel/py-pip
+
+WHEELFILE?= ${WRKSRC}/dist/*.whl
+
+.if defined(NO_BUILD)
+
+MASTER_SITE_WHEEL= https://pypi.debian.net/
+
+WHEELFILE= ${DISTFILES}
+
+.for i in 2 3
+.if !empty(_PYTHON_VERSIONS_ACCEPTED:M${i}*)
+PYMAJORVERSIONS+= py${i}
+.endif
+.endfor
+
+EXTRACT_SUFX= -${PYMAJORVERSIONS:ts.}-none-any.whl
+
+.else
+#we need to build a wheel
+
+TOOL_DEPENDS+= ${PYPKGPREFIX}-build>=0:../../devel/py-build
+
+.if !target(do-build)
+do-build:
+       ${RUN} cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${PYTHONBIN} -m build --wheel -x -n
+.endif
+
+.endif
+
+WHEEL_NAME?=   ${DISTNAME:C/-([^0-9])/_\1/g}
+_WHEEL_INFODIR=        ${WHEEL_NAME}.dist-info
+PLIST_SUBST+=  PYSITELIB=${PYSITELIB}
+PLIST_SUBST+=  WHEEL_INFODIR=${_WHEEL_INFODIR}
+
+PRINT_PLIST_AWK+=      { gsub(/${_WHEEL_INFODIR:S,.,\.,g}/, "$${WHEEL_INFODIR}") }
+
+INSTALL_ENV+= PIP_NO_CACHEDIR=1
+
+do-install:
+       ${RUN} cd ${WRKDIR} && \
+       ${SETENV} ${INSTALL_ENV} \
+       ${PYTHONBIN} -m pip install --no-deps --root ${DESTDIR:Q} --prefix ${PREFIX:Q} --compile --force-reinstall -I ${WHEELFILE}



Home | Main Index | Thread Index | Old Index