Return True or False depending on whether the given version satisfies the github constraint For example: >>> assert github_constraints_satisfied(">= 7.0.0, <= 7.6.57", "7.1.1") == True >>> assert github_constraints_satisfied(">= 10.4.0, <= 10.4.1", "10.6.0") == False
(github_constraint, version)
| 91 | |
| 92 | |
| 93 | def github_constraints_satisfied(github_constraint, version): |
| 94 | """ |
| 95 | Return True or False depending on whether the given version satisfies the github constraint |
| 96 | For example: |
| 97 | >>> assert github_constraints_satisfied(">= 7.0.0, <= 7.6.57", "7.1.1") == True |
| 98 | >>> assert github_constraints_satisfied(">= 10.4.0, <= 10.4.1", "10.6.0") == False |
| 99 | """ |
| 100 | gh_constraints = github_constraint.strip().replace(" ", "") |
| 101 | constraints = gh_constraints.split(",") |
| 102 | for constraint in constraints: |
| 103 | gh_comparator, gh_version = parse_constraint(constraint) |
| 104 | if not gh_version: |
| 105 | continue |
| 106 | if not compare(GenericVersion(version), gh_comparator, GenericVersion(gh_version)): |
| 107 | return False |
| 108 | return True |
| 109 | |
| 110 | |
| 111 | def snyk_constraints_satisfied(snyk_constraint, version): |
no test coverage detected