From 5b6d22b24eadf41106707f84def5f7720f37ce21 Mon Sep 17 00:00:00 2001 From: Maisam Arif Date: Wed, 25 Oct 2023 17:03:47 -0500 Subject: [PATCH] SWDEV-425457 - Updated Sphinx docs to include ESMI Signed-off-by: Maisam Arif Change-Id: Ie7669c9f94703e5c5cdc65314cbf30e8b587d0f1 [ROCm/amdsmi commit: f061aa4be5774b65dde3d00ff9498a27e3463ab1] --- projects/amdsmi/docs/.gitignore | 3 +++ projects/amdsmi/docs/conf.py | 12 ++++++++++++ projects/amdsmi/docs/esmi_lib_readme_link.md | 3 +++ projects/amdsmi/docs/sphinx/_toc.yml.in | 4 ++++ projects/amdsmi/docs/sphinx/requirements.txt | 4 ++-- 5 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 projects/amdsmi/docs/esmi_lib_readme_link.md diff --git a/projects/amdsmi/docs/.gitignore b/projects/amdsmi/docs/.gitignore index b84233aed8..9095d45c48 100644 --- a/projects/amdsmi/docs/.gitignore +++ b/projects/amdsmi/docs/.gitignore @@ -9,3 +9,6 @@ /latex/ 404.md data/AMD-404.png + +# file below is overwritten by sphinx script! +./esmi_lib_readme_link.md diff --git a/projects/amdsmi/docs/conf.py b/projects/amdsmi/docs/conf.py index bdfc6e486f..6bc3e3f5b6 100644 --- a/projects/amdsmi/docs/conf.py +++ b/projects/amdsmi/docs/conf.py @@ -6,8 +6,20 @@ import subprocess +import urllib from rocm_docs import ROCmDocs +esmi_readme_link = "https://raw.githubusercontent.com/amd/esmi_ib_library/master/docs/README.md" +try: + # Try to override esmi_lib_readme_link.md with the github esmi readme contents + with urllib.request.urlopen(esmi_readme_link) as f: + esmi_readme = f.read().decode('utf-8') + + with open("./esmi_lib_readme_link.md", "w", encoding='utf-8') as f: + f.write(esmi_readme) +except urllib.error.URLError: + # don't care about the error because there is backup link in the file already + pass get_version_year = r'sed -n -e "s/^#define\ AMDSMI_LIB_VERSION_YEAR\ //p" ../include/amd_smi/amdsmi.h' get_version_major = r'sed -n -e "s/^#define\ AMDSMI_LIB_VERSION_MAJOR\ //p" ../include/amd_smi/amdsmi.h' diff --git a/projects/amdsmi/docs/esmi_lib_readme_link.md b/projects/amdsmi/docs/esmi_lib_readme_link.md new file mode 100644 index 0000000000..f52aec131a --- /dev/null +++ b/projects/amdsmi/docs/esmi_lib_readme_link.md @@ -0,0 +1,3 @@ +# ESMI Library README + +For more information, see the [ESMI Library README](https://raw.githubusercontent.com/am/esmi_ib_library/master/docs/README.md) \ No newline at end of file diff --git a/projects/amdsmi/docs/sphinx/_toc.yml.in b/projects/amdsmi/docs/sphinx/_toc.yml.in index 3a4de74232..c05c3bfbf0 100644 --- a/projects/amdsmi/docs/sphinx/_toc.yml.in +++ b/projects/amdsmi/docs/sphinx/_toc.yml.in @@ -17,6 +17,10 @@ subtrees: title: Python CLI Tool - file: amdsmi_release_notes_link title: Python CLI Release Notes + - caption: Libraries + entries: + - file: esmi_lib_readme_link + title: ESMI Library - caption: About entries: - file: license diff --git a/projects/amdsmi/docs/sphinx/requirements.txt b/projects/amdsmi/docs/sphinx/requirements.txt index ca744335cb..53bd7f615d 100644 --- a/projects/amdsmi/docs/sphinx/requirements.txt +++ b/projects/amdsmi/docs/sphinx/requirements.txt @@ -47,7 +47,7 @@ fastjsonschema==2.17.1 # via rocm-docs-core gitdb==4.0.10 # via gitpython -gitpython==3.1.31 +gitpython==3.1.37 # via rocm-docs-core idna==3.4 # via requests @@ -110,7 +110,7 @@ requests==2.30.0 # via # pygithub # sphinx -rocm-docs-core[api_reference]>=0.20.0 +rocm-docs-core[api_reference]>=0.26.0 # via -r requirements.in smmap==5.0.0 # via gitdb