commit:     f140497351d9e4323853ddb15f904092e574c11b
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 16 22:04:26 2021 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Mon Jan 18 03:27:41 2021 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=f1404973

catalyst: Make arch_dir a Path

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 catalyst/base/stagebase.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index ed4d1227..8d8d01d1 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -90,14 +90,14 @@ class StageBase(TargetBase, ClearBase, GenBase):
             build = platform.machine()
         self.settings["buildarch"] = build
 
-        arch_dir = normpath(self.settings['sharedir'] + '/arch/')
+        arch_dir = Path(self.settings['sharedir']) / 'arch'
 
         log.debug("Searching arch definitions...")
-        for x in [x for x in os.listdir(arch_dir) if x.endswith('.toml')]:
+        for x in [x for x in arch_dir.iterdir() if x.suffix == 'toml']:
             log.debug("\tTrying %s", x)
-            name = x[:-len('.toml')]
+            name = x.stem
 
-            with open(arch_dir + x) as file:
+            with x.open() as file:
                 arch_config = toml.load(file)
 
                 # Search for a subarchitecture in each arch in the arch_config

Reply via email to