[Python-modules-commits] [sphinx] 01/01: In singlehtml check, consider only HTML files that use doctools.js.
Dmitry Shachnev
mitya57 at moszumanska.debian.org
Sun Oct 22 12:00:48 UTC 2017
This is an automated email from the git hooks/post-receive script.
mitya57 pushed a commit to branch debian/master
in repository sphinx.
commit e793f3e308924ee1b2966e634917273e5a99db1e
Author: Dmitry Shachnev <mitya57 at gmail.com>
Date: Sun Oct 22 14:51:25 2017 +0300
In singlehtml check, consider only HTML files that use doctools.js.
Closes: #872863.
---
debian/changelog | 7 +++++++
debian/dh-sphinxdoc/dh_sphinxdoc | 39 +++++++++++++++++++++++++--------------
2 files changed, 32 insertions(+), 14 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 397bca1..fc6b479 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+sphinx (1.6.4-3) UNRELEASED; urgency=medium
+
+ * In singlehtml check, consider only HTML files that use doctools.js
+ (closes: #872863).
+
+ -- Dmitry Shachnev <mitya57 at debian.org> Sun, 22 Oct 2017 14:50:24 +0300
+
sphinx (1.6.4-2) unstable; urgency=medium
* Add a note that dh_sphinxdoc does not actually build the documentation
diff --git a/debian/dh-sphinxdoc/dh_sphinxdoc b/debian/dh-sphinxdoc/dh_sphinxdoc
index e8a5977..3132d53 100755
--- a/debian/dh-sphinxdoc/dh_sphinxdoc
+++ b/debian/dh-sphinxdoc/dh_sphinxdoc
@@ -200,28 +200,39 @@ sub looks_like_sphinx_doc($)
sub looks_like_sphinx_singlehtml_doc($)
{
my ($path) = @_;
- return 0 unless -f "$path/objects.inv";
return 0 unless -d "$path/_static";
+ return 0 if -f "$path/searchindex.js";
+
# There should be exactly one HTML file in singlehtml build.
my @html_files = glob("$path/*.html");
- return 0 if @html_files != 1;
- # If searchindex.js exists, it is likely a broken html, not singlehtml.
- return 0 if -f "$path/searchindex.js";
- return 1;
+ my @sphinx_html_files;
+ foreach my $html_file (@html_files)
+ {
+ open(my $fh, '<', $html_file) or error("cannot open $html_file");
+ while (my $line = <$fh>)
+ {
+ if ($line =~ /<script type="text\/javascript" src="_static\/doctools.js">/)
+ {
+ push @sphinx_html_files, $html_file;
+ last;
+ }
+ }
+ }
+ return 0 if @sphinx_html_files != 1;
+ return $sphinx_html_files[0];
}
sub sanity_check($$)
{
local $/;
- my ($path, $is_singlehtml) = @_;
+ my ($path, $singlehtml_file) = @_;
my $searchfn;
my $index;
- if ($is_singlehtml)
+ if ($singlehtml_file)
{
- my @html_files = glob("$path/*.html");
# There is no search.html in singlehtml build, so we take the main HTML
# file for sanity checking and retrieving JS files.
- $searchfn = $html_files[0];
+ $searchfn = $singlehtml_file;
}
else
{
@@ -245,7 +256,7 @@ sub sanity_check($$)
$sourcelink_suffix = ".txt" unless defined $sourcelink_suffix;
my ($url_root) = $search =~ m{URL_ROOT:\s*'([^']*)'};
%js or error("$searchfn does not include any JavaScript code");
- $is_singlehtml or $loads_searchindex or error("$searchfn does not load searchindex.js");
+ $singlehtml_file or $loads_searchindex or error("$searchfn does not load searchindex.js");
defined $has_source or error("DOCUMENTATION_OPTIONS does not define HAS_SOURCE");
defined $url_root or error("DOCUMENTATION_OPTIONS does not define URL_ROOT");
$has_source = $has_source eq 'true';
@@ -254,7 +265,7 @@ sub sanity_check($$)
{
-f "$path/$js" or -l "$path/$js" or error("$path/$js is missing");
}
- unless ($is_singlehtml)
+ unless ($singlehtml_file)
{
for my $page (split(/","/, $index))
{
@@ -448,9 +459,9 @@ sub fix_sphinx_doc($$)
{
my ($package, $path) = @_;
my $is_html = looks_like_sphinx_doc($path);
- my $is_singlehtml = looks_like_sphinx_singlehtml_doc($path);
- return 0 if not ($is_html or $is_singlehtml);
- my @js = sanity_check($path, $is_singlehtml);
+ my $singlehtml_file = looks_like_sphinx_singlehtml_doc($path);
+ return 0 if not ($is_html or $singlehtml_file);
+ my @js = sanity_check($path, $singlehtml_file);
my @rtd_deps = process_rtd($path);
my @deps = fix_symlinks($path, @js);
my @built_using = list_built_using($path);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/sphinx.git
More information about the Python-modules-commits
mailing list