[Python-modules-commits] r26049 - in packages/sphinx/trunk/debian (5 files)
mitya57-guest at users.alioth.debian.org
mitya57-guest at users.alioth.debian.org
Sat Oct 5 12:37:07 UTC 2013
Date: Saturday, October 5, 2013 @ 12:37:05
Author: mitya57-guest
Revision: 26049
* Update to 1.2~b3
* JS tests:
- Port from deprecated static bindings and Python 2 to PyGI and
Python 3. Update the dependencies accordingly.
- Do not use web server, instead set a WebKit option that will allow
us to access files directly.
Modified:
packages/sphinx/trunk/debian/changelog
packages/sphinx/trunk/debian/control
packages/sphinx/trunk/debian/jstest/jstest.py
packages/sphinx/trunk/debian/jstest/run-tests
packages/sphinx/trunk/debian/tests/control
Modified: packages/sphinx/trunk/debian/changelog
===================================================================
--- packages/sphinx/trunk/debian/changelog 2013-10-05 12:34:19 UTC (rev 26048)
+++ packages/sphinx/trunk/debian/changelog 2013-10-05 12:37:05 UTC (rev 26049)
@@ -1,4 +1,4 @@
-sphinx (1.2~b2+dfsg-1) UNRELEASED; urgency=low
+sphinx (1.2~b3+dfsg-1) UNRELEASED; urgency=low
[ Dmitry Shachnev ]
* New upstream beta release.
@@ -6,8 +6,12 @@
* Drop upstream patches.
* Refresh and rebase other patches.
* Switch debian/watch to use HTTPS.
- * Increase time limit in JS tests, sometimes 10 seconds is not enough
- (closes: #724472).
+ * JS tests:
+ - Port from deprecated static bindings and Python 2 to PyGI and
+ Python 3. Update the dependencies accordingly.
+ - Do not use web server, instead set a WebKit option that will allow
+ us to access files directly. Now the pages should load faster
+ (closes: #724472).
* Switch from deprecated dh_pysupport to dh_python2 (closes: #659196).
* Add XS-Testsuite header, and replace XS-Python-Version with preferred
X-Python-Version (closes: #685508).
Modified: packages/sphinx/trunk/debian/control
===================================================================
--- packages/sphinx/trunk/debian/control 2013-10-05 12:34:19 UTC (rev 26048)
+++ packages/sphinx/trunk/debian/control 2013-10-05 12:37:05 UTC (rev 26049)
@@ -15,7 +15,8 @@
python-xapian,
python-nose, python3-nose,
python (>= 2.6.6-14~) | python-simplejson,
- xvfb, xauth, python-webkit, libjs-jquery (>= 1.4), libjs-underscore,
+ xvfb, xauth, libjs-jquery (>= 1.4), libjs-underscore,
+ python3-gi, gir1.2-webkit-3.0,
texlive-latex-recommended, texlive-latex-extra, texlive-fonts-recommended, texinfo,
perl,
gettext
Modified: packages/sphinx/trunk/debian/jstest/jstest.py
===================================================================
--- packages/sphinx/trunk/debian/jstest/jstest.py 2013-10-05 12:34:19 UTC (rev 26048)
+++ packages/sphinx/trunk/debian/jstest/jstest.py 2013-10-05 12:37:05 UTC (rev 26049)
@@ -1,7 +1,8 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# encoding=UTF-8
# Copyright © 2011 Jakub Wilk <jwilk at debian.org>
+# © 2013 Dmitry Shachnev <mitya57 at gmail.com>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
@@ -27,20 +28,15 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import threading
-import urlparse
-import urllib
+import urllib.parse
+import urllib.request, urllib.parse, urllib.error
import re
import unittest
-
-from BaseHTTPServer import HTTPServer
-from SimpleHTTPServer import SimpleHTTPRequestHandler
-
-import gobject
-import gtk
-import webkit
import os
-default_time_limit = 60.0
+from gi.repository import GLib, Gtk, WebKit
+
+default_time_limit = 10.0
time_step = 0.1
# HTTP browser
@@ -52,15 +48,18 @@
class Browser(object):
def __init__(self, options):
+ settings = WebKit.WebSettings()
+ settings.set_property('enable-file-access-from-file-uris', True)
self._time_limit = 0
- self._view = webkit.WebView()
+ self._view = WebKit.WebView()
+ self._view.set_settings(settings)
self._result = None
def wget(self, url, time_limit=default_time_limit):
self._view.open(url)
self._time_limit = time_limit
- gobject.timeout_add(int(1000 * time_step), self._check)
- gtk.main()
+ GLib.timeout_add(int(1000 * time_step), self._check)
+ Gtk.main()
if self._result is None:
raise Timeout
return self._result
@@ -79,46 +78,16 @@
match = re_done.search(contents)
if match is not None:
self._result = contents
- gtk.main_quit()
+ Gtk.main_quit()
return
self._time_limit -= time_step
if self._time_limit < 0:
self._result = None
- gtk.main_quit()
+ Gtk.main_quit()
else:
- gobject.timeout_add(int(1000 * time_step), self._check)
+ GLib.timeout_add(int(1000 * time_step), self._check)
-# HTTP server
-# ===========
-class RequestHandler(SimpleHTTPRequestHandler):
-
- def log_message(*args, **kwargs):
- pass
-
-class TinyHTTPServer(object):
-
- def __init__(self, directory):
- os.chdir(directory)
- self._httpd = HTTPServer(('127.0.0.1', 0), RequestHandler)
- thread = threading.Thread(target=self._httpd.serve_forever)
- thread.daemon = True
- thread.start()
- host, port = self._httpd.socket.getsockname()
- self.base_url = 'http://%s:%s/' % (host, port)
-
- def close(self):
- if self._httpd is None:
- return
- self._httpd.shutdown()
- self._httpd = None
-
- def __enter__(self):
- return self
-
- def __exit__(self, extype, value, traceback):
- self.close()
-
# Actual tests
# ============
@@ -155,14 +124,11 @@
return unittest.TextTestRunner(verbosity=2).run(suite)
def test_directory(directory, options, time_limit=default_time_limit):
- # The file:/// protocol doesn't work for the time being:
- # https://bitbucket.org/birkenfeld/sphinx/issue/723/search-broken-in-webkit-based-browsers
- # To work around this problem, spawn our own HTTP server.
- with TinyHTTPServer(directory) as http_server:
- url = urlparse.urljoin(http_server.base_url, 'search.html?q=' + urllib.quote_plus(options.search_term))
- browser = Browser(options)
- html = browser.wget(url, time_limit)
- return test_html(html, options)
+ 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)
def main():
import argparse
Modified: packages/sphinx/trunk/debian/jstest/run-tests
===================================================================
--- packages/sphinx/trunk/debian/jstest/run-tests 2013-10-05 12:34:19 UTC (rev 26048)
+++ packages/sphinx/trunk/debian/jstest/run-tests 2013-10-05 12:37:05 UTC (rev 26049)
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
import os
import sys
Modified: packages/sphinx/trunk/debian/tests/control
===================================================================
--- packages/sphinx/trunk/debian/tests/control 2013-10-05 12:34:19 UTC (rev 26048)
+++ packages/sphinx/trunk/debian/tests/control 2013-10-05 12:37:05 UTC (rev 26049)
@@ -5,4 +5,4 @@
Depends: python3-sphinx, python3-nose
Tests: sphinx-doc
-Depends: sphinx-doc, python, python-webkit, xvfb
+Depends: sphinx-doc, python3-gi, gir1.2-webkit-3.0, xvfb
More information about the Python-modules-commits
mailing list