diff -Nru sphinx-1.4.8/debian/changelog sphinx-1.4.8/debian/changelog --- sphinx-1.4.8/debian/changelog 2016-10-03 14:24:50.000000000 +0000 +++ sphinx-1.4.8/debian/changelog 2017-05-15 08:02:23.000000000 +0000 @@ -1,3 +1,12 @@ +sphinx (1.4.8-1ubuntu0.1) yakkety; urgency=medium + + * Update jstests for compatibility with WebKitGTK+ 2.16.2 (LP: #1690574). + Now the title property can be no longer than 1000 characters, so we + cannot fetch the whole page using it. Instead, we compute the needed + numbers with JavaScript and then fetch them using the title property. + + -- Dmitry Shachnev Mon, 15 May 2017 11:01:43 +0300 + sphinx (1.4.8-1) unstable; urgency=medium * New upstream bugfix release. diff -Nru sphinx-1.4.8/debian/control sphinx-1.4.8/debian/control --- sphinx-1.4.8/debian/control 2016-10-03 14:24:50.000000000 +0000 +++ sphinx-1.4.8/debian/control 2017-05-15 08:03:06.000000000 +0000 @@ -1,7 +1,8 @@ Source: sphinx Section: python Priority: optional -Maintainer: Debian Python Modules Team +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Debian Python Modules Team Uploaders: Dmitry Shachnev Homepage: http://sphinx-doc.org/ Build-Depends: debhelper (>= 9) diff -Nru sphinx-1.4.8/debian/jstest/jstest.py sphinx-1.4.8/debian/jstest/jstest.py --- sphinx-1.4.8/debian/jstest/jstest.py 2016-10-03 14:24:50.000000000 +0000 +++ sphinx-1.4.8/debian/jstest/jstest.py 2017-05-15 08:01:25.000000000 +0000 @@ -2,7 +2,7 @@ # encoding=UTF-8 # Copyright © 2011 Jakub Wilk -# © 2013-2015 Dmitry Shachnev +# © 2013-2017 Dmitry Shachnev # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are @@ -59,15 +59,19 @@ def _on_title_changed(self, webview, user_data): contents = webview.get_property('title') webview.run_javascript('document.title = ""') - found = "Search finished" in contents + found = re.match(r"(?P\d+) (?P\d+) (?P\d+)", contents) if found: - self._result = contents + self._result = found.groupdict() Gtk.main_quit() GLib.source_remove(self._id) self._id = 0 def _quit(self): - self._view.run_javascript('document.title = document.documentElement.innerHTML') + self._view.run_javascript( + "var n_results = $('#search-results > p:first').text().match(/found (\d+) page/)[1];\n" + "var n_links = $('#search-results a').length;\n" + "var n_highlights = $('#search-results .highlighted').length;\n" + "document.title = `${n_results} ${n_links} ${n_highlights}`;") if self._time_limit < 0: self._result = None Gtk.main_quit() @@ -79,7 +83,7 @@ def wget(self, url, time_limit=default_time_limit): self._view.load_uri(url) self._time_limit = time_limit - self._id = GLib.timeout_add_seconds(time_limit, self._quit) + self._id = GLib.timeout_add_seconds(1, self._quit) Gtk.main() if self._result is None: raise Timeout @@ -89,31 +93,23 @@ # Actual tests # ============ -re_done = re.compile(r'Search finished, found ([0-9]+) page') -re_link = re.compile(r'') -re_highlight = re.compile(r'') - -def test_html(html, options): +def test_html(result, options): class TestCase(unittest.TestCase): if options.n_results is not None: def test_n_results(self): - match = re_done.search(html) - self.assertIsNotNone(match) - n_results = int(match.group(1)) + n_results = int(result['n_results']) self.assertEqual(n_results, options.n_results) if options.n_links is not None: def test_n_links(self): - matches = re_link.findall(html) - n_links = len(matches) + n_links = int(result['n_links']) self.assertEqual(n_links, options.n_links) if options.n_highlights is not None: def test_n_highlights(self): - matches = re_highlight.findall(html) - n_highlights = len(matches) + n_highlights = int(result['n_highlights']) self.assertEqual(n_highlights, options.n_highlights) TestCase.__name__ = 'TestCase(%r)' % options.search_term @@ -125,8 +121,8 @@ url = urllib.parse.urljoin('file:', urllib.request.pathname2url(directory)) url = urllib.parse.urljoin(url, 'html/search.html?q=' + urllib.parse.quote_plus(options.search_term)) browser = Browser(options) - html = browser.wget(url, time_limit) - return test_html(html, options) + result = browser.wget(url, time_limit) + return test_html(result, options) def main(): import argparse