pkgsrc-WIP-changes archive

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

Add python/wheel.mk to support building and installing wheels



Module Name:	pkgsrc-wip
Committed By:	Niclas Rosenvik <nros%pkgsrc.org@localhost>
Pushed By:	nros
Date:		Fri Dec 17 10:33:10 2021 +0100
Changeset:	e8d0ba4cb08c8a4075a171c671a97fe44b111d89

Added Files:
	python/wheel.mk

Log Message:
Add python/wheel.mk to support building and installing wheels

Add python/wheel.mk to support building and installing wheels.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=e8d0ba4cb08c8a4075a171c671a97fe44b111d89

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 python/wheel.mk | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diffs:
diff --git a/python/wheel.mk b/python/wheel.mk
new file mode 100644
index 0000000000..69f3107c9b
--- /dev/null
+++ b/python/wheel.mk
@@ -0,0 +1,59 @@
+# $NetBSD$
+#
+# 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 contibute 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
+
+PLIST_SUBST+= PYSITELIB=${PYSITELIB}
+
+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