diff options
author | rodent <rodent@pkgsrc.org> | 2015-07-01 00:55:34 +0000 |
---|---|---|
committer | rodent <rodent@pkgsrc.org> | 2015-07-01 00:55:34 +0000 |
commit | bfcb52c085b69700ac7d66ae35ae0c9203d9ee22 (patch) | |
tree | 44924348de9eed818330fe522466f5cc7e1ba0e9 /mk | |
parent | da3f98cd67d36201aef68ff66259db38d6536b9a (diff) | |
download | pkgsrc-bfcb52c085b69700ac7d66ae35ae0c9203d9ee22.tar.gz |
Add support for Python Package Index (pypi) master site handling.
This is commented for now in bsd.fetch.mk pending 48 hours of feedback on
tech-pkg@.
Diffstat (limited to 'mk')
-rw-r--r-- | mk/fetch/bsd.fetch.mk | 4 | ||||
-rw-r--r-- | mk/fetch/pypi.mk | 41 |
2 files changed, 43 insertions, 2 deletions
diff --git a/mk/fetch/bsd.fetch.mk b/mk/fetch/bsd.fetch.mk index c4b305f5b0c..462eb3d6591 100644 --- a/mk/fetch/bsd.fetch.mk +++ b/mk/fetch/bsd.fetch.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.fetch.mk,v 1.8 2015/03/07 14:17:52 tnn Exp $ +# $NetBSD: bsd.fetch.mk,v 1.9 2015/07/01 00:55:34 rodent Exp $ # # This Makefile fragment is included by bsd.pkg.mk and defines the # relevant variables and targets for the "fetch" step. @@ -39,4 +39,4 @@ .include "fetch-list.mk" .include "distclean.mk" .include "github.mk" - +#.include "pypi.mk" diff --git a/mk/fetch/pypi.mk b/mk/fetch/pypi.mk new file mode 100644 index 00000000000..d86bdd0725e --- /dev/null +++ b/mk/fetch/pypi.mk @@ -0,0 +1,41 @@ +# $NetBSD: pypi.mk,v 1.1 2015/07/01 00:55:34 rodent Exp $ +# +# pypi.python.org master site handling +# +# To use, set in the pkgsrc Makefile: +# +# DISTNAME= pyfoo-1.0.0 +# MASTER_SITES= ${MASTER_SITE_PYPI} +# +# Then, PKGNAME and HOMEPAGE will be set automatically (can be overridden). +# +# Keywords: pypi python + +.if defined(MASTER_SITES) && !empty(MASTER_SITES:C,^https:\/\/pypi.python.org\/packages\/source\/$,match,:Mmatch) +_USE_PYPI= YES +.endif + +.if defined(_USE_PYPI) && !defined(DISTNAME) +PKG_FAIL_REASON+= "DISTNAME must be set when MASTER_SITES = MASTER_SITE_PYPI." +.endif + +.if defined(_USE_PYPI) && !empty(_USE_PYPI:MYES) +_PYPI_DEFAULT_DISTFILES= ${DISTNAME}${EXTRACT_SUFX} + +# For: https://pypi.python.org/packages/source/p/pyfoo/ +_PYPI_PACKAGE_PATH= ${DISTNAME:S/-${PKGVERSION_NOREV}//1} + +# For: https://pypi.python.org/packages/source/p/ +_PYPI_PATH_INDEX= ${_PYPI_PACKAGE_PATH:C/^([[:alnum:]]{1}).*$/\1/1} + +SITES.${_PYPI_DEFAULT_DISTFILES}= ${MASTER_SITES:=${_PYPI_PATH_INDEX}/${_PYPI_PACKAGE_PATH}/} + +# Lets us override PKGNAME in the pkgsrc Makefile if necessary. +# No need to sacrifice convenience otherwise. +.if defined(PKGNAME) && ${PKGNAME} == ${DISTNAME} +PKGNAME= ${PYPKGPREFIX}-${DISTNAME} +.endif + +# Makes: https://pypi.python.org/pypi/pyfoo/1.0.0 and saves an HTTP redirect. +HOMEPAGE?= https://pypi.python.org/pypi/${_PYPI_PACKAGE_PATH}/${PKGVERSION_NOREV} +.endif |