File tree Expand file tree Collapse file tree 5 files changed +30
-14
lines changed
.github/actions/get_pr_number
cuda_bindings/docs/source Expand file tree Collapse file tree 5 files changed +30
-14
lines changed Original file line number Diff line number Diff line change 2121 exit 1
2222 fi
2323 echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
24+ echo "BUILD_PREVIEW=1" >> $GITHUB_ENV
2425
2526 - name : Get PR data (main branch)
2627 if : ${{ github.ref_name == 'main' }}
5051 exit 1
5152 fi
5253 echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
54+ echo "BUILD_LATEST=1" >> $GITHUB_ENV
Original file line number Diff line number Diff line change 7171 # ],
7272}
7373if os .environ .get ("CI" ):
74- PR_NUMBER = f"{ os .environ ['PR_NUMBER' ]} "
75- PR_TEXT = f'<a href="https://github.com/NVIDIA/cuda-python/pull/{ PR_NUMBER } ">PR { PR_NUMBER } </a>'
76- html_theme_options ["announcement" ] = f"<em>Warning</em>: This documentation is only a preview for { PR_TEXT } !"
74+ if int (os .environ .get ("BUILD_PREVIEW" , 0 )):
75+ PR_NUMBER = f"{ os .environ ['PR_NUMBER' ]} "
76+ PR_TEXT = f'<a href="https://github.com/NVIDIA/cuda-python/pull/{ PR_NUMBER } ">PR { PR_NUMBER } </a>'
77+ html_theme_options ["announcement" ] = f"<em>Warning</em>: This documentation is only a preview for { PR_TEXT } !"
78+ elif int (os .environ .get ("BUILD_LATEST" , 0 )):
79+ html_theme_options ["announcement" ] = (
80+ "<em>Warning</em>: This documentation is built from the development branch!"
81+ )
7782
7883# Add any paths that contain custom static files (such as style sheets) here,
7984# relative to this directory. They are copied after the builtin static files,
Original file line number Diff line number Diff line change 7676 # ],
7777}
7878if os .environ .get ("CI" ):
79- PR_NUMBER = f"{ os .environ ['PR_NUMBER' ]} "
80- PR_TEXT = f'<a href="https://github.com/NVIDIA/cuda-python/pull/{ PR_NUMBER } ">PR { PR_NUMBER } </a>'
81- html_theme_options ["announcement" ] = f"<em>Warning</em>: This documentation is only a preview for { PR_TEXT } !"
79+ if int (os .environ .get ("BUILD_PREVIEW" , 0 )):
80+ PR_NUMBER = f"{ os .environ ['PR_NUMBER' ]} "
81+ PR_TEXT = f'<a href="https://github.com/NVIDIA/cuda-python/pull/{ PR_NUMBER } ">PR { PR_NUMBER } </a>'
82+ html_theme_options ["announcement" ] = f"<em>Warning</em>: This documentation is only a preview for { PR_TEXT } !"
83+ elif int (os .environ .get ("BUILD_LATEST" , 0 )):
84+ html_theme_options ["announcement" ] = (
85+ "<em>Warning</em>: This documentation is built from the development branch!"
86+ )
8287
8388# Add any paths that contain custom static files (such as style sheets) here,
8489# relative to this directory. They are copied after the builtin static files,
Original file line number Diff line number Diff line change 7272 # ],
7373}
7474if os .environ .get ("CI" ):
75- PR_NUMBER = f"{ os .environ ['PR_NUMBER' ]} "
76- PR_TEXT = f'<a href="https://github.com/NVIDIA/cuda-python/pull/{ PR_NUMBER } ">PR { PR_NUMBER } </a>'
77- html_theme_options ["announcement" ] = (
78- f"<em>Warning</em>: This documentation is only a preview for { PR_TEXT } !"
79- )
75+ if int (os .environ .get ("BUILD_PREVIEW" , 0 )):
76+ PR_NUMBER = f"{ os .environ ['PR_NUMBER' ]} "
77+ PR_TEXT = f'<a href="https://github.com/NVIDIA/cuda-python/pull/{ PR_NUMBER } ">PR { PR_NUMBER } </a>'
78+ html_theme_options ["announcement" ] = f"<em>Warning</em>: This documentation is only a preview for { PR_TEXT } !"
79+ elif int (os .environ .get ("BUILD_LATEST" , 0 )):
80+ html_theme_options ["announcement" ] = (
81+ "<em>Warning</em>: This documentation is built from the development branch!"
82+ )
8083
8184# Add any paths that contain custom static files (such as style sheets) here,
8285# relative to this directory. They are copied after the builtin static files,
8689# Allow overwriting CUDA Python's domain name for local development. See:
8790# - https://stackoverflow.com/a/61694897/2344149
8891# - https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-rst_epilog
89- CUDA_PYTHON_DOMAIN = os .environ .get (
90- "CUDA_PYTHON_DOMAIN" , "https://nvidia.github.io/cuda-python"
91- )
92+ CUDA_PYTHON_DOMAIN = os .environ .get ("CUDA_PYTHON_DOMAIN" , "https://nvidia.github.io/cuda-python" )
9293rst_epilog = f"""
9394.. _cuda.core: { CUDA_PYTHON_DOMAIN } /cuda-core/latest
9495.. _cuda.bindings: { CUDA_PYTHON_DOMAIN } /cuda-bindings/latest
Original file line number Diff line number Diff line change @@ -39,3 +39,6 @@ homepage = "https://nvidia.github.io/cuda-python/"
3939documentation = " https://nvidia.github.io/cuda-python/"
4040repository = " https://github.com/NVIDIA/cuda-python/"
4141issues = " https://github.com/NVIDIA/cuda-python/issues/"
42+
43+ [tool .ruff ]
44+ line-length = 120
You can’t perform that action at this time.
0 commit comments