[Python-modules-commits] [sphinx] 01/01: dh_sphinxdoc: Properly detect sourcelink_suffix.

Dmitry Shachnev mitya57 at moszumanska.debian.org
Mon Jan 23 13:29:18 UTC 2017


This is an automated email from the git hooks/post-receive script.

mitya57 pushed a commit to branch master
in repository sphinx.

commit 179eb7a6f410f5fdff8737b62459fbaf9b9cd8df
Author: Dmitry Shachnev <mitya57 at gmail.com>
Date:   Mon Jan 23 16:28:58 2017 +0300

    dh_sphinxdoc: Properly detect sourcelink_suffix.
    
    And use it when looking for source and HTML files.
---
 debian/changelog                 |  7 +++++++
 debian/dh-sphinxdoc/dh_sphinxdoc | 13 +++++++------
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 005c341..65a8bc6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+sphinx (1.5.2-2) UNRELEASED; urgency=medium
+
+  * dh_sphinxdoc: Properly detect sourcelink_suffix and use it when looking
+    for source and HTML files.
+
+ -- Dmitry Shachnev <mitya57 at debian.org>  Mon, 23 Jan 2017 16:26:27 +0300
+
 sphinx (1.5.2-1) experimental; urgency=medium
 
   * New upstream release.
diff --git a/debian/dh-sphinxdoc/dh_sphinxdoc b/debian/dh-sphinxdoc/dh_sphinxdoc
index 87af1e8..983bf3d 100755
--- a/debian/dh-sphinxdoc/dh_sphinxdoc
+++ b/debian/dh-sphinxdoc/dh_sphinxdoc
@@ -208,6 +208,7 @@ sub sanity_check($)
     grep { s/[?#].*//; $js{$_} = 1 unless m/^[a-z][a-z0-9.+-]*:/i or excludefile("$path/$_"); } $search =~ m{<script type="text/javascript" src="([^"]++)"></script>}g;
     my $loads_searchindex = $search =~ m/\QjQuery(function() { Search.loadIndex("\E/;
     my ($has_source) = $search =~ m{HAS_SOURCE:\s*(true|false)};
+    my ($sourcelink_suffix) = $search =~ m{SOURCELINK_SUFFIX:\s*'([^']*)'};
     my ($url_root) = $search =~ m{URL_ROOT:\s*'([^']*)'};
     (%js and $loads_searchindex and defined $has_source and defined $url_root) or error("$searchfn doesn't look like a Sphinx search page");
     $has_source = $has_source eq 'true';
@@ -218,14 +219,14 @@ sub sanity_check($)
     }
     for my $page (split(/","/, $index))
     {
-        # If the original file had .rst extension, $page will end with .rst.
-        # If it had .txt extension, $page will have no extension.
-        -f "$path/_sources/$page.txt"
-            or excludefile("$path/_sources/$page.txt")
-            or error("$path/_sources/$page.txt is missing")
+        # Append sourcelink_suffix if the page name does not already end with it.
+        (my $sourcepage = $page) =~ s/(?<!$sourcelink_suffix)$/$sourcelink_suffix/;
+        -f "$path/_sources/$sourcepage"
+            or excludefile("$path/_sources/$sourcepage")
+            or error("$path/_sources/$sourcepage is missing")
             if $has_source;
         # Get the page basename before appending .html.
-        $page =~ s/\.rst$//;
+        $page =~ s/\.[a-z]+$//;
         -f "$path/$page.html"
             or excludefile("$path/$page.html")
             or error("$path/$page.html is missing");

-- 
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