Merge pull request #420 from cjmayo/dconf

Update GNOME proxy support for GNOME 3 and Python 3
This commit is contained in:
Chris Mayo 2020-06-14 18:56:19 +01:00 committed by GitHub
commit 4009039158
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 50 additions and 52 deletions

View file

@ -2,6 +2,7 @@
Changes:
- cmdline: Remove options replaced by plugins and made ineffective in 9.0
- configuration: Update proxy settings support for GNOME 3.
9.4 "just passing by" (released 12.4.2018)

View file

@ -6,8 +6,8 @@
msgid ""
msgstr ""
"Project-Id-Version: linkchecker 3.4\n"
"POT-Creation-Date: 2020-06-04 17:30+0100\n"
"PO-Revision-Date: 2020-06-04 17:33+0100\n"
"POT-Creation-Date: 2020-06-05 16:18+0100\n"
"PO-Revision-Date: 2020-06-11 19:31+0100\n"
"Last-Translator: Chris Mayo <aklhfex@gmail.com>\n"
"Language-Team: German - Germany <>\n"
"Language: de_DE\n"
@ -25,10 +25,10 @@ msgid "LINKCHECKER"
msgstr "LINKCHECKER"
#. type: TH
#: en/linkchecker.1:1 en/linkcheckerrc.5:1
#: en/linkchecker.1:1
#, no-wrap
msgid "2020-04-24"
msgstr "2020-04-24"
msgid "2020-06-05"
msgstr "2020-06-05"
# type: TH
#. type: TH
@ -1121,15 +1121,15 @@ msgid ""
"$ftp_proxy environment variables to the proxy URL. The URL should be of the "
"form B<http://>[I<user>B<:>I<pass>B<@>]I<host>[B<:>I<port>]. LinkChecker "
"also detects manual proxy settings of Internet Explorer under Windows "
"systems, and gconf or KDE on Linux systems. On a Mac use the Internet "
"systems, and GNOME or KDE on Linux systems. On a Mac use the Internet "
"Config to select a proxy."
msgstr ""
"Um einen Proxy unter Unix oder Windows zu benutzen, setzen Sie die "
"$http_proxy, $https_proxy oder $ftp_proxy Umgebungsvariablen auf die Proxy "
"URL. Die URL sollte die Form B<http://>[I<user>B<:>I<pass>B<@>]I<host>[B<:"
">I<port>] besitzen. LinkChecker erkennt auch die Proxy-Einstellungen des "
"Internet Explorers auf einem Windows-System. Auf einem Mac benutzen Sie die "
"Internet Konfiguration."
"Internet Explorers auf einem Windows-System, und GNOME oder KDE auf Linux "
"Systemen. Auf einem Mac benutzen Sie die Internet Konfiguration."
#. type: Plain text
#: en/linkchecker.1:306
@ -1756,6 +1756,12 @@ msgstr "Copyright \\(co 2000-2014 Bastian Kleineidam"
msgid "LINKCHECKERRC"
msgstr "LINKCHECKERRC"
#. type: TH
#: en/linkcheckerrc.5:1
#, no-wrap
msgid "2020-04-24"
msgstr "2020-04-24"
# type: Plain text
#. type: Plain text
#: en/linkcheckerrc.5:4

View file

@ -3,7 +3,7 @@
.\" This file was generated with po4a. Translate the source file.
.\"
.\"*******************************************************************
.TH LINKCHECKER 1 2020\-04\-24 LinkChecker "LinkChecker User Manual"
.TH LINKCHECKER 1 2020\-06\-05 LinkChecker "LinkChecker User Manual"
.SH NAME
linkchecker \- Kommandozeilenprogramm zum Prüfen von HTML Dokumenten und
Webseiten auf ungültige Verknüpfungen
@ -303,7 +303,8 @@ $http_proxy, $https_proxy oder $ftp_proxy Umgebungsvariablen auf die Proxy
URL. Die URL sollte die Form
\fBhttp://\fP[\fIuser\fP\fB:\fP\fIpass\fP\fB@\fP]\fIhost\fP[\fB:\fP\fIport\fP] besitzen. LinkChecker
erkennt auch die Proxy\-Einstellungen des Internet Explorers auf einem
Windows\-System. Auf einem Mac benutzen Sie die Internet Konfiguration.
Windows\-System, und GNOME oder KDE auf Linux Systemen. Auf einem Mac
benutzen Sie die Internet Konfiguration.
.PP
Sie können eine komma\-separierte Liste von Domainnamen in der $no_proxy
Umgebungsvariable setzen, um alle Proxies für diese Domainnamen zu

