19
19
import os
20
20
import re
21
21
import subprocess
22
- import sys
23
22
import xml .etree .ElementTree as ElementTree
24
23
from pathlib import Path
25
24
26
25
import click
27
- from paths import Branch , get_chip_root , get_data_model_path , get_documentation_file_path , get_in_progress_defines
26
+ from chip .testing .spec_parsing import build_xml_clusters
27
+ from paths import get_chip_root , get_documentation_file_path , get_in_progress_defines
28
28
29
29
# Use the get_in_progress_defines() function to fetch the in-progress defines
30
30
CURRENT_IN_PROGRESS_DEFINES = get_in_progress_defines ()
31
31
32
32
# Replace hardcoded paths with dynamic paths using paths.py functions
33
33
DEFAULT_CHIP_ROOT = get_chip_root ()
34
- DEFAULT_OUTPUT_DIR_1_4 = get_data_model_path (Branch .V1_4 )
35
- DEFAULT_OUTPUT_DIR_IN_PROGRESS = get_data_model_path (Branch .IN_PROGRESS )
36
- DEFAULT_OUTPUT_DIR_TOT = get_data_model_path (Branch .MASTER )
37
34
DEFAULT_DOCUMENTATION_FILE = get_documentation_file_path ()
38
35
39
36
@@ -71,6 +68,7 @@ def make_asciidoc(target: str, include_in_progress: str, spec_dir: str, dry_run:
71
68
help = 'Path to the spec root' )
72
69
@click .option (
73
70
'--output-dir' ,
71
+ required = True ,
74
72
help = 'Path to output xml files' )
75
73
@click .option (
76
74
'--dry-run' ,
@@ -81,9 +79,6 @@ def make_asciidoc(target: str, include_in_progress: str, spec_dir: str, dry_run:
81
79
'--include-in-progress' ,
82
80
type = click .Choice (['All' , 'None' , 'Current' ]), default = 'All' )
83
81
def main (scraper , spec_root , output_dir , dry_run , include_in_progress ):
84
- if not output_dir :
85
- output_dir_map = {'All' : DEFAULT_OUTPUT_DIR_TOT , 'None' : DEFAULT_OUTPUT_DIR_1_4 , 'Current' : DEFAULT_OUTPUT_DIR_IN_PROGRESS }
86
- output_dir = output_dir_map [include_in_progress ]
87
82
scrape_clusters (scraper , spec_root , output_dir , dry_run , include_in_progress )
88
83
scrape_device_types (scraper , spec_root , output_dir , dry_run , include_in_progress )
89
84
if not dry_run :
@@ -195,18 +190,12 @@ def dump_versions(scraper, spec_root, output_dir):
195
190
196
191
197
192
def dump_cluster_ids (output_dir ):
198
- python_testing_path = os .path .abspath (
199
- os .path .join (DEFAULT_CHIP_ROOT , 'src' , 'python_testing' ))
200
- sys .path .insert (0 , python_testing_path )
201
193
clusters_output_dir = os .path .abspath (
202
194
os .path .join (output_dir , 'clusters' ))
203
-
204
- from spec_parsing_support import build_xml_clusters
205
-
206
195
header = '# List of currently defined spec clusters\n '
207
196
header += 'This file was **AUTOMATICALLY** generated by `python scripts/generate_spec_xml.py`. DO NOT EDIT BY HAND!\n \n '
208
197
209
- clusters , problems = build_xml_clusters (clusters_output_dir )
198
+ clusters , problems = build_xml_clusters (Path ( clusters_output_dir ) )
210
199
all_name_lens = [len (c .name ) for c in clusters .values ()]
211
200
name_len = max (all_name_lens )
212
201
title_id_decimal = ' ID (Decimal) '
0 commit comments