servo: Merge #19325 - Report an errror if a package has duplicates allowed but there are no duplicates (from m-novikov:tidy-ignore-without-duplicates); r=jdm
Resolves: #19306 <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #19306 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: a812af51d614bd96402da91d8f648ce51b301a1b
This commit is contained in:
@@ -339,10 +339,17 @@ def check_lock(file_name, contents):
|
||||
packages_by_name.setdefault(package["name"], []).append((package["version"], source))
|
||||
|
||||
for (name, packages) in packages_by_name.iteritems():
|
||||
if name in exceptions or len(packages) <= 1:
|
||||
has_duplicates = len(packages) > 1
|
||||
duplicates_allowed = name in exceptions
|
||||
|
||||
if has_duplicates == duplicates_allowed:
|
||||
continue
|
||||
|
||||
message = "duplicate versions for package `{}`".format(name)
|
||||
if duplicates_allowed:
|
||||
message = 'duplicates for `{}` are allowed, but only single version found'.format(name)
|
||||
else:
|
||||
message = "duplicate versions for package `{}`".format(name)
|
||||
|
||||
packages.sort()
|
||||
packages_dependencies = list(find_reverse_dependencies(name, content))
|
||||
for version, source in packages:
|
||||
|
||||
Reference in New Issue
Block a user