-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: rework minimum requirements check
- Loading branch information
Showing
5 changed files
with
37 additions
and
68 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,32 @@ | ||
#!/usr/bin/env python3 | ||
|
||
"""Installs the minimum version of all stactools dependencies, with pip. | ||
Assumptions: | ||
- You've installed the development dependencies: `pip install -r requirements-dev.txt | ||
- All of the dependencies in setup.cfg are specified with `>=` | ||
""" | ||
|
||
import subprocess | ||
from configparser import ConfigParser | ||
from pathlib import Path | ||
|
||
from packaging.requirements import Requirement | ||
|
||
root = Path(__file__).parents[1] | ||
setup_cfg = ConfigParser() | ||
setup_cfg.read(root / "setup.cfg") | ||
requirements = [] | ||
for install_requires in filter( | ||
bool, | ||
(i.strip() for i in setup_cfg["options"]["install_requires"].splitlines()), | ||
): | ||
requirement = Requirement(install_requires) | ||
assert len(requirement.specifier) == 1 | ||
specifier = list(requirement.specifier)[0] | ||
assert specifier.operator == ">=" | ||
install_requires = install_requires.replace(">=", "==") | ||
requirements.append(install_requires) | ||
|
||
subprocess.run(["pip", "install", *requirements]) |