Repository navigation
Expand file tree
/
Copy pathbuild_docs.py
More file actions
634 lines (521 loc) · 22.2 KB
/
Copy pathbuild_docs.py
File metadata and controls
634 lines (521 loc) · 22.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
import hashlib
import json
import os
import re
import subprocess
import requests
import shutil
import logging
import sys
from datetime import datetime, timezone
from shutil import copyfile
from dotenv import load_dotenv
from typing import Optional
from bs4 import BeautifulSoup
from huggingface_hub import snapshot_download
load_dotenv()
source_dict: dict[str, str] = {}
# This code must in run in ./backend
cur_dir = os.path.dirname(os.path.abspath(__file__))
os.chdir(cur_dir)
OR_REPO_URL = "https://github.com/The-OpenROAD-Project/OpenROAD.git"
ORFS_REPO_URL = "https://github.com/The-OpenROAD-Project/OpenROAD-flow-scripts.git"
# The gh_discussions files come from this dataset commit (2024-09-10), not
# from main, so that a rebuild does not take in a new upload by accident.
GH_DISCUSSIONS_REVISION = "0cc9586013d96a8e158e83dd6608e9597d4e4883"
opensta_repo_commit = os.getenv(
"OPENSTA_REPO_COMMIT", "1c7f022cd0a02ce71d047aa3dbb64e924b6efbd5"
)
or_docs_url = "https://openroad.readthedocs.io/en/latest"
orfs_docs_url = "https://openroad-flow-scripts.readthedocs.io/en/latest"
opensta_docs_url = (
"https://github.com/The-OpenROAD-Project/OpenSTA/raw/"
f"{opensta_repo_commit}/doc/OpenSTA.pdf"
)
yosys_html_url = "https://yosyshq.readthedocs.io/projects/yosys/en/latest"
klayout_html_url = "https://www.klayout.de/doc.html"
or_website_url = "https://openroad.org/"
opensta_readme_url = (
"https://raw.githubusercontent.com/The-OpenROAD-Project/OpenSTA/"
f"{opensta_repo_commit}/README.md"
)
or_publications_url = "https://openroad.org/resources/publications"
# Tool papers that the publications page does not list, as (URL, file name).
# Use author, institution, or arXiv copies with a fixed version.
EXTRA_PAPERS = [
# FastRoute, VLSI Design 2012 (Iowa State University repository copy).
(
"https://dr.lib.iastate.edu/server/api/core/bitstreams/"
"49638cfc-c010-449c-a3f0-da6d4ddb978f/content",
"FastRoute_VLSI_Design_2012.pdf",
),
# RTL-MP, ISPD 2022 (UCSD VLSI CAD lab copy).
("https://vlsicad.ucsd.edu/Publications/Conferences/389/c389.pdf", "c389.pdf"),
# Hier-RTLMP, arXiv 2304.11761 version 2.
("https://arxiv.org/pdf/2304.11761v2", "Hier-RTLMP_arXiv_2304_11761v2.pdf"),
]
logging.basicConfig(level=os.environ.get("LOGLEVEL", "INFO").upper())
def update_src(src_path: str, dst_path: str) -> None:
# Match website pages first: a page name can contain "yosys" or "klayout".
if dst_path.startswith("data/html/or_website/"):
page = dst_path.removeprefix("data/html/or_website/")
if page.endswith("/index.html"):
page = page.removesuffix("index.html")
else:
page = page.removesuffix(".html")
source_dict[dst_path] = f"https://{page}"
elif "OR_docs" in dst_path:
source_dict[dst_path] = (
f"{or_docs_url}/{src_path.split('_sources/')[-1].replace('.md', '.html')}"
)
elif "ORFS_docs" in dst_path:
source_dict[dst_path] = (
f"{orfs_docs_url}/{src_path.split('_sources/')[-1].replace('.md', '.html')}"
)
elif "manpages" in dst_path:
manpage_path = dst_path.replace("data/markdown/", "markdown/")
source_dict[dst_path] = (
f"https://huggingface.co/datasets/The-OpenROAD-Project/ORAssistant_RAG_Dataset/raw/main/{manpage_path}"
)
elif "yosys" in dst_path:
source_dict[dst_path] = f"https://{dst_path[len('data/html/yosys_docs') :]}"
elif "klayout" in dst_path:
source_dict[dst_path] = f"https://{dst_path[len('data/html/klayout_docs') :]}"
elif "OpenSTA" in dst_path and "pdf" in dst_path:
source_dict[dst_path] = opensta_docs_url
elif "OpenSTA" in dst_path and "markdown" in dst_path:
source_dict[dst_path] = opensta_readme_url
else:
source_dict[dst_path] = dst_path
def purge_folders(folder_paths: list[str]) -> None:
for folder_path in folder_paths:
if os.path.exists(folder_path):
shutil.rmtree(folder_path)
logging.debug(f"Purging, Folder {folder_path} deleted.")
def track_src(src: str) -> None:
logging.debug(f"Updating source dict for {src}...")
if not os.path.exists(src):
logging.error(f"File {src} does not exist. Exiting.")
sys.exit(1)
for root, _, files in os.walk(src):
for file in files:
src = os.path.join(root, file)
src_path = src.split("backend/")[-1]
update_src(src_path, src_path)
def copy_file_track_src(src: str, dst: str) -> None:
if not os.path.exists(src):
logging.error(f"File {src} does not exist. Exiting.")
sys.exit(1)
if os.path.isfile(src):
if os.path.exists(dst):
base, ext = os.path.splitext(dst)
counter = 2
while os.path.exists(dst):
new_file_name = f"{base}_{counter}{ext}"
logging.debug(f"File {dst} already exists. Renaming to {new_file_name}")
dst = new_file_name
counter += 1
shutil.copy2(src, dst)
dst_path = dst.split("backend/")[-1]
update_src(src, dst_path)
def copy_tree_track_src(src: str, dst: str) -> None:
if not os.path.exists(src):
logging.debug(f"Folder {src} does not exist. Exiting.")
sys.exit(1)
for root, _, files in os.walk(src):
rel_path = os.path.relpath(root, src)
dst_dir = dst if rel_path == "." else os.path.join(dst, rel_path)
os.makedirs(dst_dir, exist_ok=True)
for file in files:
src_file = os.path.join(root, file)
dst_file = os.path.join(dst_dir, file)
if os.path.exists(dst_file):
base, ext = os.path.splitext(file)
counter = 2
while os.path.exists(dst_file):
new_file_name = f"{base}_{counter}{ext}"
dst_file = os.path.join(dst_dir, new_file_name)
logging.debug(
f"File {dst_file} already exists. Renaming to {new_file_name}"
)
counter += 1
shutil.copy2(src_file, dst_file)
dst_path = dst_file.split("backend/")[-1]
update_src(src_file, dst_path)
def resolve_repo_commit(env_var: str, url: str) -> str:
"""Return the commit set in env_var, else the current master HEAD of url."""
commit = os.getenv(env_var)
if commit:
return commit
command = ["git", "ls-remote", url, "refs/heads/master"]
res = subprocess.run(command, capture_output=True, text=True)
if res.returncode != 0 or not res.stdout.strip():
logging.error(f"Cannot resolve master of {url}: {res.stderr}")
sys.exit(1)
return res.stdout.split()[0]
def clone_repo(url: str, folder_name: str, commit_hash: Optional[str] = None) -> None:
target_dir = os.path.join(cur_dir, folder_name)
logging.debug(f"Cloning repo from {url} to {target_dir}...")
command = f"git clone {url} {target_dir}"
res = subprocess.run(command, shell=True, capture_output=True)
if res.returncode != 0:
logging.debug(f"Error in cloning repo: {res.stderr.decode('utf-8')}")
sys.exit(1)
if commit_hash:
os.chdir(target_dir)
command = f"git fetch origin {commit_hash} && git checkout {commit_hash}"
res = subprocess.run(command, shell=True, capture_output=True)
if res.returncode != 0:
logging.debug(
f"Error in checking out commit hash: {res.stderr.decode('utf-8')}"
)
sys.exit(1)
logging.debug("Cloned repo successfully.")
def run_build_step(command: str) -> None:
"""Run a shell build command in the current directory. Exit if it fails."""
res = subprocess.run(command, shell=True, capture_output=True)
if res.returncode != 0:
logging.error(
f"'{command}' failed in {os.getcwd()} with exit code {res.returncode}:\n"
f"{res.stderr.decode('utf-8', errors='replace')}"
)
sys.exit(1)
def build_or_docs() -> None:
logging.debug("Starting OR docs build...")
os.chdir(os.path.join(cur_dir, "OpenROAD/docs"))
run_build_step("make html")
logging.debug("Copying OR docs...")
os.chdir(cur_dir)
md_or_docs = os.path.join(cur_dir, "OpenROAD/docs/build/html/_sources")
if not os.path.isdir(md_or_docs):
logging.debug(f"Directory {md_or_docs} does not exist. Exiting.")
sys.exit(1)
copy_tree_track_src(
f"{md_or_docs}/user", f"{cur_dir}/data/markdown/OR_docs/installation"
)
copy_tree_track_src(f"{md_or_docs}/main", f"{cur_dir}/data/markdown/OR_docs/tools")
copy_file_track_src(
f"{md_or_docs}/main/README.md",
f"{cur_dir}/data/markdown/OR_docs/general/README.md",
)
copy_tree_track_src(
f"{md_or_docs}/tutorials", f"{cur_dir}/data/markdown/OR_docs/general"
)
copy_tree_track_src(
f"{md_or_docs}/contrib", f"{cur_dir}/data/markdown/OR_docs/general"
)
copy_tree_track_src(
f"{md_or_docs}/src/test", f"{cur_dir}/data/markdown/OR_docs/general"
)
for file in os.listdir(f"{md_or_docs}"):
if file.endswith(".md"):
copyfile(
f"{md_or_docs}/{file}",
f"{cur_dir}/data/markdown/OR_docs/general/{file}",
)
logging.debug("Finished building OR docs.")
return
def build_orfs_docs() -> None:
logging.debug("Starting ORFS docs build...")
os.chdir(os.path.join(cur_dir, "OpenROAD-flow-scripts/docs"))
run_build_step("make html")
logging.debug("Copying ORFS docs...")
os.chdir(cur_dir)
md_orfs_docs = os.path.join(
cur_dir, "OpenROAD-flow-scripts/docs/build/html/_sources"
)
if not os.path.isdir(md_orfs_docs):
logging.debug(f"Directory {md_orfs_docs} does not exist. Exiting.")
sys.exit(1)
copy_tree_track_src(
f"{md_orfs_docs}/tutorials", f"{cur_dir}/data/markdown/ORFS_docs/general"
)
copy_tree_track_src(
f"{md_orfs_docs}/contrib", f"{cur_dir}/data/markdown/ORFS_docs/general"
)
installation_files = [
"FAQS.md",
"BuildLocally.md",
"BuildWithDocker.md",
"BuildWithPrebuilt.md",
"BuildWithWSL.md",
"SupportedOS.md",
"index2.md",
]
for file in os.listdir(f"{md_orfs_docs}/user"):
if file.endswith(".md"):
if file in installation_files:
copy_file_track_src(
f"{md_orfs_docs}/user/{file}",
f"{cur_dir}/data/markdown/ORFS_docs/installation/{file}",
)
else:
copy_file_track_src(
f"{md_orfs_docs}/user/{file}",
f"{cur_dir}/data/markdown/ORFS_docs/general/{file}",
)
for file in os.listdir(f"{md_orfs_docs}/"):
if file.endswith(".md"):
if file in installation_files:
copy_file_track_src(
f"{md_orfs_docs}/{file}",
f"{cur_dir}/data/markdown/ORFS_docs/installation/{file}",
)
else:
copy_file_track_src(
f"{md_orfs_docs}/{file}",
f"{cur_dir}/data/markdown/ORFS_docs/general/{file}",
)
logging.debug("Finished building ORFS docs.")
return
def build_manpages() -> None:
logging.debug("Starting manpages build...")
res = subprocess.run("pandoc --version", shell=True, capture_output=True)
if res.returncode != 0:
logging.error("Pandoc is not installed. Please install it.")
sys.exit(1)
logging.debug("Pandoc is installed.")
command = "../../etc/find_messages.py > messages.txt"
for module in os.listdir(os.path.join(cur_dir, "OpenROAD/src")):
path = os.path.join(cur_dir, "OpenROAD/src", module)
if not os.path.isdir(path):
continue
os.chdir(path)
res = subprocess.run(command, shell=True, capture_output=True)
if res.returncode != 0:
logging.error(
f"Error in finding messages for {module}: {res.stderr.decode('utf-8')}"
)
continue
os.chdir(os.path.join(cur_dir, "OpenROAD/docs"))
num_cores = os.cpu_count()
run_build_step(f"make clean && make preprocess && make -j{num_cores}")
logging.debug("Finished building manpages.")
src_dir = os.path.join(cur_dir, "OpenROAD/docs/md")
dest_dir = os.path.join(cur_dir, "data/markdown/manpages")
copy_tree_track_src(src_dir, dest_dir)
logging.debug("Copied manpages to data/markdown/manpages.")
logging.debug("Finished building manpages.")
return
def get_opensta_docs() -> None:
os.chdir(cur_dir)
response = requests.get(opensta_docs_url)
save_path = "data/pdf/OpenSTA/OpenSTA_docs.pdf"
os.makedirs(os.path.dirname(save_path), exist_ok=True)
if response.status_code == 200:
with open(save_path, "wb+") as file:
file.write(response.content)
logging.debug("OpenSTA docs downloaded successfully.")
else:
logging.debug("Failed to download file. Status code:", response.status_code)
response = requests.get(opensta_readme_url)
save_path = "data/markdown/OpenSTA_docs/OpenSTA_readme.md"
os.makedirs(os.path.dirname(save_path), exist_ok=True)
if response.status_code == 200:
with open(save_path, "wb+") as file:
file.write(response.content)
logging.debug("OpenSTA readme downloaded successfully.")
else:
logging.debug("Failed to download file. Status code:", response.status_code)
track_src(f"{cur_dir}/data/markdown/OpenSTA_docs")
track_src(f"{cur_dir}/data/pdf/OpenSTA")
# The news index, its later pages, and the category pages repeat the text of
# the posts that they link to.
LISTING_PAGE_RE = re.compile(r"(^|/)(news|news/[0-9]+|category/[^/]+)\.html$")
def prune_or_website(folder: str) -> None:
"""Keep only the HTML pages of a website crawl that have unique text.
The crawl must follow the listing pages to find the posts, so they are
removed only after it. Files that are not HTML, such as robots.txt, are
removed too. When pages have the same words, keep the shortest path, as
a copy often has a suffix such as "-2".
"""
pages_by_text: dict[str, list[str]] = {}
for root, _, files in os.walk(folder):
for file in files:
path = os.path.join(root, file)
rel_path = os.path.relpath(path, folder)
if not file.endswith(".html") or LISTING_PAGE_RE.search(rel_path):
os.remove(path)
continue
with open(path, encoding="utf-8", errors="replace") as f:
text = BeautifulSoup(f.read(), "html.parser").get_text()
# Copies of one post can differ in spaces, punctuation, and
# symbols such as a trademark sign. Compare only words and numbers.
words = re.sub(r"[\W_]+", "", text.lower())
digest = hashlib.sha256(words.encode()).hexdigest()
pages_by_text.setdefault(digest, []).append(path)
for paths in pages_by_text.values():
keep = min(paths, key=lambda path: (len(path), path))
for path in paths:
if path != keep:
logging.debug(f"Removing {path}: same text as {keep}")
os.remove(path)
def get_or_website_html() -> None:
logging.debug("Scraping OR website...")
try:
subprocess.run(
# The site links pages without a file extension. Accept only such
# URLs, which skips images, styles, and scripts. Save pages as
# .html.
"wget -r --adjust-extension"
" --accept-regex '^https://openroad\\.org/([^./?#]+/?)*$'"
f" -P data/html/or_website {or_website_url}",
shell=True,
)
except Exception as e:
logging.debug(f"Error in downloading OR website docs: {e}")
sys.exit(1)
logging.debug("OR website docs downloaded successfully.")
prune_or_website(f"{cur_dir}/data/html/or_website")
track_src(f"{cur_dir}/data/html/or_website")
def get_or_publications() -> None:
# TODO: verify if this is indeed all publications. New format seem to truncate to 10 latest.
try:
response = requests.get(or_publications_url)
if response.status_code != 200:
logging.error(
f"{or_publications_url} returned HTTP {response.status_code}."
)
sys.exit(1)
soup = BeautifulSoup(response.text, "html.parser")
links = soup.find_all("a")
papers = []
for link in links:
href = link.get("href")
# The page can link one paper more than once. Download it once.
if href and ".pdf" in href and href not in papers:
papers.append(href)
if not papers:
logging.error(f"Found no papers on {or_publications_url}.")
sys.exit(1)
downloads = [(url, url.split("/")[-1]) for url in papers]
downloads += [(url, name) for url, name in EXTRA_PAPERS if url not in papers]
for paper_link, paper_name in downloads:
logging.debug(f"Downloading {paper_name}. . .")
counter = 2
while os.path.exists(f"{cur_dir}/data/pdf/OR_publications/{paper_name}"):
logging.debug(f"File {paper_name} already exists. Renaming. . .")
paper_name = f"{paper_name.split('.')[0]}_{counter}.pdf"
counter += 1
paper_path = f"data/pdf/OR_publications/{paper_name}"
res = subprocess.run(["wget", paper_link, "-O", paper_path])
if res.returncode != 0 or os.path.getsize(paper_path) == 0:
logging.error(
f"Download of {paper_link} failed (wget exit code "
f"{res.returncode})."
)
sys.exit(1)
source_dict[paper_path] = paper_link
except Exception as e:
logging.error(f"Error in downloading OR publications: {e}")
sys.exit(1)
logging.debug("OR publications downloaded successfully.")
def get_yosys_docs_html() -> None:
logging.debug("Scraping Yosys RT docs...")
try:
subprocess.run(
f"wget -r -A.html -P data/html/yosys_docs {yosys_html_url} ",
shell=True,
)
except Exception as e:
logging.debug(f"Error in downloading Yosys docs: {e}")
sys.exit(1)
logging.debug("Yosys docs downloaded successfully.")
track_src(f"{cur_dir}/data/html/yosys_docs")
def get_klayout_docs_html() -> None:
logging.debug("Scraping KLayout docs...")
try:
subprocess.run(
f"wget -r -A.html -l 3 -P data/html/klayout_docs {klayout_html_url} ",
shell=True,
)
except Exception as e:
logging.debug(f"Error in downloading KLayout docs: {e}")
sys.exit(1)
logging.debug("KLayout docs downloaded successfully.")
track_src(f"{cur_dir}/data/html/klayout_docs")
def write_source_list() -> None:
"""Add the gh_discussions URLs to the source map and write it to disk."""
with open(f"{cur_dir}/data/markdown/gh_discussions/mapping.json") as gh_disc:
gh_disc_src = json.load(gh_disc)
gh_disc_path = "data/markdown/gh_discussions"
for file in gh_disc_src.keys():
full_path = os.path.join(gh_disc_path, file)
source_dict[full_path] = gh_disc_src[file]["url"]
with open(f"{cur_dir}/data/source_list.json", "w+") as src:
src.write(json.dumps(source_dict))
def write_build_info(commits: dict[str, str], crawl_date: str) -> None:
"""Record the inputs of this build in data/BUILD_INFO.json."""
paper_urls = sorted(
url
for path, url in source_dict.items()
if path.startswith("data/pdf/OR_publications/")
)
build_info = {
"crawl_date": crawl_date,
"commits": {**commits, "OpenSTA": opensta_repo_commit},
"gh_discussions_revision": GH_DISCUSSIONS_REVISION,
"paper_urls": paper_urls,
}
with open(f"{cur_dir}/data/BUILD_INFO.json", "w") as f:
json.dump(build_info, f, indent=2)
f.write("\n")
if __name__ == "__main__":
logging.info("Building knowledge base...")
crawl_date = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
commits = {
"OpenROAD": resolve_repo_commit("OR_REPO_COMMIT", OR_REPO_URL),
"OpenROAD-flow-scripts": resolve_repo_commit("ORFS_REPO_COMMIT", ORFS_REPO_URL),
}
docs_paths = ["data"]
purge_folders(folder_paths=docs_paths)
os.makedirs("data/markdown/manpages", exist_ok=True)
os.makedirs("data/markdown/OR_docs", exist_ok=True)
os.makedirs("data/markdown/OR_docs/installation", exist_ok=True)
os.makedirs("data/markdown/OR_docs/tools", exist_ok=True)
os.makedirs("data/markdown/OR_docs/general", exist_ok=True)
os.makedirs("data/markdown/ORFS_docs", exist_ok=True)
os.makedirs("data/markdown/ORFS_docs/installation", exist_ok=True)
os.makedirs("data/markdown/ORFS_docs/general", exist_ok=True)
os.makedirs("data/markdown/OpenSTA_docs", exist_ok=True)
os.makedirs("data/pdf/OpenSTA", exist_ok=True)
os.makedirs("data/pdf/OR_publications", exist_ok=True)
os.makedirs("data/html", exist_ok=True)
get_klayout_docs_html()
get_yosys_docs_html()
get_or_publications()
get_or_website_html()
get_opensta_docs()
clone_repo(
url=OR_REPO_URL,
commit_hash=commits["OpenROAD"],
folder_name="OpenROAD",
)
clone_repo(
url=ORFS_REPO_URL,
commit_hash=commits["OpenROAD-flow-scripts"],
folder_name="OpenROAD-flow-scripts",
)
build_or_docs()
build_orfs_docs()
build_manpages()
os.chdir(cur_dir)
copy_file_track_src(
f"{cur_dir}/data/markdown/OR_docs/installation/MessagesFinal.md",
f"{cur_dir}/data/markdown/manpages/man3/ErrorMessages.md",
)
os.remove(f"{cur_dir}/data/markdown/OR_docs/installation/MessagesFinal.md")
snapshot_download(
repo_id="The-OpenROAD-Project/ORAssistant_RAG_Dataset",
repo_type="dataset",
revision=GH_DISCUSSIONS_REVISION,
allow_patterns=[
"markdown/gh_discussions/**/*",
"markdown/gh_discussions/*",
],
local_dir="data",
)
write_source_list()
write_build_info(commits, crawl_date)
repo_paths = ["OpenROAD", "OpenROAD-flow-scripts"]
purge_folders(folder_paths=repo_paths)