Skip to content

Commit

Permalink
feat: added dependencies field to package
Browse files Browse the repository at this point in the history
  • Loading branch information
RonTamG committed Jan 7, 2024
1 parent 77ecc64 commit c888006
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ def __init__(self, package_data) -> None:
else:
self.pre_dependencies = []

if "Depends" in values:
self.dependencies = [pack.strip() for pack in values["Depends"].split(",")]
else:
self.dependencies = []

if "Provides" in values:
package_data = package_data.replace(f"Provides: {values['Provides']}\n", "")
provides_list = [value.strip() for value in values["Provides"].split(",")]
Expand Down
18 changes: 18 additions & 0 deletions tests/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ def test_should_have_empty_pre_dependencies_field_if_none_specified():
assert len(package.pre_dependencies) == 0


def test_should_have_a_dependencies_field():
package = Package(valid_package_data())

assert len(package.dependencies) == 2


def test_should_have_empty_dependencies_field_if_none_specified():
package = Package(valid_package_data_without_dependencies())

assert len(package.dependencies) == 0


def test_new_package_should_have_a_none_apt_source_field():
package_data = valid_package_data()

Expand Down Expand Up @@ -183,3 +195,9 @@ def valid_package_data_without_pre_dependencies():
return valid_package_data().replace(
"Pre-Depends: python3-minimal (= 3.11.4-5+b1)\n", ""
)


def valid_package_data_without_dependencies():
return valid_package_data().replace(
"Depends: python3.11 (>= 3.11.4-1~), libpython3-stdlib (= 3.11.4-5+b1)", ""
)

0 comments on commit c888006

Please sign in to comment.