mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-29 20:34:22 +01:00
Updated for load data
This commit is contained in:
parent
01d74a23b2
commit
597e6491d8
1 changed files with 37 additions and 30 deletions
|
@ -224,39 +224,46 @@ class Utilities(Configs):
|
|||
data: dict = self.read_json_file(json_data_file)
|
||||
|
||||
blacklist: tuple = self.black.packages()
|
||||
|
||||
if blacklist:
|
||||
if repository == '*':
|
||||
# Remove blacklist packages from keys.
|
||||
for name, repo in data.items():
|
||||
blacklist_packages: list = self.ignore_packages(list(data[name].keys()))
|
||||
for pkg in blacklist_packages:
|
||||
if pkg in data[name].keys():
|
||||
del data[name][pkg]
|
||||
|
||||
# Remove blacklist packages from dependencies (values).
|
||||
for name, repo in data.items():
|
||||
blacklist_packages: list = self.ignore_packages(list(data[name].keys()))
|
||||
for pkg, dep in repo.items():
|
||||
deps = dep['requires']
|
||||
for blk in blacklist_packages:
|
||||
if blk in deps:
|
||||
deps.remove(blk)
|
||||
data[name][pkg]['requires'] = deps
|
||||
self._remove_blacklist_from_all_repos(data)
|
||||
else:
|
||||
blacklist_packages: list = self.ignore_packages(list(data.keys()))
|
||||
# Remove blacklist packages from keys.
|
||||
for pkg in blacklist_packages:
|
||||
if pkg in data.keys():
|
||||
del data[pkg]
|
||||
|
||||
# Remove blacklist packages from dependencies (values).
|
||||
for pkg, dep in data.items():
|
||||
deps = dep['requires']
|
||||
for blk in blacklist_packages:
|
||||
if blk in deps:
|
||||
deps.remove(blk)
|
||||
data[pkg]['requires'] = deps
|
||||
self._remove_blacklist_from_a_repo(data)
|
||||
|
||||
print(f'{self.yellow}{self.ascii.done}{self.endc}')
|
||||
return data
|
||||
|
||||
def _remove_blacklist_from_all_repos(self, data: dict) -> dict:
|
||||
# Remove blacklist packages from keys.
|
||||
for name, repo in data.items():
|
||||
blacklist_packages: list = self.ignore_packages(list(data[name].keys()))
|
||||
for pkg in blacklist_packages:
|
||||
if pkg in data[name].keys():
|
||||
del data[name][pkg]
|
||||
|
||||
# Remove blacklist packages from dependencies (values).
|
||||
for name, repo in data.items():
|
||||
blacklist_packages: list = self.ignore_packages(list(data[name].keys()))
|
||||
for pkg, dep in repo.items():
|
||||
deps: list = dep['requires']
|
||||
for blk in blacklist_packages:
|
||||
if blk in deps:
|
||||
deps.remove(blk)
|
||||
data[name][pkg]['requires'] = deps
|
||||
return data
|
||||
|
||||
def _remove_blacklist_from_a_repo(self, data: dict) -> dict:
|
||||
blacklist_packages: list = self.ignore_packages(list(data.keys()))
|
||||
# Remove blacklist packages from keys.
|
||||
for pkg in blacklist_packages:
|
||||
if pkg in data.keys():
|
||||
del data[pkg]
|
||||
|
||||
# Remove blacklist packages from dependencies (values).
|
||||
for pkg, dep in data.items():
|
||||
deps: list = dep['requires']
|
||||
for blk in blacklist_packages:
|
||||
if blk in deps:
|
||||
deps.remove(blk)
|
||||
data[pkg]['requires'] = deps
|
||||
return data
|
||||
|
|
Loading…
Add table
Reference in a new issue