Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 0/7] pypi.eclass: Filename and version normalization
Date: Sat, 11 Feb 2023 09:16:24
Message-Id: 20230211091614.879528-1-mgorny@gentoo.org
1 Hi,
2
3 Here's a major patchset to the recently committed pypi.eclass (i.e.
4 the "change while it's still warm and not used much" kind).
5
6 It focuses on two significant changes:
7
8 1. Normalizing filenames according to the current sdist/wheel standards.
9
10 2. Translating Gentoo-specific components in ${PV} to the corresponding
11 standard Python versions.
12
13 The former change is focused on improving correctness (i.e. sometimes
14 the current API didn't allow for getting the correct URI), the latter
15 on convenience (i.e. not having to override ${PV} sometimes).
16
17 For example, a package called "Test-Package-1.2.3_beta4" that followed
18 PEP 625 (e.g. by using Hatchling) would require an ebuild calling
19 the equivalent of:
20
21 $(pypi_sdist_url "test_package" "${PV/_beta/b}")
22
23 while now it will work out of the box.
24
25 Unfortunately, PEP 625 is not yet universally followed, so many packages
26 will instead need to:
27
28 $(pypi_sdist_url --no-normalize)
29
30 but I think following the standard immediately and requiring a number
31 of `--no-normalize` calls is better than doing it the other way around
32 and then switching the defaults, even if the majority of affected
33 packages use "legacy" naming right now.
34
35 That said, this only affects packages with uppercase letters, "-" or "."
36 in their names.
37
38 More details in eclassdoc.
39
40 The patchset also adds tests for the eclass.
41
42 Relevant PR (including fixes to existing consumers):
43 https://github.com/gentoo/gentoo/pull/29526
44
45 Fortunately, breakage is easy to detect by remanifesting ebuilds.
46
47 --
48 Best regards,
49 Michał Górny
50
51
52 Michał Górny (7):
53 pypi.eclass: Use pypi_sdist_url to generate the default SRC_URI
54 pypi.eclass: Add a name normalization function
55 pypi.eclass: Normalize wheel filenames
56 pypi.eclass: Add `--unpack` to usage error in pypi_wheel_url
57 pypi.eclass: Normalize sdist filenames by default
58 pypi.eclass: Add a version translation function
59 pypi.eclass: Translate ${PV} by default
60
61 eclass/pypi.eclass | 94 ++++++++++++++++++++++++++++++++++++--------
62 eclass/tests/pypi.sh | 93 +++++++++++++++++++++++++++++++++++++++++++
63 2 files changed, 171 insertions(+), 16 deletions(-)
64 create mode 100755 eclass/tests/pypi.sh
65
66 --
67 2.39.1

Replies