-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
60 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,19 @@ | ||
pytest~=7.2.2 | ||
black~=23.1.0 | ||
codespell~=2.2.4 | ||
coverage~=7.2 | ||
doc8~=1.1.1 | ||
importlib-metadata~=6.1.0 | ||
jsonschema~=4.17.3 | ||
mypy~=1.1 | ||
orjson==3.8.8 | ||
pre-commit==3.2.0 | ||
pytest-benchmark~=4.0.0 | ||
pytest-console-scripts~=1.3.1 | ||
pytest-cov~=4.0.0 | ||
pytest-recording~=0.12.2 | ||
pytest-console-scripts~=1.3.1 | ||
pytest~=7.2.2 | ||
recommonmark~=0.7.1 | ||
requests-mock~=1.10.0 | ||
|
||
mypy~=1.1 | ||
types-requests~=2.28.11 | ||
types-python-dateutil~=2.8.19 | ||
ruff==0.0.257 | ||
black~=23.1.0 | ||
codespell~=2.2.4 | ||
|
||
jsonschema~=4.17.3 | ||
coverage~=7.2 | ||
doc8~=1.1.1 | ||
|
||
pre-commit==3.2.0 | ||
|
||
# optional dependencies | ||
orjson==3.8.8 | ||
types-python-dateutil~=2.8.19 | ||
types-requests~=2.28.11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import sys | ||
from pathlib import Path | ||
|
||
import importlib_metadata | ||
from packaging.requirements import Requirement | ||
|
||
requirements_min = Path(__file__).parents[1] / "requirements-min.txt" | ||
with open(requirements_min) as file: | ||
min_requirements = [Requirement(line) for line in file] | ||
min_requirements = dict( | ||
(requirement.name, requirement) for requirement in min_requirements | ||
) | ||
|
||
package_requirements = [ | ||
Requirement(requirement) | ||
for requirement in importlib_metadata.requires("pystac_client") | ||
] | ||
incorrect_requirements = list() | ||
for package_requirement in package_requirements: | ||
if package_requirement.marker is not None: | ||
continue | ||
if package_requirement.name not in min_requirements: | ||
incorrect_requirements.append((package_requirement, None)) | ||
continue | ||
min_requirement = min_requirements[package_requirement.name] | ||
for package_specifier, min_specifier in zip( | ||
package_requirement.specifier, min_requirement.specifier | ||
): | ||
if ( | ||
package_specifier.operator == ">=" | ||
and package_specifier.version != min_specifier.version | ||
): | ||
incorrect_requirements.append((package_requirement, min_requirement)) | ||
|
||
if incorrect_requirements: | ||
print("ERROR: Incorrect min-requirements.txt!") | ||
for package_requirement, min_requirement in incorrect_requirements: | ||
print(f"- package: {package_requirement}, min: {min_requirement}") | ||
sys.exit(1) | ||
else: | ||
print("OK") | ||
sys.exit(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters