Skip to content

Commit 3594ef4

Browse files
committed
pkg.ebuild: dependencies() takes descriptor params directly
Instead of via an iterable.
1 parent 07743d9 commit 3594ef4

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

src/pkgcraft/pkg/ebuild.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ cdef class EbuildPkg(Pkg):
7373
C.pkgcraft_str_free(c_str)
7474
return self._subslot
7575

76-
def dependencies(self, keys=()):
77-
"""Get a package's dependencies for a given iterable of descriptors.
76+
def dependencies(self, *keys):
77+
"""Get a package's dependencies for the given descriptors.
7878
7979
Returns a DepSet encompassing all dependencies when no descriptors are passed.
8080
"""

tests/pkg/test_ebuild.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def test_dependencies(self, ebuild_repo):
6565

6666
# invalid keys
6767
with pytest.raises(PkgcraftError):
68-
pkg.dependencies(["invalid"])
68+
pkg.dependencies("invalid")
6969

7070
# empty deps
7171
deps = pkg.dependencies()
@@ -85,18 +85,19 @@ def test_dependencies(self, ebuild_repo):
8585
assert list(deps.iter_flatten()) == [Atom("a/b"), Atom("cat/pkg")]
8686

8787
# filter by type
88-
deps = pkg.dependencies(["bdepend"])
88+
deps = pkg.dependencies("bdepend")
8989
assert str(deps) == "a/b"
9090
assert list(deps.iter_flatten()) == [Atom("a/b")]
9191

9292
# multiple types with overlapping deps
9393
pkg = ebuild_repo.create_pkg("cat/pkg-1", depend="u? ( cat/pkg )", bdepend="u? ( cat/pkg )")
9494
deps = pkg.dependencies()
95+
assert deps == pkg.dependencies("depend", "bdepend")
9596
assert str(deps) == "u? ( cat/pkg )"
9697
assert list(deps.iter_flatten()) == [Atom("cat/pkg")]
9798

9899
# uppercase and lowercase keys work the same
99-
assert pkg.dependencies(["bdepend"]) == pkg.dependencies(["BDEPEND"])
100+
assert pkg.dependencies("bdepend") == pkg.dependencies("BDEPEND")
100101

101102
def test_dep_attrs(self, ebuild_repo):
102103
for attr in ("depend", "bdepend", "idepend", "pdepend", "rdepend"):

0 commit comments

Comments
 (0)