Skip to content

Commit d948afc

Browse files
Make dependencies.py metadata parsing consistent with other files
Update parse_metadata() to use parse_email() + Metadata.from_raw() for round-trip safety and consistency with bootstrapper.py and candidate.py. Signed-off-by: Lalatendu Mohanty <lmohanty@redhat.com>
1 parent 0fc5526 commit d948afc

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/fromager/dependencies.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import pkginfo
1111
import pyproject_hooks
1212
import tomlkit
13-
from packaging.metadata import Metadata
13+
from packaging.metadata import Metadata, parse_email
1414
from packaging.requirements import Requirement
1515

1616
from . import build_environment, external_commands, overrides, requirements_file
@@ -265,7 +265,8 @@ def parse_metadata(metadata_file: pathlib.Path, *, validate: bool = True) -> Met
265265
and core metadata version, e.g. a package with metadata 2.2 and
266266
license-expression field (added in 2.4).
267267
"""
268-
return Metadata.from_email(metadata_file.read_bytes(), validate=validate)
268+
raw_metadata, _ = parse_email(metadata_file.read_bytes())
269+
return Metadata.from_raw(raw_metadata, validate=validate)
269270

270271

271272
def get_install_dependencies_of_wheel(

0 commit comments

Comments
 (0)