Commit 04184247 by Randy Döring Committed by Bjorn Neergaard

locker: less verbose output for `package.files` in lockfile 2.0

parent 4578c6f4
......@@ -23,10 +23,8 @@ from tomlkit import array
from tomlkit import comment
from tomlkit import document
from tomlkit import inline_table
from tomlkit import item
from tomlkit import table
from tomlkit.exceptions import TOMLKitError
from tomlkit.items import Array
if TYPE_CHECKING:
......@@ -228,24 +226,19 @@ class Locker:
return repository
def set_lock_data(self, root: Package, packages: list[Package]) -> bool:
files: dict[str, Any] = table()
package_specs = self._lock_packages(packages)
# Retrieving hashes
for package in package_specs:
if package["name"] not in files:
files[package["name"]] = []
files = array()
for f in package["files"]:
file_metadata = inline_table()
for k, v in sorted(f.items()):
file_metadata[k] = v
files[package["name"]].append(file_metadata)
files.append(file_metadata)
if files[package["name"]]:
package_files = item(files[package["name"]])
assert isinstance(package_files, Array)
files[package["name"]] = package_files.multiline(True)
package["files"] = files.multiline(True)
lock = document()
lock.add(comment(GENERATED_COMMENT))
......
......@@ -104,14 +104,10 @@ description = ""
category = "main"
optional = false
python-versions = "*"
[[package.files]]
file = "bar"
hash = "123"
[[package.files]]
file = "foo"
hash = "456"
files = [
{{file = "bar", hash = "123"}},
{{file = "foo", hash = "456"}},
]
[package.dependencies]
B = "^1.0"
......@@ -123,10 +119,9 @@ description = ""
category = "main"
optional = false
python-versions = "*"
[[package.files]]
file = "baz"
hash = "345"
files = [
{{file = "baz", hash = "345"}},
]
[[package]]
name = "B"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment