|
73 | 73 | )
|
74 | 74 |
|
75 | 75 | html_favicon = "_static/img/ExecuTorch-Logo-cropped.svg"
|
| 76 | + |
| 77 | +# Get ET_VERSION_DOCS during the build. |
| 78 | +et_version_docs = os.environ.get("ET_VERSION_DOCS", None) |
| 79 | + |
| 80 | + |
| 81 | +# The code below will cut version displayed in the dropdown like this: |
| 82 | +# tags like v0.1.0 = > 0.1 |
| 83 | +# branch like release/0.1 => 0.1 |
| 84 | +# main will remain main |
| 85 | +# if not set will fail back to main |
| 86 | +# the version varible is used in layout.html: https://github.com/pytorch/executorch/blob/main/docs/source/_templates/layout.html#L29 |
| 87 | +if et_version_docs: |
| 88 | + # Check if starts with release/ and set the version to the number after slash |
| 89 | + if et_version_docs.startswith("release/"): |
| 90 | + version = et_version_docs.split("/")[-1] |
| 91 | + else: |
| 92 | + # Remove "v" prefix if present |
| 93 | + if et_version_docs.startswith("v"): |
| 94 | + et_version_docs = et_version_docs[1:] |
| 95 | + # Split to major, minor, and patch |
| 96 | + version_components = et_version_docs.split(".") |
| 97 | + |
| 98 | + # Combine the major and minor version components: |
| 99 | + if len(version_components) >= 2: |
| 100 | + version = release = ".".join(version_components[:2]) |
| 101 | + else: |
| 102 | + # If there are not enough components, use the full version |
| 103 | + version = release = et_version_docs |
| 104 | + |
| 105 | + html_title = " ".join((project, version, "documentation")) |
| 106 | +# IF ET_VERSION_DOCS not set, set version to main. |
| 107 | +# This can be updated to nightly and so on. |
| 108 | +else: |
| 109 | + version = "main" |
| 110 | + release = "main" |
| 111 | + |
76 | 112 | breathe_projects = {"ExecuTorch": "../build/xml/"}
|
77 | 113 | breathe_default_project = "ExecuTorch"
|
78 | 114 |
|
|
0 commit comments