From 18cf0c20c04d8f3167a85e5d9a5b81b2e3d557c7 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Fri, 15 Oct 2021 13:04:55 +0000 Subject: [PATCH 1/5] chore(python): include docs/upgrading.rst in docs/index.rst if it exists --- synthtool/gcp/common.py | 4 ++++ .../gcp/templates/python_library/docs/index.rst | 12 ++---------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/synthtool/gcp/common.py b/synthtool/gcp/common.py index b996fcc52..8e054e796 100644 --- a/synthtool/gcp/common.py +++ b/synthtool/gcp/common.py @@ -252,6 +252,10 @@ def py_library(self, **kwargs) -> Path: ): self.excludes += ["docs/index.rst"] + # Add kwargs to signal that upgrading.rst should be included in docs/index.rst if it exists + if (Path("docs/upgrading.rst").exists()): + kwargs["include_uprading_doc"] = True + # Assume the python-docs-samples Dockerfile is used for samples by default if "custom_samples_dockerfile" not in kwargs: kwargs["custom_samples_dockerfile"] = False diff --git a/synthtool/gcp/templates/python_library/docs/index.rst b/synthtool/gcp/templates/python_library/docs/index.rst index 03b24c37f..158d32b83 100644 --- a/synthtool/gcp/templates/python_library/docs/index.rst +++ b/synthtool/gcp/templates/python_library/docs/index.rst @@ -14,16 +14,8 @@ API Reference {{ version }}/services {{ version }}/types {% endfor %} -{%- if migration_guide_version %} -Migration Guide ---------------- - -See the guide below for instructions on migrating to the {{ migration_guide_version }} release of this library. - -.. toctree:: - :maxdepth: 2 - - UPGRADING +{% if include_uprading_doc %} +.. include:: upgrading.rst {% endif %} Changelog --------- From 225f5a3b8e9f0f157a89cdc887eb03b821e38205 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Fri, 15 Oct 2021 18:16:30 +0000 Subject: [PATCH 2/5] lint --- synthtool/gcp/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synthtool/gcp/common.py b/synthtool/gcp/common.py index 8e054e796..793230649 100644 --- a/synthtool/gcp/common.py +++ b/synthtool/gcp/common.py @@ -253,7 +253,7 @@ def py_library(self, **kwargs) -> Path: self.excludes += ["docs/index.rst"] # Add kwargs to signal that upgrading.rst should be included in docs/index.rst if it exists - if (Path("docs/upgrading.rst").exists()): + if Path("docs/upgrading.rst").exists(): kwargs["include_uprading_doc"] = True # Assume the python-docs-samples Dockerfile is used for samples by default From b80a054990d287002feaea1df79ab33f73ec60f5 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Mon, 18 Oct 2021 17:09:01 +0000 Subject: [PATCH 3/5] use UPGRADING.md instead of upgrading.rst --- synthtool/gcp/common.py | 4 ++-- synthtool/gcp/templates/python_library/docs/index.rst | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/synthtool/gcp/common.py b/synthtool/gcp/common.py index 793230649..ece3bde8e 100644 --- a/synthtool/gcp/common.py +++ b/synthtool/gcp/common.py @@ -252,8 +252,8 @@ def py_library(self, **kwargs) -> Path: ): self.excludes += ["docs/index.rst"] - # Add kwargs to signal that upgrading.rst should be included in docs/index.rst if it exists - if Path("docs/upgrading.rst").exists(): + # Add kwargs to signal that UPGRADING.md should be included in docs/index.rst if it exists + if Path("docs/UPGRADING.md").exists(): kwargs["include_uprading_doc"] = True # Assume the python-docs-samples Dockerfile is used for samples by default diff --git a/synthtool/gcp/templates/python_library/docs/index.rst b/synthtool/gcp/templates/python_library/docs/index.rst index 158d32b83..3ec7552f0 100644 --- a/synthtool/gcp/templates/python_library/docs/index.rst +++ b/synthtool/gcp/templates/python_library/docs/index.rst @@ -15,7 +15,7 @@ API Reference {{ version }}/types {% endfor %} {% if include_uprading_doc %} -.. include:: upgrading.rst +.. include:: UPGRADING.md {% endif %} Changelog --------- From 86987375c7215dbb10cbe04307097656dbb4ae68 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 19 Oct 2021 10:21:17 +0000 Subject: [PATCH 4/5] add migration guide header, update link to doc --- synthtool/gcp/templates/python_library/docs/index.rst | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/synthtool/gcp/templates/python_library/docs/index.rst b/synthtool/gcp/templates/python_library/docs/index.rst index 3ec7552f0..2f6a845fa 100644 --- a/synthtool/gcp/templates/python_library/docs/index.rst +++ b/synthtool/gcp/templates/python_library/docs/index.rst @@ -15,7 +15,16 @@ API Reference {{ version }}/types {% endfor %} {% if include_uprading_doc %} -.. include:: UPGRADING.md +Migration Guide +--------------- + +See the guide below for instructions on migrating to the latest version. + +.. toctree:: + :maxdepth: 2 + + UPGRADING + {% endif %} Changelog --------- From d3f5690f8a6c7c7c230c76afe770484faefc9c66 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 19 Oct 2021 11:16:49 -0400 Subject: [PATCH 5/5] make spacing consistent --- synthtool/gcp/templates/python_library/docs/index.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/synthtool/gcp/templates/python_library/docs/index.rst b/synthtool/gcp/templates/python_library/docs/index.rst index 2f6a845fa..1feedfe4a 100644 --- a/synthtool/gcp/templates/python_library/docs/index.rst +++ b/synthtool/gcp/templates/python_library/docs/index.rst @@ -21,9 +21,9 @@ Migration Guide See the guide below for instructions on migrating to the latest version. .. toctree:: - :maxdepth: 2 + :maxdepth: 2 - UPGRADING +  UPGRADING {% endif %} Changelog @@ -32,6 +32,6 @@ Changelog For a list of all ``{{ metadata['repo']['distribution_name'] }}`` releases: .. toctree:: - :maxdepth: 2 + :maxdepth: 2 - changelog + changelog