@@ -496,20 +496,30 @@ def _find_pattern(pattern: str, enforce_match: bool = True) -> list[str]:
496
496
>>> Distribution._find_pattern("../LICENSE.MIT")
497
497
Traceback (most recent call last):
498
498
...
499
- setuptools.errors.InvalidConfigError : ...Pattern '../LICENSE.MIT' cannot contain '..'
499
+ setuptools.warnings.SetuptoolsDeprecationWarning : ...Pattern '../LICENSE.MIT' cannot contain '..'
500
500
>>> Distribution._find_pattern("LICEN{CSE*")
501
501
Traceback (most recent call last):
502
502
...
503
503
setuptools.warnings.SetuptoolsDeprecationWarning: ...Pattern 'LICEN{CSE*' contains invalid characters...
504
504
"""
505
+ pypa_guides = "specifications/glob-patterns/"
505
506
if ".." in pattern :
506
- raise InvalidConfigError (f"Pattern { pattern !r} cannot contain '..'" )
507
+ SetuptoolsDeprecationWarning .emit (
508
+ f"Pattern { pattern !r} cannot contain '..'" ,
509
+ """
510
+ According to the new PyPA standards, this glob pattern is invalid.
511
+ Please ensure the files specified are contained by the root
512
+ of the Python package (normally marked by `pyproject.toml`).
513
+ """ ,
514
+ see_url = f"https://packaging.python.org/en/latest/{ pypa_guides } " ,
515
+ due_date = (2026 , 2 , 20 ), # Introduced in 2025-03-20
516
+ # Replace with InvalidConfigError after deprecation
517
+ )
507
518
if pattern .startswith ((os .sep , "/" )) or ":\\ " in pattern :
508
519
raise InvalidConfigError (
509
520
f"Pattern { pattern !r} should be relative and must not start with '/'"
510
521
)
511
522
if re .match (r'^[\w\-\.\/\*\?\[\]]+$' , pattern ) is None :
512
- pypa_guides = "specifications/glob-patterns/"
513
523
SetuptoolsDeprecationWarning .emit (
514
524
"Please provide a valid glob pattern." ,
515
525
"Pattern {pattern!r} contains invalid characters." ,
0 commit comments