From 6a80a216a2b81876716a143364dfa43b9e5d2f0e Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Mon, 16 May 2022 10:29:07 -0400 Subject: [PATCH 1/9] Revert "bpo-46184: remove `netlify.toml` (#30272)" This reverts commit fbaf2e604cd354f1ebc6be029480010c6715a8ca. --- Doc/runtime.txt | 1 + netlify.toml | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 Doc/runtime.txt create mode 100644 netlify.toml diff --git a/Doc/runtime.txt b/Doc/runtime.txt new file mode 100644 index 00000000000000..548d71365f0ec7 --- /dev/null +++ b/Doc/runtime.txt @@ -0,0 +1 @@ +3.7 \ No newline at end of file diff --git a/netlify.toml b/netlify.toml new file mode 100644 index 00000000000000..387c8f954ada3c --- /dev/null +++ b/netlify.toml @@ -0,0 +1,4 @@ +[build] + base = "Doc/" + command = "make html" + publish = "Doc/build/html" \ No newline at end of file From 22a55a50c6f51d443e84e673722a4d89ce729b97 Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Mon, 16 May 2022 15:25:35 -0400 Subject: [PATCH 2/9] Delete runtime.txt --- Doc/runtime.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Doc/runtime.txt diff --git a/Doc/runtime.txt b/Doc/runtime.txt deleted file mode 100644 index 548d71365f0ec7..00000000000000 --- a/Doc/runtime.txt +++ /dev/null @@ -1 +0,0 @@ -3.7 \ No newline at end of file From d2b7cb4107d1f18e1acdc06893fa3516fe4f75dc Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Mon, 16 May 2022 15:29:26 -0400 Subject: [PATCH 3/9] Create runtime.txt --- Doc/runtime.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 Doc/runtime.txt diff --git a/Doc/runtime.txt b/Doc/runtime.txt new file mode 100644 index 00000000000000..cc1923a40b1a5e --- /dev/null +++ b/Doc/runtime.txt @@ -0,0 +1 @@ +3.8 From b2a5dd2c9b1731449bd05a11b70e9e3d39ce6ec4 Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Mon, 16 May 2022 15:29:53 -0400 Subject: [PATCH 4/9] Delete runtime.txt --- Doc/runtime.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Doc/runtime.txt diff --git a/Doc/runtime.txt b/Doc/runtime.txt deleted file mode 100644 index cc1923a40b1a5e..00000000000000 --- a/Doc/runtime.txt +++ /dev/null @@ -1 +0,0 @@ -3.8 From 882fd4cbd2ed2074e655777eeba5db32563f5198 Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Mon, 16 May 2022 15:30:36 -0400 Subject: [PATCH 5/9] Update netlify.toml --- netlify.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/netlify.toml b/netlify.toml index 387c8f954ada3c..6f105855b87608 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,4 +1,5 @@ [build] base = "Doc/" command = "make html" - publish = "Doc/build/html" \ No newline at end of file + publish = "Doc/build/html" + environment = { PYTHON_VERSION = "3.8" } From adbd5ddf3ec7ae79981cd6a049e01da697364cc9 Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Mon, 16 May 2022 15:43:46 -0400 Subject: [PATCH 6/9] Update netlify.toml --- netlify.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netlify.toml b/netlify.toml index 6f105855b87608..b0a021ba73a0c9 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,5 +1,5 @@ [build] base = "Doc/" command = "make html" - publish = "Doc/build/html" + publish = "build/html" environment = { PYTHON_VERSION = "3.8" } From e3321c6a8e31a53326d15b75c5c12146e9292aff Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Sun, 19 Jun 2022 20:17:55 +0000 Subject: [PATCH 7/9] Add netlify badge --- Doc/conf.py | 8 ++++++++ Doc/tools/templates/layout.html | 13 +++++++++++++ netlify.toml | 5 ++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Doc/conf.py b/Doc/conf.py index e539da539e6551..32bec894d53614 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -77,6 +77,14 @@ # Short title used e.g. for HTML tags. html_short_title = '%s Documentation' % release +# Deployment preview information, from Netlify +# (See netlify.toml and https://docs.netlify.com/configure-builds/environment-variables/#git-metadata) +html_context = { + "is_deployment_preview": os.getenv("IS_DEPLOYMENT_PREVIEW"), + "repository_url": os.getenv("REPOSITORY_URL"), + "pr_id": os.getenv("REVIEW_ID") +} + # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. html_last_updated_fmt = '%b %d, %Y' diff --git a/Doc/tools/templates/layout.html b/Doc/tools/templates/layout.html index 98ccf4224804b2..4d34619df19bc3 100644 --- a/Doc/tools/templates/layout.html +++ b/Doc/tools/templates/layout.html @@ -8,6 +8,19 @@ <a href="/3/{{ pagename }}{{ file_suffix }}">{% trans %} Python documentation for the current stable release{% endtrans %}</a>. </div> {%- endif %} + +{%- if is_deployment_preview %} +<div id="deployment-preview-warning" style="padding: .5em; text-align: center; background-color: #fff2ba; color: #6a580e;"> + <div style="float: right; margin-top: -10px; margin-left: 10px;"> + <a href="https://www.netlify.com"> + <img src="https://www.netlify.com/img/global/badges/netlify-color-accent.svg" alt="Deploys by Netlify" /> + </a> + </div> + {% trans %}This is a deployment preview that was created from a <a href="{{ repository_url }}/pull/{{ pr_id }}">pull request</a>. + For authoritative documentation, see the {% endtrans %} + <a href="/3/{{ pagename }}{{ file_suffix }}">{% trans %} Python documentation for the current stable release{% endtrans %}</a>. +</div> +{%- endif %} {% endblock %} {% block rootrellink %} diff --git a/netlify.toml b/netlify.toml index b0a021ba73a0c9..52675b3d701eb7 100644 --- a/netlify.toml +++ b/netlify.toml @@ -2,4 +2,7 @@ base = "Doc/" command = "make html" publish = "build/html" - environment = { PYTHON_VERSION = "3.8" } + +[build.environment] + PYTHON_VERSION = "3.8" + IS_DEPLOYMENT_PREVIEW = "true" \ No newline at end of file From 32689709087fdb5a5857a69c8e7e1be12b680ad4 Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami <aramaswamis@gmail.com> Date: Sun, 19 Jun 2022 16:40:41 -0400 Subject: [PATCH 8/9] Update Doc/tools/templates/layout.html Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com> --- Doc/tools/templates/layout.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/tools/templates/layout.html b/Doc/tools/templates/layout.html index 4d34619df19bc3..c3b2a5ecf6efbb 100644 --- a/Doc/tools/templates/layout.html +++ b/Doc/tools/templates/layout.html @@ -16,9 +16,9 @@ <img src="https://www.netlify.com/img/global/badges/netlify-color-accent.svg" alt="Deploys by Netlify" /> </a> </div> - {% trans %}This is a deployment preview that was created from a <a href="{{ repository_url }}/pull/{{ pr_id }}">pull request</a>. + {% trans %}This is a deploy preview created from a <a href="{{ repository_url }}/pull/{{ pr_id }}">pull request</a>. For authoritative documentation, see the {% endtrans %} - <a href="/3/{{ pagename }}{{ file_suffix }}">{% trans %} Python documentation for the current stable release{% endtrans %}</a>. + <a href="/3/{{ pagename }}{{ file_suffix }}">{% trans %} the current stable release{% endtrans %}</a>. </div> {%- endif %} {% endblock %} From 9a9513cfbdd7d8ea3f3f015d7070981e0f97f26b Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami <aramaswamis@gmail.com> Date: Sun, 19 Jun 2022 16:41:38 -0400 Subject: [PATCH 9/9] Update layout.html --- Doc/tools/templates/layout.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/tools/templates/layout.html b/Doc/tools/templates/layout.html index c3b2a5ecf6efbb..460161cd320223 100644 --- a/Doc/tools/templates/layout.html +++ b/Doc/tools/templates/layout.html @@ -18,7 +18,7 @@ </div> {% trans %}This is a deploy preview created from a <a href="{{ repository_url }}/pull/{{ pr_id }}">pull request</a>. For authoritative documentation, see the {% endtrans %} - <a href="/3/{{ pagename }}{{ file_suffix }}">{% trans %} the current stable release{% endtrans %}</a>. + <a href="https://docs.python.org/3/{{ pagename }}{{ file_suffix }}">{% trans %} the current stable release{% endtrans %}</a>. </div> {%- endif %} {% endblock %}