1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-01 05:45:45 +00:00

add devel/py-backports - namespace shim for Python backports

Currently, all py-backports.* ports conflict with each other
over a file that has the same contents.

This creates a port that installs the shared file and py-backports.*
ports should depend on this one and remove the shared file from their
own pkg-plist. It's the same approach as the one taken by OpenBSD.

Some ports are already converted as an example:
- security/py-backports.ssl_match_hostname
- devel/py-backports.functools_lru_cache
- devel/py-backports.shutil_get_terminal_size

The last two conversions and the fix to work with FLAVORS were submitted
by antoine. Thank you!

Reviewed by:	antoine
Approved by:	portmgr (antoine)
Differential Revision:	https://reviews.freebsd.org/D11095
This commit is contained in:
Nikolai Lifanov 2017-12-05 15:00:03 +00:00
parent 3bb5c20246
commit 1ff674eb16
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=455585
6 changed files with 81 additions and 0 deletions

View File

@ -4263,6 +4263,7 @@
SUBDIR += py-avro
SUBDIR += py-babel
SUBDIR += py-babelfish
SUBDIR += py-backports
SUBDIR += py-backports.csv
SUBDIR += py-backports.functools_lru_cache
SUBDIR += py-backports.shutil_get_terminal_size

View File

@ -2,6 +2,7 @@
PORTNAME= backports.functools_lru_cache
PORTVERSION= 1.4
PORTREVISION= 1
CATEGORIES= devel python
MASTER_SITES= CHEESESHOP
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
@ -12,9 +13,20 @@ COMMENT= Backport of functools.lru_cache from Python 3.3
LICENSE= MIT
BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}setuptools_scm>=1.15.0:devel/py-setuptools_scm@${FLAVOR}
RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}backports>0:devel/py-backports@${FLAVOR}
NO_ARCH= yes
USE_PYTHON= autoplist distutils
USES= python:2.7
POST_PLIST= trim-backports-namespace
post-install:
@${RM} ${STAGEDIR}${PYTHON_SITELIBDIR}/backports/__init__.py*
@${RM} -r ${STAGEDIR}${PYTHON_SITELIBDIR}/backports/__pycache__
trim-backports-namespace:
@${REINPLACE_CMD} '/backports\/__init__.py*/d' ${TMPPLIST}
@${REINPLACE_CMD} '/backports\/__pycache__*/d' ${TMPPLIST}
.include <bsd.port.mk>

View File

@ -2,6 +2,7 @@
PORTNAME= backports.shutil_get_terminal_size
PORTVERSION= 1.0.0
PORTREVISION= 1
CATEGORIES= devel python
MASTER_SITES= CHEESESHOP
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
@ -11,7 +12,19 @@ COMMENT= Backport of the get_terminal_size function from Python 3.3's shutil
LICENSE= PSFL
RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}backports>0:devel/py-backports@${FLAVOR}
USES= python
USE_PYTHON= autoplist distutils
POST_PLIST= trim-backports-namespace
post-install:
@${RM} ${STAGEDIR}${PYTHON_SITELIBDIR}/backports/__init__.py*
@${RM} -r ${STAGEDIR}${PYTHON_SITELIBDIR}/backports/__pycache__
trim-backports-namespace:
@${REINPLACE_CMD} '/backports\/__init__.py*/d' ${TMPPLIST}
@${REINPLACE_CMD} '/backports\/__pycache__*/d' ${TMPPLIST}
.include <bsd.port.mk>

View File

@ -0,0 +1,38 @@
# $FreeBSD$
PORTNAME= backports
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
PORTVERSION= 1
CATEGORIES= devel python
DISTFILES=
MAINTAINER= lifanov@FreeBSD.org
COMMENT= Shared namespace shim for py-backports.* ports
LICENSE= MIT
NO_FETCH= yes
NO_BUILD= yes
NO_ARCH= yes
USES= python
USE_PYTHON= flavors
.include <bsd.port.pre.mk>
.if ${PYTHON_MAJOR_VER} == 2
PLIST_FILES= ${PYTHON_SITELIBDIR}/backports/__init__.py \
${PYTHON_SITELIBDIR}/backports/__init__.pyc \
${PYTHON_SITELIBDIR}/backports/__init__.${PYTHON_PYOEXTENSION}
.else
PLIST_FILES= ${PYTHON_SITELIBDIR}/backports/__init__.py \
${PYTHON_SITELIBDIR}/backports/__pycache__/__init__.cpython-${PYTHON_SUFFIX}.pyc \
${PYTHON_SITELIBDIR}/backports/__pycache__/__init__.cpython-${PYTHON_SUFFIX}.${PYTHON_PYOEXTENSION}
.endif
do-install:
${MKDIR} ${STAGEDIR}${PYTHON_SITELIBDIR}/backports
${ECHO_CMD} "__path__ = __import__('pkgutil').extend_path(__path__, __name__)" > ${STAGEDIR}${PYTHON_SITELIBDIR}/backports/__init__.py
${PYTHON_CMD} -m compileall -d ${PYTHON_SITELIBDIR} ${STAGEDIR}${PYTHON_SITELIBDIR}
${PYTHON_CMD} -O -m compileall -d ${PYTHON_SITELIBDIR} ${STAGEDIR}${PYTHON_SITELIBDIR}
.include <bsd.port.post.mk>

View File

@ -0,0 +1,4 @@
shared namespace shim for py-backports.* ports
py-backports provides a common backports/__init__.py,
which is shared among all py-backports.* ports.

View File

@ -2,6 +2,7 @@
PORTNAME= backports.ssl_match_hostname
PORTVERSION= 3.5.0.1
PORTREVISION= 1
CATEGORIES= security python
MASTER_SITES= CHEESESHOP
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
@ -11,7 +12,19 @@ COMMENT= Backport of the ssl_match_hostname function from Python 3.5
LICENSE= PSFL
RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}backports>0:devel/py-backports@${FLAVOR}
USES= python:-3.4
USE_PYTHON= autoplist distutils
POST_PLIST= trim-backports-namespace
post-install:
@${RM} ${STAGEDIR}${PYTHON_SITELIBDIR}/backports/__init__.py*
@${RM} -r ${STAGEDIR}${PYTHON_SITELIBDIR}/backports/__pycache__
trim-backports-namespace:
@${REINPLACE_CMD} '/backports\/__init__.py*/d' ${TMPPLIST}
@${REINPLACE_CMD} '/backports\/__pycache__*/d' ${TMPPLIST}
.include <bsd.port.mk>