summaryrefslogtreecommitdiff
path: root/dev-python/jaraco-context
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2020-08-25 10:45:55 +0100
committerV3n3RiX <venerix@redcorelinux.org>2020-08-25 10:45:55 +0100
commit3cf7c3ef441822c889356fd1812ebf2944a59851 (patch)
treec513fe68548b40365c1c2ebfe35c58ad431cdd77 /dev-python/jaraco-context
parent05b8b0e0af1d72e51a3ee61522941bf7605cd01c (diff)
gentoo resync : 25.08.2020
Diffstat (limited to 'dev-python/jaraco-context')
-rw-r--r--dev-python/jaraco-context/Manifest4
-rw-r--r--dev-python/jaraco-context/files/jaraco-context-3.0.0-useless-deps.patch62
-rw-r--r--dev-python/jaraco-context/jaraco-context-3.0.0.ebuild47
-rw-r--r--dev-python/jaraco-context/metadata.xml8
4 files changed, 121 insertions, 0 deletions
diff --git a/dev-python/jaraco-context/Manifest b/dev-python/jaraco-context/Manifest
new file mode 100644
index 000000000000..3065c52ce449
--- /dev/null
+++ b/dev-python/jaraco-context/Manifest
@@ -0,0 +1,4 @@
+AUX jaraco-context-3.0.0-useless-deps.patch 2133 BLAKE2B 8db1fea20763661a3d6786536de6ed956a1e3f2952a96f7242b5735f2ed782496dcc662259921e4eb2967655da4f94ad7262f282caf3bf15428c704f4a38890c SHA512 16608605a401fbd002714043da0a7a28fc770f8972a808d71da19733fe1992f7f1f27f1d87462900c980bd14ba4c493349e5802f735e795a2e2c3d7012d2773f
+DIST jaraco.context-3.0.0.tar.gz 12901 BLAKE2B b0a18d8799de211c9827a708302798372dff06767fbac08f4bff8ed48e1dde4cca8d3896a3c4dccd186efdc4d80ffe2b972a05e8f351ec53dcd0c7dec45cfcea SHA512 fd48a9af65edea3212c194758ba1a8fc2d7efc35f7eaec959a7f327ad46d1bf15f295af29d62726f813d35baaeaff35bc3fcd6e27a0e0f272232772e1cb87c17
+EBUILD jaraco-context-3.0.0.ebuild 1122 BLAKE2B 7c52d1532ccff0b303988f86c61e22cc194851eb4d96cdf0e81a30a5a3faf166ceeccd7555368c43bd443781918b98cb41a92df91907ce84ad776e010ae20cc6 SHA512 e9dabf3036916d9ec75b5e51e149be77e4da09bfa82f270d420611137cee1e0a2d971ab79006b5c7efe676f01fb30b8998ab613e1d3e1bc8e1a5b61d0f5b20e2
+MISC metadata.xml 240 BLAKE2B 41e6a4d9da33dab2decc5ff419924f382a8f64d27a81fdb97576db8c6cf125be95911747946ec8be1b453f56617fef1084f5947f84b50a8db419d46df2ae8a0f SHA512 9c23321eaa853f851bf00195ea64ac2ba093e516f9b57855ee5aa58fbb1988130c9f0c17c2a9ce9fae4ee033e0a28a70c868e0f5acdfa1dd316ab533c5279d59
diff --git a/dev-python/jaraco-context/files/jaraco-context-3.0.0-useless-deps.patch b/dev-python/jaraco-context/files/jaraco-context-3.0.0-useless-deps.patch
new file mode 100644
index 000000000000..3b69581ab2b5
--- /dev/null
+++ b/dev-python/jaraco-context/files/jaraco-context-3.0.0-useless-deps.patch
@@ -0,0 +1,62 @@
+From e3a1f344c296f9d6193f4bf2ac1e0cdafcddce0e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Mon, 20 Jul 2020 18:11:31 +0200
+Subject: [PATCH] Make jaraco.apt & yg.lockfile imports optional
+
+Handle missing jaraco.apt & yg.lockfile modules more gracefully,
+delaying the error until dependency_context is actually used. These
+two modules are only used by the dependency_context, and this context
+can only work on apt-based systems, so there is no point in forcing
+the extraneous dependencies on systems that do not use apt where
+jaraco.context is being installed for other context managers.
+---
+ jaraco/context.py | 19 ++++++++++++++++---
+ 1 file changed, 16 insertions(+), 3 deletions(-)
+
+diff --git a/jaraco/context.py b/jaraco/context.py
+index 0b5b1bc..13dfdf6 100644
+--- a/jaraco/context.py
++++ b/jaraco/context.py
+@@ -13,8 +13,15 @@ try:
+ except Exception:
+ import contextlib as contextlib2
+
+-import jaraco.apt
+-import yg.lockfile
++try:
++ import jaraco.apt as apt
++except ImportError:
++ apt = None
++
++try:
++ import yg.lockfile
++except ImportError:
++ yg = None
+
+
+ __metaclass__ = type
+@@ -131,6 +138,12 @@ def dependency_context(package_names, aggressively_remove=False):
+ """
+ installed_packages = []
+ log = logging.getLogger(__name__)
++ if apt is None:
++ log.error("jaraco.apt not found installed")
++ raise ImportError("jaraco.apt not found installed")
++ if yg is None:
++ log.error("yg.lockfile not found installed")
++ raise ImportError("yg.lockfile not found installed")
+ try:
+ if not package_names:
+ logging.debug('No packages requested')
+@@ -144,7 +157,7 @@ def dependency_context(package_names, aggressively_remove=False):
+ stderr=subprocess.STDOUT,
+ )
+ log.debug('Aptitude output:\n%s', output)
+- installed_packages = jaraco.apt.parse_new_packages(
++ installed_packages = apt.parse_new_packages(
+ output, include_automatic=aggressively_remove
+ )
+ if not installed_packages:
+--
+2.27.0
+
diff --git a/dev-python/jaraco-context/jaraco-context-3.0.0.ebuild b/dev-python/jaraco-context/jaraco-context-3.0.0.ebuild
new file mode 100644
index 000000000000..e452794c4180
--- /dev/null
+++ b/dev-python/jaraco-context/jaraco-context-3.0.0.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# upstream uses bad template
+DISTUTILS_USE_SETUPTOOLS=manual
+PYTHON_COMPAT=( python3_{6..9} pypy3 )
+
+inherit distutils-r1
+
+MY_PN="${PN/-/.}"
+DESCRIPTION="Context managers by jaraco"
+HOMEPAGE="https://github.com/jaraco/jaraco.context"
+SRC_URI="mirror://pypi/${PN:0:1}/${MY_PN}/${MY_PN}-${PV}.tar.gz"
+S="${WORKDIR}/${MY_PN}-${PV}"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~ia64 ~ppc ~ppc64 ~x86"
+
+RDEPEND="
+ >=dev-python/namespace-jaraco-2[${PYTHON_USEDEP}]
+"
+BDEPEND="
+ dev-python/setuptools[${PYTHON_USEDEP}]
+ dev-python/setuptools_scm[${PYTHON_USEDEP}]
+"
+
+distutils_enable_tests pytest
+
+PATCHES=(
+ "${FILESDIR}"/${P}-useless-deps.patch
+)
+
+python_prepare_all() {
+ # used only for apt support that's irrelevant to Gentoo
+ sed -i -e '/jaraco\.apt/d' -e '/yg\.lockfile/d' setup.cfg || die
+ # pytest plugins
+ sed -i -e 's:--flake8 --black --cov::' pytest.ini || die
+ distutils-r1_python_prepare_all
+}
+
+python_install() {
+ rm "${BUILD_DIR}"/lib/jaraco/__init__.py || die
+ distutils-r1_python_install
+}
diff --git a/dev-python/jaraco-context/metadata.xml b/dev-python/jaraco-context/metadata.xml
new file mode 100644
index 000000000000..7f4f33c6dbc9
--- /dev/null
+++ b/dev-python/jaraco-context/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>python@gentoo.org</email>
+ <name>Python</name>
+ </maintainer>
+</pkgmetadata>