a0biv S r SSKrSSKJr SSKJr SSKJr \\\4 r \R " S\R 5 r\R " S\R 5 r
\R " S \R 5 r\R " S
\R 5 rS\S\4S
jrS\S\4S jrS\S\4S jrS\S\4S jrS\S\4S jrS\S\4S jrS\S\4S jrS\S\4S jrg)zZ
Helpers for normalization as expected in wheel/sdist/module file names
and core metadata
N)Path)Union ) packagingz)^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$z[^A-Z0-9.]+z
[^A-Z0-9]+z,^v?(?P(?:[0-9]+!)?[0-9]+(?:\.[0-9]+)*)namereturnc d [ R " SSU 5 nUR 5 ( d eU$ )zMake a string safe to be used as Python identifier.
>>> safe_identifier("12abc")
'_12abc'
>>> safe_identifier("__editable__.myns.pkg-78.9.3_local")
'__editable___myns_pkg_78_9_3_local'
z
\W|^(?=\d)_)resubisidentifier)r safes ڒ/builddir/build/BUILDROOT/alt-python313-setuptools-69.0.2-3.el8.x86_64/opt/alt/python313/lib/python3.13/site-packages/setuptools/_normalization.pysafe_identifierr s0 66-d+DK componentc . [ R SU 5 $ )zEscape a component used as a project name according to Core Metadata.
>>> safe_name("hello world")
'hello-world'
>>> safe_name("hello?world")
'hello-world'
-)_UNSAFE_NAME_CHARSr )r s r safe_namer s !!#y11r versionc < U R SS5 n [ [ R R U5 5 $ ! [ R R
aA [ R SU5 n[ [ R R U5 5 s $ f = f)a Convert an arbitrary string into a valid version string.
Can still raise an ``InvalidVersion`` exception.
To avoid exceptions use ``best_effort_version``.
>>> safe_version("1988 12 25")
'1988.12.25'
>>> safe_version("v0.2.1")
'0.2.1'
>>> safe_version("v0.2?beta")
'0.2b0'
>>> safe_version("v0.2 beta")
'0.2b0'
>>> safe_version("ubuntu lts")
Traceback (most recent call last):
...
setuptools.extern.packaging.version.InvalidVersion: Invalid version: 'ubuntu.lts'
.r )replacestrr r VersionInvalidVersionr r )r vattempts r safe_versionr! + s~ " S!A79$$,,Q/00++ 7$((a09$$,,W5667s '<