| |
| |
| |
| |
| |
|
|
| |
|
|
| |
| |
| |
| |
| import docutils |
| import os |
| import re |
| import requests |
|
|
| |
|
|
| project = "OpenROAD Flow" |
| copyright = "The Regents of the University of California, 2021" |
| author = "OpenROAD Team" |
|
|
|
|
| |
|
|
| |
| |
| |
| extensions = [ |
| "sphinx.ext.autodoc", |
| "sphinx.ext.ifconfig", |
| "sphinx.ext.mathjax", |
| "sphinx.ext.napoleon", |
| "sphinx.ext.todo", |
| "sphinx_external_toc", |
| "sphinx_copybutton", |
| "myst_parser", |
| "sphinxcontrib.mermaid", |
| "sphinx_llm.txt", |
| ] |
|
|
| myst_enable_extensions = [ |
| "amsmath", |
| "colon_fence", |
| "deflist", |
| "dollarmath", |
| "html_admonition", |
| "html_image", |
| "replacements", |
| "smartquotes", |
| "substitution", |
| "tasklist", |
| "html_image", |
| ] |
|
|
| external_toc_path = "toc.yml" |
|
|
| |
| templates_path = ["_templates"] |
|
|
| |
| |
| source_suffix = [".md"] |
|
|
| |
| master_doc = "index2.md" |
|
|
| |
| |
| |
| exclude_patterns = [ |
| "_build", |
| "Thumbs.db", |
| ".DS_Store", |
| "**/LICENSE", |
| "**/LICENSE.md", |
| "README.md", |
| "docs/releases/PostAlpha2.1BranchMethodology.md", |
| "main", |
| "index.md", |
| "contrib/GitGuideAdapter.md", |
| ] |
|
|
| |
| pygments_style = None |
|
|
|
|
| |
|
|
| |
| |
| |
| html_theme = "sphinx_book_theme" |
|
|
| html_theme_options = { |
| "repository_url": "https://github.com/The-OpenROAD-Project/OpenROAD-flow-scripts", |
| "repository_branch": "master", |
| "show_navbar_depth": 2, |
| "use_issues_button": True, |
| "use_download_button": True, |
| |
| "icon_links": [ |
| { |
| "name": "The OpenROAD Project", |
| "url": "https://theopenroadproject.org/", |
| "icon": "fa-solid fa-globe", |
| }, |
| { |
| "name": "Twitter", |
| "url": "https://twitter.com/OpenROAD_EDA", |
| "icon": "fa-brands fa-twitter", |
| }, |
| { |
| "name": "Email", |
| "url": "mailto:openroad@ucsd.edu", |
| "icon": "fa-solid fa-envelope", |
| }, |
| { |
| "name": "GitHub", |
| "url": "https://github.com/The-OpenROAD-Project/OpenROAD-flow-scripts", |
| "icon": "fa-brands fa-github", |
| }, |
| { |
| "name": "Stars", |
| "url": "https://github.com/The-OpenROAD-Project/OpenROAD-flow-scripts/stargazers", |
| "icon": "https://img.shields.io/github/stars/The-OpenROAD-Project/OpenROAD-flow-scripts", |
| "type": "url", |
| }, |
| ], |
| } |
|
|
| |
| |
| |
|
|
|
|
| def get_file_from_url(url, fname): |
| r = requests.get(url) |
| with open(fname, "wb") as f: |
| f.write(r.content) |
|
|
|
|
| def swap_prefix(file, old, new): |
| with open(file, "r") as f: |
| lines = f.read() |
| lines = lines.replace(old, new) |
| with open(file, "wt") as f: |
| f.write(lines) |
|
|
|
|
| def setup(app): |
| import shutil |
|
|
| |
| shutil.copy("../README.md", "mainREADME.md") |
| swap_prefix("mainREADME.md", "```mermaid", "```{mermaid}\n:align: center\n") |
|
|
| |
| url = "https://raw.githubusercontent.com/The-OpenROAD-Project/OpenROAD/master/docs/contrib/GitGuide.md" |
| get_file_from_url(url, "contrib/GitGuide.md") |
|
|
| |
| url = "https://raw.githubusercontent.com/The-OpenROAD-Project/OpenROAD/master/docs/index.md" |
| get_file_from_url(url, "SupportedOS.md") |
|
|
| |
| |
| with open("contrib/GitGuide.md", "r") as f: |
| content = f.read() |
| content = ( |
| content.replace( |
| "user/Build.md", "../index.md#build-or-installing-orfs-dependencies" |
| ) |
| .replace("OpenROAD", "OpenROAD-flow-scripts") |
| .replace("The-OpenROAD-flow-scripts", "The-OpenROAD") |
| ) |
| with open("contrib/GitGuideAdapter.md", "r") as f: |
| adapter_content = f.read() |
| content = content.replace( |
| "## Creating a branch", adapter_content + "\n## Creating a branch" |
| ) |
| with open("contrib/GitGuide.md", "w") as f: |
| f.write(content) |
|
|
| |
| import shutil |
|
|
| shutil.copy("index.md", "index2.md") |
|
|
| |
| start_pattern = "## Supported Operating Systems" |
| end_pattern = "## Code of conduct" |
| with open("SupportedOS.md", "r") as f: |
| markdown_content = f.read() |
|
|
| match = re.search(f"{start_pattern}(.*?){end_pattern}", markdown_content, re.DOTALL) |
|
|
| assert match is not None, "No match found, check the OR Doc pattern on index.md" |
| extracted_content = match.group(1) |
| extracted_content = "\n#### Supported Operating Systems" + extracted_content |
| print(extracted_content) |
|
|
| |
| with open("index2.md", "r") as f: |
| existing_content = f.read() |
| match = re.search(r"### Setup", existing_content) |
| assert match is not None, "Check search keyword." |
| with open("index2.md", "w") as f: |
| insert_position = match.end() + 1 |
| before_insert = existing_content[:insert_position] |
| after_insert = existing_content[insert_position:] |
|
|
| |
| updated_content = before_insert + extracted_content + after_insert |
|
|
| f.write(updated_content) |
|
|
| |
| url = "https://raw.githubusercontent.com/The-OpenROAD-Project/OpenROAD/master/src/utl/README.md" |
| get_file_from_url(url, "Manpage.md") |
|
|