Package: python2.6
Version: 2.6.6-6
Severity: normal
Tags: upstream patch
The webbrowser.open(url) function blocks when the environment variable BROWSER
=chromium-browser is present and an instance of Chromium is not already
running. If BROWSER is unset the function does not block when launching a
graphical browser. However, if the user is not in a Gnome or KDE environment,
there is no way other than BROWSER to configure a preferred web browser.
Apparently the webbrowser module honors the BROWSER environment variable but
any commands that do not match its own internal list are run in the foreground.
If I understand the design intent correctly, unfortunately this means
webbrowser must know the names of all possible graphical browsers to be able to
differentiate between commands it must run in the foreground or background.
In my default Gnome environment:
m...@tesla:~$ gconftool-2 --get /desktop/gnome/url-handlers/http/command
/usr/bin/chromium-browser %s
m...@tesla:~$ echo $BROWSER
chromium-browser:w3m
m...@tesla:~$ /usr/bin/python2.6 /usr/lib/python2.6/webbrowser.py
http://www.debian.org/
# Chromium is launched, command blocks until web browser window is closed
m...@tesla:~$ BROWSER= /usr/bin/python2.6 /usr/lib/python2.6/webbrowser.py
http://www.debian.org/
# Chromium is launched, command returns immediately
Attached is an updated webbrowser.diff, which was already Debianizing the
browser list since python2.5, with support added for Google's Chromium and
Chrome as they install on Debian currently. Yes, Chrome is non-free but I
figured I'd add them as a set, feel free to edit out. Ideally this module
would work (meaning not block) with BROWSER set to any graphical browser
officially supported by Debian but I don't know what the complete list is.
-- System Information:
Debian Release: squeeze/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.32-5-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages python2.6 depends on:
ii libbz2-1.0 1.0.5-6 high-quality block-sorting file co
ii libc6 2.11.2-7 Embedded GNU C Library: Shared lib
ii libdb4.8 4.8.30-2 Berkeley v4.8 Database Libraries [
ii libexpat1 2.0.1-7 XML parsing C library - runtime li
ii libncursesw5 5.7+20100313-4 shared libraries for terminal hand
ii libreadline6 6.1-3 GNU readline and history libraries
ii libsqlite3-0 3.7.3-1 SQLite 3 shared library
ii mime-support 3.48-1 MIME files 'mime.types' & 'mailcap
ii python2.6-minimal 2.6.6-6 A minimal subset of the Python lan
python2.6 recommends no packages.
Versions of packages python2.6 suggests:
ii binutils 2.20.1-15 The GNU assembler, linker and bina
ii python2.6-doc 2.6.6-6 Documentation for the high-level o
pn python2.6-profiler <none> (no description available)
-- no debconf information
-- debsums errors found:
debsums: changed file /usr/lib/python2.6/webbrowser.py (from python2.6 package)
# DP: Recognize other browsers: www-browser, x-www-browser, iceweasel, iceape.
Index: python2.6-2.6.5+20100521/Lib/webbrowser.py
===================================================================
--- python2.6-2.6.6.orig/Lib/webbrowser.py 2010-08-01 20:24:26.000000000
-0400
+++ python2.6-2.6.6/Lib/webbrowser.py 2010-11-06 15:27:31.000000000 -0400
@@ -453,9 +453,13 @@
if "KDE_FULL_SESSION" in os.environ and _iscommand("kfmclient"):
register("kfmclient", Konqueror, Konqueror("kfmclient"))
+ if _iscommand("x-www-browser"):
+ register("x-www-browser", None, BackgroundBrowser("x-www-browser"))
+
# The Mozilla/Netscape browsers
for browser in ("mozilla-firefox", "firefox",
"mozilla-firebird", "firebird",
+ "iceweasel", "iceape",
"seamonkey", "mozilla", "netscape"):
if _iscommand(browser):
register(browser, None, Mozilla(browser))
@@ -471,6 +475,11 @@
if _iscommand(browser):
register(browser, None, Galeon(browser))
+ # Google's Chromium and Chrome browsers
+ for browser in ("chromium-browser", "google-chrome"):
+ if _iscommand(browser):
+ register(browser, None, BackgroundBrowser(browser))
+
# Skipstone, another Gtk/Mozilla based browser
if _iscommand("skipstone"):
register("skipstone", None, BackgroundBrowser("skipstone"))
@@ -493,6 +502,8 @@
# Also try console browsers
if os.environ.get("TERM"):
+ if _iscommand("www-browser"):
+ register("www-browser", None, GenericBrowser("www-browser"))
# The Links/elinks browsers
<http://artax.karlin.mff.cuni.cz/~mikulas/links/>
if _iscommand("links"):
register("links", None, GenericBrowser("links"))