sys-apps/pkgcore: fix sys.prefix testing

Closes: https://bugs.gentoo.org/880693
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
This commit is contained in:
Arthur Zamarin
2022-11-10 21:18:38 +02:00
parent 65bf926186
commit 82a820e192
3 changed files with 22 additions and 26 deletions

View File

@@ -0,0 +1,18 @@
--- a/py_build.py
+++ b/py_build.py
@@ -28,12 +28,12 @@ def write_pkgcore_lookup_configs(cleanup_files):
with open(path, "w") as f:
os.chmod(path, 0o644)
f.write(textwrap.dedent("""\
- from os.path import join, abspath
+ from os.path import abspath, exists, join
import sys
- from snakeoil import process
-
INSTALL_PREFIX = abspath(sys.prefix)
+ if not exists(join(INSTALL_PREFIX, 'lib/pkgcore')):
+ INSTALL_PREFIX = abspath(sys.base_prefix)
DATA_PATH = join(INSTALL_PREFIX, 'share/pkgcore')
CONFIG_PATH = join(DATA_PATH, 'config')
LIBDIR_PATH = join(INSTALL_PREFIX, 'lib/pkgcore')

View File

@@ -38,20 +38,11 @@ BDEPEND="
)
"
distutils_enable_tests pytest
EPYTEST_DESELECT=(
# fail because of forcing Gentoo's prefix
tests/ebuild/test_eapi.py::TestEAPI::test_register
tests/ebuild/test_eapi.py::TestEAPI::test_is_supported
PATCHES=(
"${FILESDIR}/${PN}-0.12.17-fix-prefix.patch"
)
src_prepare() {
# force Gentoo's prefix
sed -e "/INSTALL_PREFIX =/s@= .*\$@= '${EPREFIX}/usr'@" -i py_build.py || die
distutils-r1_src_prepare
}
distutils_enable_tests pytest
python_install_all() {
local DOCS=( NEWS.rst )

View File

@@ -40,21 +40,8 @@ BDEPEND="
distutils_enable_tests pytest
EPYTEST_DESELECT=(
# fail because of forcing Gentoo's prefix
tests/ebuild/test_eapi.py::TestEAPI::test_register
tests/ebuild/test_eapi.py::TestEAPI::test_is_supported
)
src_prepare() {
# force Gentoo's prefix
sed -e "/INSTALL_PREFIX =/s@= .*\$@= '${EPREFIX}/usr'@" -i py_build.py || die
distutils-r1_src_prepare
}
python_install_all() {
local DOCS=( NEWS.rst )
[[ ${PV} == *9999 ]] || doman man/*
[[ ${PV} == *9999 ]] || doman build/sphinx/man/*
distutils-r1_python_install_all
}