mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-09-16 14:29:05 -07:00
sys-apps/pkgcore: Try another pytest-sighandler fix
The original fix for pkgcore's signal handlers breaking pkgcore causes 'pmaint regen' to hang frequently. Try to use delayed imports instead as that seems to fix the original pytest plugin problem without affecting pmaint. Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
67
sys-apps/pkgcore/files/pkgcore-0.10.18-sighdlr-r1.patch
Normal file
67
sys-apps/pkgcore/files/pkgcore-0.10.18-sighdlr-r1.patch
Normal file
@@ -0,0 +1,67 @@
|
||||
From 303826ceb22985cfa1dfbf1e7a68ed327ffc741b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
|
||||
Date: Sat, 15 May 2021 09:30:58 +0200
|
||||
Subject: [PATCH] pytest: Delay loading pkgcore modules until fixtures are used
|
||||
|
||||
Delay loading pkgcore modules until the EbuildRepo-based fixtures are
|
||||
actually used. This prevents the pkgcore signal handlers from being
|
||||
enabled on all packages using pytest while keeping the old behavior
|
||||
of setting them upon import in packages using pkgcore directly.
|
||||
---
|
||||
src/pkgcore/pytest/plugin.py | 15 ++++++++++-----
|
||||
1 file changed, 10 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/pkgcore/pytest/plugin.py b/src/pkgcore/pytest/plugin.py
|
||||
index 082538ab..bdc89e4b 100644
|
||||
--- a/src/pkgcore/pytest/plugin.py
|
||||
+++ b/src/pkgcore/pytest/plugin.py
|
||||
@@ -1,3 +1,4 @@
|
||||
+import importlib
|
||||
import os
|
||||
import subprocess
|
||||
import textwrap
|
||||
@@ -5,8 +6,6 @@ from collections.abc import MutableSet
|
||||
from datetime import datetime
|
||||
|
||||
import pytest
|
||||
-from pkgcore.ebuild import cpv as cpv_mod
|
||||
-from pkgcore.ebuild import repo_objs, repository
|
||||
from snakeoil import klass
|
||||
from snakeoil.fileutils import touch
|
||||
from snakeoil.osutils import pjoin
|
||||
@@ -169,6 +168,12 @@ class EbuildRepo:
|
||||
"""Class for creating/manipulating ebuild repos."""
|
||||
|
||||
def __init__(self, path, repo_id='fake', eapi='5', masters=(), arches=()):
|
||||
+ # load pkgcore modules late to avoid overriding signal handlers
|
||||
+ # when the plugin is not actually used
|
||||
+ self.cpv_mod = importlib.import_module('pkgcore.ebuild.cpv')
|
||||
+ self.repo_objs = importlib.import_module('pkgcore.ebuild.repo_objs')
|
||||
+ self.repository = importlib.import_module('pkgcore.ebuild.repository')
|
||||
+
|
||||
self.path = path
|
||||
self.arches = _FileSet(pjoin(self.path, 'profiles', 'arch.list'))
|
||||
self._today = datetime.today()
|
||||
@@ -194,8 +199,8 @@ class EbuildRepo:
|
||||
|
||||
def sync(self):
|
||||
"""Forcibly create underlying repo object avoiding cache usage."""
|
||||
- repo_config = repo_objs.RepoConfig(location=self.path, disable_inst_caching=True)
|
||||
- self._repo = repository.UnconfiguredTree(self.path, repo_config=repo_config)
|
||||
+ repo_config = self.repo_objs.RepoConfig(location=self.path, disable_inst_caching=True)
|
||||
+ self._repo = self.repository.UnconfiguredTree(self.path, repo_config=repo_config)
|
||||
|
||||
def create_profiles(self, profiles):
|
||||
for p in profiles:
|
||||
@@ -215,7 +220,7 @@ class EbuildRepo:
|
||||
f.write(f'{p.eapi}\n')
|
||||
|
||||
def create_ebuild(self, cpvstr, data=None, **kwargs):
|
||||
- cpv = cpv_mod.VersionedCPV(cpvstr)
|
||||
+ cpv = self.cpv_mod.VersionedCPV(cpvstr)
|
||||
self._repo.notify_add_package(cpv)
|
||||
ebuild_dir = pjoin(self.path, cpv.category, cpv.package)
|
||||
os.makedirs(ebuild_dir, exist_ok=True)
|
||||
--
|
||||
2.31.1
|
||||
|
||||
51
sys-apps/pkgcore/pkgcore-0.11.8-r3.ebuild
Normal file
51
sys-apps/pkgcore/pkgcore-0.11.8-r3.ebuild
Normal file
@@ -0,0 +1,51 @@
|
||||
# Copyright 1999-2021 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=7
|
||||
PYTHON_COMPAT=( python3_{8..9} )
|
||||
DISTUTILS_IN_SOURCE_BUILD=1
|
||||
inherit distutils-r1
|
||||
|
||||
if [[ ${PV} == *9999 ]] ; then
|
||||
EGIT_REPO_URI="https://github.com/pkgcore/pkgcore.git"
|
||||
inherit git-r3
|
||||
else
|
||||
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-macos"
|
||||
SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
|
||||
fi
|
||||
|
||||
DESCRIPTION="a framework for package management"
|
||||
HOMEPAGE="https://github.com/pkgcore/pkgcore"
|
||||
|
||||
LICENSE="BSD MIT"
|
||||
SLOT="0"
|
||||
|
||||
RDEPEND="dev-python/lxml[${PYTHON_USEDEP}]"
|
||||
if [[ ${PV} == *9999 ]]; then
|
||||
RDEPEND+=" ~dev-python/snakeoil-9999[${PYTHON_USEDEP}]"
|
||||
else
|
||||
RDEPEND+=" >=dev-python/snakeoil-0.9.6[${PYTHON_USEDEP}]"
|
||||
fi
|
||||
BDEPEND="
|
||||
test? (
|
||||
>=dev-python/pytest-6[${PYTHON_USEDEP}]
|
||||
dev-vcs/git
|
||||
)
|
||||
"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}/pkgcore-0.10.18-sighdlr-r1.patch"
|
||||
)
|
||||
|
||||
distutils_enable_tests setup.py
|
||||
|
||||
src_test() {
|
||||
local -x PYTHONDONTWRITEBYTECODE=
|
||||
distutils-r1_src_test
|
||||
}
|
||||
|
||||
python_install_all() {
|
||||
local DOCS=( NEWS.rst )
|
||||
[[ ${PV} == *9999 ]] || doman man/*
|
||||
distutils-r1_python_install_all
|
||||
}
|
||||
Reference in New Issue
Block a user