improve the error messages in the requirements check job
The phrasing and formatting of the existing messages makes it hard for users unfamiliar with the requirements management process to understand what is wrong. This change tries to make the messages clearer, removes an overly verbose error message, and adds a message to handle the case where something is missing from the global list entirely. Change-Id: I40711bf53aac52d534a427f4bdd1a91c20106118 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
parent
427c73372e
commit
773b134b78
@ -105,14 +105,24 @@ def _is_requirement_in_global_reqs(req, global_reqs):
|
|||||||
if req_exclusions.issubset(global_exclusions):
|
if req_exclusions.issubset(global_exclusions):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
difference = global_exclusions - req_exclusions
|
||||||
print(
|
print(
|
||||||
"Requirement for package {} "
|
"Requirement for package {} "
|
||||||
"has an exclusion not found in the "
|
"excludes a version not excluded in the "
|
||||||
"global list: {} vs. {}".format(
|
"global list.\n"
|
||||||
req.package, req_exclusions, global_exclusions)
|
" Local settings : {}\n"
|
||||||
|
" Global settings: {}\n"
|
||||||
|
" Unexpected : {}".format(
|
||||||
|
req.package, req_exclusions, global_exclusions,
|
||||||
|
difference)
|
||||||
)
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
print(
|
||||||
|
"Could not find a global requirements entry to match package {}. "
|
||||||
|
"If the package is already included in the global list, "
|
||||||
|
"the name or platform markers there may not match the local settings."
|
||||||
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
@ -151,9 +161,6 @@ def _validate_one(name, reqs, blacklist, global_reqs):
|
|||||||
counts[''] = counts.get('', 0) + 1
|
counts[''] = counts.get('', 0) + 1
|
||||||
if not _is_requirement_in_global_reqs(
|
if not _is_requirement_in_global_reqs(
|
||||||
req, global_reqs[name]):
|
req, global_reqs[name]):
|
||||||
print("Requirement for package %s: %s does "
|
|
||||||
"not match openstack/requirements value : %s" % (
|
|
||||||
name, str(req), str(global_reqs[name])))
|
|
||||||
return True
|
return True
|
||||||
# check for minimum being defined
|
# check for minimum being defined
|
||||||
min = [s for s in req.specifiers.split(',') if '>' in s]
|
min = [s for s in req.specifiers.split(',') if '>' in s]
|
||||||
|
Loading…
Reference in New Issue
Block a user