Add dependencies manager

Used to generate list of packages dependencies
for different distributions, and should improve
dependencies management by having them in each project.
This tools should gather the reason why a dependency is present,
so one can remove it when unused.

Rename deps script to packages

Move installer/packages to scripts and write tests

Remove packages-list make target
This commit is contained in:
jo 2021-08-17 18:48:25 +02:00
parent 30611f1d80
commit 18f9c81b74
7 changed files with 263 additions and 0 deletions

32
scripts/packages_test.py Normal file
View file

@ -0,0 +1,32 @@
from pathlib import Path
from .packages import list_packages, load_packages
package_ini = """
[common]
postgresql = buster
# Some comment
curl = buster, bionic
[legacy]
apache2 = bionic
[=development]
ffmpeg = buster, bionic
"""
result1 = {"curl", "postgresql"}
result2 = {"apache2", "curl", "ffmpeg"}
def test_load_packages():
assert load_packages(package_ini, "buster", False) == result1
assert load_packages(package_ini, "bionic", True) == result2
def test_list_packages(tmp_path: Path):
package_file = tmp_path / "packages.ini"
package_file.write_text(package_ini)
assert list_packages([tmp_path, package_file], "buster", False) == result1
assert list_packages([tmp_path, package_file], "bionic", True) == result2