Skip to content

Commit b073ace

Browse files
erikwaolofk
authored andcommitted
Move parsing of libraries in Config to own method
1 parent 6e3be7b commit b073ace

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

fusesoc/config.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,20 @@ def __init__(self, path=None):
4141

4242
os.makedirs(self.cache_root, exist_ok=True)
4343

44+
# Get the environment variable for further cores
45+
env_cores_root = []
46+
if os.getenv("FUSESOC_CORES"):
47+
env_cores_root = os.getenv("FUSESOC_CORES").split(":")
48+
env_cores_root.reverse()
49+
50+
self.libraries = [
51+
Library(root, root) for root in env_cores_root
52+
] + self._parse_library()
53+
54+
logger.debug("cache_root=" + self.cache_root)
55+
logger.debug("library_root=" + self.library_root)
56+
57+
def _parse_library(self):
4458
# Parse library sections
4559
libraries = []
4660
library_sections = [x for x in self._cp.sections() if x.startswith("library")]
@@ -67,16 +81,8 @@ def __init__(self, path=None):
6781
libraries.append(
6882
Library(name, location, sync_type, sync_uri, sync_version, auto_sync)
6983
)
70-
# Get the environment variable for further cores
71-
env_cores_root = []
72-
if os.getenv("FUSESOC_CORES"):
73-
env_cores_root = os.getenv("FUSESOC_CORES").split(":")
74-
env_cores_root.reverse()
75-
76-
self.libraries = [Library(root, root) for root in env_cores_root] + libraries
7784

78-
logger.debug("cache_root=" + self.cache_root)
79-
logger.debug("library_root=" + self.library_root)
85+
return libraries
8086

8187
def __enter__(self):
8288
return self

0 commit comments

Comments
 (0)