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