View file

@ -1,4 +1,4 @@
.TH LINKCHECKER 1 2020-04-24 "LinkChecker" "LinkChecker User Manual"
.TH LINKCHECKER 1 2020-06-05 "LinkChecker" "LinkChecker User Manual"
.SH NAME
linkchecker \- command line client to check HTML documents and websites for broken links
.SH SYNOPSIS
@ -298,7 +298,7 @@ To use a proxy on Unix or Windows set the $http_proxy, $https_proxy or $ftp_prox
environment variables to the proxy URL. The URL should be of the form
\fBhttp://\fP[\fIuser\fP\fB:\fP\fIpass\fP\fB@\fP]\fIhost\fP[\fB:\fP\fIport\fP].
LinkChecker also detects manual proxy settings of Internet Explorer under
Windows systems, and gconf or KDE on Linux systems.
Windows systems, and GNOME or KDE on Linux systems.
On a Mac use the Internet Config to select a proxy.
.PP
You can also set a comma-separated domain list in the $no_proxy environment

View file

@ -54,7 +54,8 @@ First, install the required software.
ClamAv from https://www.clamav.net/
7. *Optional, for GNOME proxy setting parsing:*
Python Gtk from http://www.pygtk.org/downloads.html
PyGObject and GIO.
Best installed from your distribution e.g. ``python3-gi``
8. *Optional, to run the WSGI web interface:*
Apache from https://httpd.apache.org/

View file

@ -7,7 +7,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2020-06-04 17:30+0100\n"
"POT-Creation-Date: 2020-06-05 16:18+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -23,9 +23,9 @@ msgid "LINKCHECKER"
msgstr ""
#. type: TH
#: en/linkchecker.1:1 en/linkcheckerrc.5:1
#: en/linkchecker.1:1
#, no-wrap
msgid "2020-04-24"
msgid "2020-06-05"
msgstr ""
#. type: TH
@ -883,7 +883,7 @@ msgid ""
"$ftp_proxy environment variables to the proxy URL. The URL should be of the "
"form B<http://>[I<user>B<:>I<pass>B<@>]I<host>[B<:>I<port>]. LinkChecker "
"also detects manual proxy settings of Internet Explorer under Windows "
"systems, and gconf or KDE on Linux systems. On a Mac use the Internet "
"systems, and GNOME or KDE on Linux systems. On a Mac use the Internet "
"Config to select a proxy."
msgstr ""
@ -1397,6 +1397,12 @@ msgstr ""
msgid "LINKCHECKERRC"
msgstr ""
#. type: TH
#: en/linkcheckerrc.5:1
#, no-wrap
msgid "2020-04-24"
msgstr ""
#. type: Plain text
#: en/linkcheckerrc.5:4
msgid "linkcheckerrc - configuration file for LinkChecker"

View file

@ -308,7 +308,7 @@ To use a proxy on Unix or Windows set the $http_proxy, $https_proxy or
form
<b>http://</b>[<i>user</i><b>:</b><i>pass</i><b>@</b>]<i>host</i>[<b>:</b><i>port</i>].
LinkChecker also detects manual proxy settings of Internet Explorer under
Windows systems, and gconf or KDE on Linux systems. On a Mac use the Internet
Windows systems, and GNOME or KDE on Linux systems. On a Mac use the Internet
Config to select a proxy.
<p class="Pp">You can also set a comma-separated domain list in the $no_proxy
environment variables to ignore any proxy settings for these domains.</p>
@ -518,7 +518,7 @@ Copyright &#x00A9; 2000-2014 Bastian Kleineidam
</div>
<table class="foot">
<tr>
<td class="foot-date">2020-04-24</td>
<td class="foot-date">2020-06-05</td>
<td class="foot-os">LinkChecker</td>
</tr>
</table>

