dev-python/distlib: Sync with Gentoo

It's from Gentoo commit 948ad8798c761c2f962d0042b1170cd972ee45ff.

Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
This commit is contained in:
Flatcar Buildbot 2025-07-21 07:11:56 +00:00 committed by Mathieu Tortuyaux
parent e156e24e02
commit c68d08057a
No known key found for this signature in database
GPG Key ID: AC5CCFB52545D9B8
3 changed files with 87 additions and 0 deletions

View File

@ -1 +1,2 @@
DIST distlib-0.3.9.gh.tar.gz 1244538 BLAKE2B 08f5257f5a1125c1c76a23b9a78ded6a08f26d2f1491be9b104ab1e02a9737ae49f3750a607d3c7c744397879aeb3cd1a94a355743c95c702eec8a3cfebd70cb SHA512 d89b3ae450a02f634db10baef8d2ff445afa99cd69377f40ef07d591b4bbb2e24fff43c92eeeb93628eaee292fa1e8324eb1a842cf9401feb1f309dbb6f20a25
DIST distlib-0.4.0.gh.tar.gz 1245571 BLAKE2B c36fe726918bc04849465a55a2708b8686d2ba0b05baa7ff0595e03b7ff95a1afc45b037dbeab9bd14ec7a26ec49807ea5a7c458d8f8da16038c92f32291c62e SHA512 ff61f9ab4e38061d5fee3168c8b26c741a21403d793476477e0733b28b2ba5b1fb31ae6ddb5275efe7ad6936b7e79a5e7ec1b160c86bfbfe6b4ecff10e0193d2

View File

@ -0,0 +1,58 @@
# Copyright 2021-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{11..14} python3_{13,14}t pypy3_11 )
inherit distutils-r1
DESCRIPTION="Low-level components of distutils2/packaging"
HOMEPAGE="
https://pypi.org/project/distlib/
https://github.com/pypa/distlib/
"
SRC_URI="
https://github.com/pypa/distlib/archive/${PV}.tar.gz -> ${P}.gh.tar.gz
"
LICENSE="PSF-2"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-macos"
IUSE="test"
RESTRICT="!test? ( test )"
# pypiserver is called as external executable
BDEPEND="
test? (
dev-python/pypiserver
)
"
src_prepare() {
local PATCHES=(
# use system pypiserver instead of bundled one
"${FILESDIR}/distlib-0.3.9-system-pypiserver.py"
# https://github.com/pypa/distlib/commit/6286442857de9f734686d08f0e59ca8048ee357a
"${FILESDIR}/${P}-py314-test.patch"
)
# make sure it's not used
rm tests/pypi-server-standalone.py || die
distutils-r1_src_prepare
}
python_test() {
local -x SKIP_ONLINE=1
local -x PYTHONHASHSEED=0
# disable system-site-packages -- distlib has no deps, and is very
# fragile to packages actually installed on the system
sed -i -e '/system-site-packages/s:true:false:' \
"${BUILD_DIR}/install${EPREFIX}/usr/pyvenv.cfg" || die
"${EPYTHON}" tests/test_all.py -v -x ||
die "Tests failed with ${EPYTHON}"
}

View File

@ -0,0 +1,28 @@
From 6286442857de9f734686d08f0e59ca8048ee357a Mon Sep 17 00:00:00 2001
From: Vinay Sajip <vinay_sajip@yahoo.co.uk>
Date: Fri, 18 Jul 2025 07:59:29 +0100
Subject: [PATCH] Fix #251: Use more appropriate function in test.
--- a/tests/test_scripts.py
+++ b/tests/test_scripts.py
@@ -341,10 +341,8 @@ def test_dry_run(self):
def test_script_run(self):
if sys.version_info[:2] < (3, 13):
target = 'cgi:print_directory'
- elif os.name != 'nt':
- target = 'test.support.interpreters:list_all'
else:
- raise unittest.SkipTest('test not available on Windows for Python >= 3.13')
+ target = 'logging:getHandlerNames'
files = self.maker.make('test = %s' % target)
self.assertEqual(len(files), 2)
p = subprocess.Popen([sys.executable, files[0]], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@@ -353,7 +351,7 @@ def test_script_run(self):
self.assertIn(b'<H3>Current Working Directory:</H3>', stdout)
self.assertIn(os.getcwd().encode('utf-8'), stdout)
else:
- self.assertIn(b'[Interpreter(0)]', stderr)
+ self.assertIn(b'frozenset(', stderr)
self.assertEqual(p.returncode, 1)
@unittest.skipUnless(os.name == 'posix', 'Test only valid for POSIX')