@@ -118,11 +118,14 @@ def remove_old_manifests(wiki_dir: Path) -> None:
118
118
LOGGER .info (f"Removed manifest: { file .relative_to (wiki_dir )} " )
119
119
120
120
121
- def update_wiki (wiki_dir : Path , hist_lines_dir : Path , manifests_dir : Path ) -> None :
121
+ def update_wiki (
122
+ wiki_dir : Path , hist_lines_dir : Path , manifests_dir : Path , allow_no_files : bool
123
+ ) -> None :
122
124
LOGGER .info ("Updating wiki" )
123
125
124
126
manifest_files = list (manifests_dir .rglob ("*.md" ))
125
- assert manifest_files , "expected to have some manifest files"
127
+ if not allow_no_files :
128
+ assert manifest_files , "expected to have some manifest files"
126
129
for manifest_file in manifest_files :
127
130
year_month = get_manifest_year_month (manifest_file )
128
131
year = year_month [:4 ]
@@ -132,7 +135,10 @@ def update_wiki(wiki_dir: Path, hist_lines_dir: Path, manifests_dir: Path) -> No
132
135
LOGGER .info (f"Added manifest file: { copy_to .relative_to (wiki_dir )} " )
133
136
134
137
build_history_line_files = sorted (hist_lines_dir .rglob ("*.txt" ))
135
- assert build_history_line_files , "expected to have some build history line files"
138
+ if not allow_no_files :
139
+ assert (
140
+ build_history_line_files
141
+ ), "expected to have some build history line files"
136
142
for build_history_line_file in build_history_line_files :
137
143
build_history_line = build_history_line_file .read_text ()
138
144
assert build_history_line .startswith ("| `" )
@@ -165,6 +171,13 @@ def update_wiki(wiki_dir: Path, hist_lines_dir: Path, manifests_dir: Path) -> No
165
171
type = Path ,
166
172
help = "Directory with manifest files" ,
167
173
)
174
+ arg_parser .add_argument (
175
+ "--allow-no-files" ,
176
+ action = "store_true" ,
177
+ help = "Allow no manifest or history line files" ,
178
+ )
168
179
args = arg_parser .parse_args ()
169
180
170
- update_wiki (args .wiki_dir , args .hist_lines_dir , args .manifests_dir )
181
+ update_wiki (
182
+ args .wiki_dir , args .hist_lines_dir , args .manifests_dir , args .allow_no_files
183
+ )
0 commit comments