Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Dec 2017 15:00:04 +0000 (UTC)
From:      Nikolai Lifanov <lifanov@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r455585 - in head: devel devel/py-backports devel/py-backports.functools_lru_cache devel/py-backports.shutil_get_terminal_size security/py-backports.ssl_match_hostname
Message-ID:  <201712051500.vB5F04CR051076@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: lifanov
Date: Tue Dec  5 15:00:03 2017
New Revision: 455585
URL: https://svnweb.freebsd.org/changeset/ports/455585

Log:
  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

Added:
  head/devel/py-backports/
  head/devel/py-backports/Makefile   (contents, props changed)
  head/devel/py-backports/pkg-descr   (contents, props changed)
Modified:
  head/devel/Makefile
  head/devel/py-backports.functools_lru_cache/Makefile
  head/devel/py-backports.shutil_get_terminal_size/Makefile
  head/security/py-backports.ssl_match_hostname/Makefile

Modified: head/devel/Makefile
==============================================================================
--- head/devel/Makefile	Tue Dec  5 14:01:12 2017	(r455584)
+++ head/devel/Makefile	Tue Dec  5 15:00:03 2017	(r455585)
@@ -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

Modified: head/devel/py-backports.functools_lru_cache/Makefile
==============================================================================
--- head/devel/py-backports.functools_lru_cache/Makefile	Tue Dec  5 14:01:12 2017	(r455584)
+++ head/devel/py-backports.functools_lru_cache/Makefile	Tue Dec  5 15:00:03 2017	(r455585)
@@ -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
 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>

Modified: head/devel/py-backports.shutil_get_terminal_size/Makefile
==============================================================================
--- head/devel/py-backports.shutil_get_terminal_size/Makefile	Tue Dec  5 14:01:12 2017	(r455584)
+++ head/devel/py-backports.shutil_get_terminal_size/Makefile	Tue Dec  5 15:00:03 2017	(r455585)
@@ -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 fr
 
 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>

Added: head/devel/py-backports/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/py-backports/Makefile	Tue Dec  5 15:00:03 2017	(r455585)
@@ -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>

Added: head/devel/py-backports/pkg-descr
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/py-backports/pkg-descr	Tue Dec  5 15:00:03 2017	(r455585)
@@ -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.

Modified: head/security/py-backports.ssl_match_hostname/Makefile
==============================================================================
--- head/security/py-backports.ssl_match_hostname/Makefile	Tue Dec  5 14:01:12 2017	(r455584)
+++ head/security/py-backports.ssl_match_hostname/Makefile	Tue Dec  5 15:00:03 2017	(r455585)
@@ -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 f
 
 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>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201712051500.vB5F04CR051076>