mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-29 20:34:22 +01:00
Updated for naming
This commit is contained in:
parent
b1533c8b9f
commit
d4bd8bd70b
2 changed files with 23 additions and 23 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue