Skip to content

Commit 939eddc

Browse files
run sushi build before generating data dictionary
1 parent d149e23 commit 939eddc

2 files changed

Lines changed: 16 additions & 11 deletions

File tree

apps/bfd-model-idr/gen_dd.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,21 @@
4949
dd_df = []
5050
structure_def_names_descriptions = {}
5151

52+
53+
def run_subprocess(args: list[str]) -> subprocess.CompletedProcess[bytes]:
54+
return subprocess.run(
55+
args,
56+
cwd=Path().parent,
57+
check=True,
58+
stdout=subprocess.PIPE,
59+
)
60+
61+
62+
if not Path("./sushi/fsh-generated/resources").exists():
63+
print("Generating sushi files")
64+
run_subprocess(["npm", "install"])
65+
run_subprocess(["npm", "run", "sushi-build"])
66+
5267
for resource_type in sample_sources_by_profile:
5368
with Path(sample_sources_by_profile[resource_type]).open() as file:
5469
sample_resources_by_profile[resource_type] = json.load(file)
@@ -86,17 +101,6 @@
86101
]
87102

88103

89-
def run_subprocess(args: list[str]) -> subprocess.CompletedProcess[bytes]:
90-
return subprocess.run(
91-
args,
92-
cwd=Path().parent,
93-
check=True,
94-
stdout=subprocess.PIPE,
95-
)
96-
97-
98-
run_subprocess(["npm", "install"])
99-
100104
for walk_info in os.walk(dd_support_folder):
101105
files = list(filter(lambda file: ".yaml" in file, walk_info[2]))
102106
for file_name in files:

apps/bfd-model-idr/generator_util.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ def load_code_systems(self):
338338

339339
# Check if the resources directory exists, if not run sushi build
340340
if not Path(relative_path).exists():
341+
run_command("npm install")
341342
run_command("npm run sushi-build")
342343

343344
try:

0 commit comments

Comments
 (0)