From 1277e856de1f5cffbc8ead8a821adb4d182f886a Mon Sep 17 00:00:00 2001 From: Dave Miller Date: Sun, 25 Aug 2024 23:17:21 -0400 Subject: [PATCH] Bug 1849943: get doc build working on RTD site (#140) --- .readthedocs.yaml | 9 +++++++-- docs/makedocs.pl | 17 ++++++++++++----- docs/requirements.txt | 3 +++ 3 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 docs/requirements.txt diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 7eada0dd63..ff4cc83b48 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -1,8 +1,8 @@ version: 2 build: - os: "ubuntu-20.04" + os: "ubuntu-22.04" tools: - python: "3.10" + python: "3.11" apt_packages: - libfile-copy-recursive-perl jobs: @@ -10,3 +10,8 @@ build: - perl docs/makedocs.pl --pod-only - cp -rp docs/en/html/integrating/api/ "$READTHEDOCS_OUTPUT/html/integrating/api" - cp -p docs/en/html/style.css "$READTHEDOCS_OUTPUT/html/" +sphinx: + configuration: docs/en/rst/conf.py +python: + install: + - requirements: docs/requirements.txt diff --git a/docs/makedocs.pl b/docs/makedocs.pl index ebb6c50e5b..ad043294bc 100755 --- a/docs/makedocs.pl +++ b/docs/makedocs.pl @@ -33,9 +33,10 @@ use lib qw(.. ../lib lib ../local/lib/perl5); use Cwd; +use File::Copy qw(copy); use File::Copy::Recursive qw(rcopy); use File::Find; -use File::Path qw(rmtree); +use File::Path qw(rmtree make_path); use File::Which qw(which); use Pod::Simple; @@ -84,13 +85,19 @@ sub make_pod { $converter->contents_page_start($contents_start); $converter->contents_page_end(""); - $converter->add_css('./../../../style.css'); + if (exists($::ENV{'READTHEDOCS'})) { + $converter->add_css('./../../style.css'); + } else { + $converter->add_css('./../../../../style.css'); + } $converter->javascript_flurry(0); $converter->css_flurry(0); - mkdir("html"); - mkdir("html/api"); - $converter->batch_convert(['../../'], 'html/api/'); + make_path('html/integrating/api'); + $converter->batch_convert(['../../'], 'html/integrating/api'); + if (exists($::ENV{'READTHEDOCS'})) { + copy('../style.css', 'html/style.css') or die "Copy failed: $!"; + } print "\n"; } diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000000..705daff875 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,3 @@ +sphinx==5.3.0 +sphinx_rtd_theme==1.3.0 +readthedocs-sphinx-search==0.3.2