Hi,

Here's a major patchset to the recently committed pypi.eclass (i.e.
the "change while it's still warm and not used much" kind).

It focuses on two significant changes:

1. Normalizing filenames according to the current sdist/wheel standards.

2. Translating Gentoo-specific components in ${PV} to the corresponding
   standard Python versions.

The former change is focused on improving correctness (i.e. sometimes
the current API didn't allow for getting the correct URI), the latter
on convenience (i.e. not having to override ${PV} sometimes).

For example, a package called "Test-Package-1.2.3_beta4" that followed
PEP 625 (e.g. by using Hatchling) would require an ebuild calling
the equivalent of:

  $(pypi_sdist_url "test_package" "${PV/_beta/b}")

while now it will work out of the box.

Unfortunately, PEP 625 is not yet universally followed, so many packages
will instead need to:

  $(pypi_sdist_url --no-normalize)

but I think following the standard immediately and requiring a number
of `--no-normalize` calls is better than doing it the other way around
and then switching the defaults, even if the majority of affected
packages use "legacy" naming right now.

That said, this only affects packages with uppercase letters, "-" or "."
in their names.

More details in eclassdoc.

The patchset also adds tests for the eclass.

Relevant PR (including fixes to existing consumers):
https://github.com/gentoo/gentoo/pull/29526

Fortunately, breakage is easy to detect by remanifesting ebuilds.

-- 
Best regards,
Michał Górny


Michał Górny (7):
  pypi.eclass: Use pypi_sdist_url to generate the default SRC_URI
  pypi.eclass: Add a name normalization function
  pypi.eclass: Normalize wheel filenames
  pypi.eclass: Add `--unpack` to usage error in pypi_wheel_url
  pypi.eclass: Normalize sdist filenames by default
  pypi.eclass: Add a version translation function
  pypi.eclass: Translate ${PV} by default

 eclass/pypi.eclass   | 94 ++++++++++++++++++++++++++++++++++++--------
 eclass/tests/pypi.sh | 93 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 171 insertions(+), 16 deletions(-)
 create mode 100755 eclass/tests/pypi.sh

-- 
2.39.1


Reply via email to