commit: 693d01dc1b9d3b4d854ae02ccf156f6dfa89a7e9
parent 938d9195030246abb619eac3310f3c32a872cbc1
Author: Dor Askayo <dor.askayo@gmail.com>
Date: Fri, 13 Jan 2023 13:15:27 +0200
Set git_dir/sys_dir/cache_dir statically
This allows accessing their values without requiring a class instance.
Diffstat:
3 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/sysa.py b/sysa.py
@@ -14,26 +14,30 @@ import tarfile
from lib.sysgeneral import SysGeneral, stage0_arch_map
# pylint: disable=consider-using-with
+# pylint: disable=too-many-instance-attributes
class SysA(SysGeneral):
"""
Class responsible for preparing sources for System A.
"""
- # pylint: disable=too-many-instance-attributes,too-many-arguments
+
+ git_dir = os.path.dirname(os.path.join(__file__))
+ sys_dir = os.path.join(git_dir, 'sysa')
+ cache_dir = os.path.join(sys_dir, 'distfiles')
+
+ # pylint: disable=too-many-arguments
def __init__(self, arch, preserve_tmp, external_sources,
early_preseed, tmpdir, sysb_dir, sysc_dir):
- self.git_dir = os.path.dirname(os.path.join(__file__))
self.arch = arch
self.preserve_tmp = preserve_tmp
self.early_preseed = early_preseed
- self.sys_dir = os.path.join(self.git_dir, 'sysa')
if tmpdir is None:
self.tmp_dir = os.path.join(self.git_dir, 'tmp')
else:
self.tmp_dir = os.path.join(tmpdir, 'sysa')
self.sysa_dir = os.path.join(self.tmp_dir, 'sysa')
self.base_dir = self.sysa_dir
- self.cache_dir = os.path.join(self.sys_dir, 'distfiles')
+
self.sysb_dir = sysb_dir
self.sysc_dir = sysc_dir
self.external_sources = external_sources
diff --git a/sysb.py b/sysb.py
@@ -12,9 +12,10 @@ class SysB(SysGeneral):
"""
Class responsible for preparing sources for System B.
"""
+
+ git_dir = os.path.dirname(os.path.join(__file__))
+ sys_dir = os.path.join(git_dir, 'sysb')
+
def __init__(self, arch, preserve_tmp):
- self.git_dir = os.path.dirname(os.path.join(__file__))
self.arch = arch
self.preserve_tmp = preserve_tmp
-
- self.sys_dir = os.path.join(self.git_dir, 'sysb')
diff --git a/sysc.py b/sysc.py
@@ -18,16 +18,16 @@ class SysC(SysGeneral):
Class responsible for preparing sources for System C.
"""
+ git_dir = os.path.dirname(os.path.join(__file__))
+ sys_dir = os.path.join(git_dir, 'sysc')
+ cache_dir = os.path.join(sys_dir, 'distfiles')
dev_name = None
def __init__(self, arch, preserve_tmp, tmpdir, external_sources):
- self.git_dir = os.path.dirname(os.path.join(__file__))
self.arch = arch
self.preserve_tmp = preserve_tmp
self.external_sources = external_sources
- self.sys_dir = os.path.join(self.git_dir, 'sysc')
- self.cache_dir = os.path.join(self.sys_dir, 'distfiles')
if tmpdir is None:
self.tmp_dir = os.path.join(self.sys_dir, 'tmp')
else: