pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/jwilk-mirrors/python-pkginfo/commit/4cedaf9ca6b648ceeb9bb4ae02fb207599299c1a

nk crossorigen="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-94620c216484da1f.css" /> Support 'metadata_version' == '2.4' (PEP 639). · jwilk-mirrors/python-pkginfo@4cedaf9 · GitHub
Skip to content

Commit 4cedaf9

Browse files
committed
Support 'metadata_version' == '2.4' (PEP 639).
1 parent a8014e9 commit 4cedaf9

File tree

4 files changed

+35
-1
lines changed

4 files changed

+35
-1
lines changed

CHANGES.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
``pkginfo`` Changelog
22
=====================
33

4+
1.12.0 (unreleased)
5+
-------------------
6+
7+
- Support 'metadata_version' == '2.4' (PEP 639).
8+
49
1.11.3 (2024-12-02)
510
-------------------
611

pkginfo/distribution.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ def _collapse_leading_ws(header, txt):
7878

7979
HEADER_ATTRS_2_3 = HEADER_ATTRS_2_2 # PEP 685
8080

81+
HEADER_ATTRS_2_4 = HEADER_ATTRS_2_3 + ( # PEP 639
82+
('License-Expression', 'license_expression', False),
83+
('License-File', 'license_file', True),
84+
)
85+
8186
HEADER_ATTRS = {
8287
'1.0': HEADER_ATTRS_1_0,
8388
'1.1': HEADER_ATTRS_1_1,
@@ -86,6 +91,7 @@ def _collapse_leading_ws(header, txt):
8691
'2.1': HEADER_ATTRS_2_1,
8792
'2.2': HEADER_ATTRS_2_2,
8893
'2.3': HEADER_ATTRS_2_3,
94+
'2.4': HEADER_ATTRS_2_4,
8995
}
9096

9197
def _version_tuple(metadata_version):
@@ -154,6 +160,9 @@ class Distribution(object):
154160
description_content_type = None
155161
# version 2.2
156162
dynamic = ()
163+
# version 2.4
164+
license_expression = None
165+
license_file = ()
157166

158167
def extractMetadata(self):
159168
data = self.read()

pkginfo/distribution.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ HEADER_ATTRS_2_0 = HEADER_ATTRS_1_2
2222
HEADER_ATTRS_2_1: _header_attrs
2323
HEADER_ATTRS_2_2: _header_attrs
2424
HEADER_ATTRS_2_3: _header_attrs
25+
HEADER_ATTRS_2_4: _header_attrs
2526
HEADER_ATTRS: Dict[str, _header_attrs]
2627
_metadata_version = Tuple[int, int]
2728
METADATA_VERSIONS: Sequence[_metadata_version]
@@ -65,6 +66,8 @@ class Distribution:
6566
provides_extras: Sequence[str]
6667
description_content_type: str | None
6768
dynamic: Sequence[str]
69+
license_expression: str | None
70+
license_file: Sequence[str]
6871
def extractMetadata(self) -> None: ...
6972
def read(self) -> bytes: ...
7073
def parse(self, data: bytes) -> None: ...

pkginfo/tests/test_distribution.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,5 +640,22 @@ def test_distribution_parse_Dynamic_single():
640640
def test_distribution_parse_Dynamic_multiple():
641641
dist = _make_distribution('2.2')
642642
dist.parse('Dynamic: Platforms\n'
643-
'Dynamic: Supported-Platforms')
643+
'Dynamic: Supported-Platforms')
644644
assert list(dist.dynamic) == ['Platforms', 'Supported-Platforms']
645+
646+
# Metadata version 2.4, defined in PEP 639.
647+
def test_distribution_parse_License_Expression_single():
648+
dist = _make_distribution('2.4')
649+
dist.parse('License-Expression: MIT')
650+
assert dist.license_expression == 'MIT'
651+
652+
def test_distribution_parse_License_File_single():
653+
dist = _make_distribution('2.4')
654+
dist.parse('License-File: LICENSE.txt')
655+
assert list(dist.license_file) == ['LICENSE.txt']
656+
657+
def test_distribution_parse_License_File_multiple():
658+
dist = _make_distribution('2.4')
659+
dist.parse('License-File: LICENSE.txt\n'
660+
'License-File: docs/LICENSE.rst')
661+
assert list(dist.license_file) == ['LICENSE.txt', 'docs/LICENSE.rst']

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy