Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH 0/7] pypi.eclass: Filename and version normalization
Date: Sat, 11 Feb 2023 11:44:53
Message-Id: ebab41d31e982509bf433a478af3ee92ff46df5c.camel@gentoo.org
In Reply to: [gentoo-dev] [PATCH 0/7] pypi.eclass: Filename and version normalization by "Michał Górny"
1 On Sat, 2023-02-11 at 10:16 +0100, Michał Górny wrote:
2 > Hi,
3 >
4 > Here's a major patchset to the recently committed pypi.eclass (i.e.
5 > the "change while it's still warm and not used much" kind).
6 >
7 > It focuses on two significant changes:
8 >
9 > 1. Normalizing filenames according to the current sdist/wheel standards.
10 >
11 > 2. Translating Gentoo-specific components in ${PV} to the corresponding
12 > standard Python versions.
13 >
14 > The former change is focused on improving correctness (i.e. sometimes
15 > the current API didn't allow for getting the correct URI), the latter
16 > on convenience (i.e. not having to override ${PV} sometimes).
17 >
18 > For example, a package called "Test-Package-1.2.3_beta4" that followed
19 > PEP 625 (e.g. by using Hatchling) would require an ebuild calling
20 > the equivalent of:
21 >
22 > $(pypi_sdist_url "test_package" "${PV/_beta/b}")
23 >
24 > while now it will work out of the box.
25 >
26 > Unfortunately, PEP 625 is not yet universally followed, so many packages
27 > will instead need to:
28 >
29 > $(pypi_sdist_url --no-normalize)
30 >
31 > but I think following the standard immediately and requiring a number
32 > of `--no-normalize` calls is better than doing it the other way around
33 > and then switching the defaults, even if the majority of affected
34 > packages use "legacy" naming right now.
35 >
36 > That said, this only affects packages with uppercase letters, "-" or "."
37 > in their names.
38 >
39
40 A minute after sending this I've realized that we need to apply the same
41 operations to S as well. In reply, I'm adding two more patches that
42 respectively:
43
44 1) perform normalization and translation in S by default (i.e. make it
45 match the default SRC_URI),
46
47 2) add a more convenient PYPI_NO_NORMALIZE variable that can be used to
48 control whether SRC_URI and S use normalized or legacy names.
49
50 --
51 Best regards,
52 Michał Górny

Replies