diff --git a/slpkg/binaries/required.py b/slpkg/binaries/required.py index 024fe294..53984564 100644 --- a/slpkg/binaries/required.py +++ b/slpkg/binaries/required.py @@ -11,7 +11,7 @@ class Required: the right order to install. """ __slots__ = ( 'data', 'name', 'repos', - 'special_repos', 'repo', 'packages' + 'special_repos', 'repo', 'repository_packages' ) def __init__(self, data: dict, name: str): @@ -28,33 +28,33 @@ class Required: ] self.repo: str = data[name]['repository'] - self.packages: tuple = tuple(self.data.keys()) + self.repository_packages: tuple = tuple(self.data.keys()) def resolve(self) -> tuple: """ Resolve the dependencies. """ - required: list[str] = list( + requires: list[str] = list( self.remove_deps(self.data[self.name]['requires'].split()) ) # Resolve dependencies for some special repos. if self.repo in self.special_repos: - for req in required: - if req not in self.packages: - required.remove(req) + for require in requires: + if require not in self.repository_packages: + requires.remove(require) else: - for req in required: - sub_required: list[str] = list( - self.remove_deps(self.data[req]['requires'].split()) + for require in requires: + sub_requires: list[str] = list( + self.remove_deps(self.data[require]['requires'].split()) ) - for sub in sub_required: - required.append(sub) + for sub in sub_requires: + requires.append(sub) - required.reverse() - return tuple(dict.fromkeys(required)) + requires.reverse() + return tuple(dict.fromkeys(requires)) def remove_deps(self, requires: list) -> Generator: """ Remove requires that not in the repository or blacklisted. """ - for dep in requires: - if dep in self.packages: - yield dep + for dependency in requires: + if dependency in self.repository_packages: + yield dependency diff --git a/slpkg/sbos/dependencies.py b/slpkg/sbos/dependencies.py index d945ff25..b60c7450 100644 --- a/slpkg/sbos/dependencies.py +++ b/slpkg/sbos/dependencies.py @@ -7,12 +7,12 @@ from typing import Generator class Requires: """ Creates a tuple of dependencies with the right order to install. """ - __slots__ = ('data', 'name', 'packages') + __slots__ = ('data', 'name', 'repository_packages') def __init__(self, data: dict, name: str): self.data: dict = data self.name: str = name - self.packages: tuple = tuple(data.keys()) + self.repository_packages: tuple = tuple(data.keys()) def resolve(self) -> tuple: """ Resolve the dependencies. """ @@ -20,9 +20,9 @@ class Requires: self.remove_deps(self.data[self.name]['requires'].split()) ) - for req in requires: + for require in requires: sub_requires: list[str] = list( - self.remove_deps(self.data[req]['requires'].split()) + self.remove_deps(self.data[require]['requires'].split()) ) for sub in sub_requires: requires.append(sub) @@ -33,6 +33,6 @@ class Requires: def remove_deps(self, requires: list) -> Generator: """ Remove requires that not in the repository or blacklisted. """ - for dep in requires: - if dep in self.packages: - yield dep + for dependency in requires: + if dependency in self.repository_packages: + yield dependency