View file

@ -70,7 +70,7 @@ Modules = (
("pygeoip", "GeoIP", 'lib_version'), # on Windows systems
("sqlite3", "Pysqlite", 'version'),
("sqlite3", "Sqlite", 'sqlite_version'),
("gconf", "Gconf", '__version__'),
("gi", "PyGObject", '__version__'),
("meliae", "Meliae", '__version__'),
)
@ -331,11 +331,11 @@ class Configuration(dict):
if os.name != 'posix':
return
if "http" not in self["proxy"]:
http_proxy = get_gconf_http_proxy() or get_kde_http_proxy()
http_proxy = get_gnome_proxy() or get_kde_http_proxy()
if http_proxy:
self["proxy"]["http"] = http_proxy
if "ftp" not in self["proxy"]:
ftp_proxy = get_gconf_ftp_proxy() or get_kde_ftp_proxy()
ftp_proxy = get_gnome_proxy(protocol="FTP") or get_kde_ftp_proxy()
if ftp_proxy:
self["proxy"]["ftp"] = ftp_proxy
@ -440,43 +440,26 @@ def get_user_config():
return userconf
def get_gconf_http_proxy():
"""Return host:port for GConf HTTP proxy if found, else None."""
def get_gnome_proxy(protocol="HTTP"):
"""Return host:port for a GNOME proxy if found, else None."""
try:
import gconf
import gi
gi.require_version('Gio', '2.0')
from gi.repository import Gio
except ImportError:
return None
try:
client = gconf.client_get_default()
if client.get_bool("/system/http_proxy/use_http_proxy"):
host = client.get_string("/system/http_proxy/host")
port = client.get_int("/system/http_proxy/port")
if host:
if not port:
port = 8080
return "%s:%d" % (host, port)
except Exception as msg:
log.debug(LOG_CHECK, "error getting HTTP proxy from gconf: %s", msg)
pass
return None
def get_gconf_ftp_proxy():
"""Return host:port for GConf FTP proxy if found, else None."""
try:
import gconf
except ImportError:
return None
try:
client = gconf.client_get_default()
host = client.get_string("/system/proxy/ftp_host")
port = client.get_int("/system/proxy/ftp_port")
settings = Gio.Settings.new("org.gnome.system.proxy.%s" % protocol.lower())
if protocol == "HTTP" and not settings.get_boolean("enabled"):
return None
host = settings.get_string("host")
port = settings.get_int("port")
if host:
if not port:
port = 8080
return "%s:%d" % (host, port)
except Exception as msg:
log.debug(LOG_CHECK, "error getting FTP proxy from gconf: %s", msg)
log.debug(LOG_CHECK, "error getting %s proxy from GNOME: %s", (protocol, msg))
pass
return None

View file

@ -84,7 +84,7 @@ To use a proxy on Unix or Windows set $http_proxy, $https_proxy or $ftp_proxy
to the proxy URL. The URL should be of the form
"http://[<user>:<pass>@]<host>[:<port>]".
LinkChecker also detects manual proxy settings of Internet Explorer under
Windows systems, and gconf or KDE on Linux systems.
Windows systems, and GNOME or KDE on Linux systems.
On a Mac use the Internet Config to select a proxy.
LinkChecker honors the $no_proxy environment variable. It can be a list

View file

@ -386,7 +386,7 @@ setup(
# See also doc/install.txt for more detailed dependency documentation.
# extra_requires = {
# "IP country info": ['GeoIP'], # https://pypi.org/project/GeoIP/
# "GNOME proxies": ['pygtk'], # http://www.pygtk.org/downloads.html
# "GNOME proxies": ['PyGObject'], # https://pypi.org/project/PyGObject/
# "Bash completion": ['argcomplete'], # https://pypi.org/project/argcomplete/
# "Memory debugging": ['meliae'], # https://pypi.org/project/meliae/
# }