From 1f6cac14e057bb889298f92173a70a8d53c231c3 Mon Sep 17 00:00:00 2001 From: Karolina Surma <33810531+befeleme@users.noreply.github.com> Date: Mon, 19 Aug 2024 23:40:33 +0200 Subject: [PATCH] PEP 639: Make the policy around globs tighter (#3913) --- peps/pep-0639.rst | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/peps/pep-0639.rst b/peps/pep-0639.rst index 433045b64..9a3851e03 100644 --- a/peps/pep-0639.rst +++ b/peps/pep-0639.rst @@ -521,21 +521,32 @@ containing licenses and other legal notices to be distributed with the package. It corresponds to the ``License-File`` fields in the Core Metadata. Its value is an array of strings which MUST contain valid glob patterns, -as specified below. -The glob patterns MAY contain special glob characters: ``*``, ``?``, ``**`` -and character ranges: ``[]``, and tools MUST support them. -Path delimiters MUST be the forward slash character (``/``), -and parent directory indicators (``..``) MUST NOT be used. +as specified below: + +- Alphanumeric characters, underscores (``_``), hyphens (``-``) and dots (``.``) + MUST be matched verbatim. + +- Special glob characters: ``*``, ``?``, ``**`` and character ranges: ``[]`` + containing only the verbatim matched characters MUST be supported. + Within ``[...]``, the hyphen indicates a range (e.g. ``a-z``). + Hyphens at the start or end are matched literally. + +- Path delimiters MUST be the forward slash character (``/``). + Patterns are relative to the directory containing ``pyproject.toml``, + therefore the leading slash character MUST NOT be used. + +- Parent directory indicators (``..``) MUST NOT be used. + +Any characters or character sequences not covered by this specification are +invalid. Projects MUST NOT use such values. +Tools consuming this field MAY reject invalid values with an error. + Tools MUST assume that license file content is valid UTF-8 encoded text, and SHOULD validate this and raise an error if it is not. Literal paths (e.g. ``LICENSE``) are treated as valid globs which means they can also be defined. -To achieve better portability, the filenames to match should only contain -the alphanumeric characters, underscores (``_``), hyphens (``-``) -and dots (``.``). - Build tools: - MUST treat each value as a glob pattern, and MUST raise an error if the