Replace list of cr.packages by cr.PackageIterator #7

Merged
soksanichenko merged 2 commits from package_iterator_aln9 into aln9 2022-10-19 01:38:37 +00:00
Showing only changes of commit f98f1b20ab - Show all commits

View File

@ -1,6 +1,6 @@
import os
import subprocess
import time
from pathlib import Path
from attr import dataclass
from kobo.rpmlib import parse_nvra
@ -48,14 +48,14 @@ class KojiMock:
self._modules_dir = modules_dir
self._packages_dir = packages_dir
def _gather_modules(self, modules_dir):
@staticmethod
def _gather_modules(modules_dir):
modules = {}
for arch in os.listdir(modules_dir):
arch_dir = os.path.join(
modules_dir,
arch,
)
for index, f in enumerate(os.listdir(arch_dir)):
for index, (f, arch) in enumerate(
(sub_path.name, sub_path.parent.name)
for path in Path(modules_dir).glob('*')
for sub_path in path.iterdir()
):
parsed = parse_nvra(f)
modules[index] = Module(
name=parsed['name'],
@ -68,7 +68,8 @@ class KojiMock:
)
return modules
def getLastEvent(self, *args, **kwargs):
@staticmethod
def getLastEvent(*args, **kwargs):
return {'id': LAST_EVENT_ID, 'ts': LAST_EVENT_TIME}
def listTagged(self, tag_name, *args, **kwargs):
@ -111,7 +112,8 @@ class KojiMock:
return builds
def getFullInheritance(self, *args, **kwargs):
@staticmethod
def getFullInheritance(*args, **kwargs):
"""
Unneeded because we use local storage.
"""