From b9c8e33878ed13f70e4ccb61d834f49fc727a5ec Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Fri, 5 Jun 2020 16:29:45 +0100 Subject: [PATCH 1/3] Update GNOME proxy support for GNOME 3 and Python 3 GConf is replaced by dconf and the GSettings API in GNOME 3. --- doc/changelog.txt | 1 + doc/en/linkchecker.1 | 4 +-- doc/install.txt | 3 +- doc/web/media/man1/linkchecker.1.html | 4 +-- linkcheck/configuration/__init__.py | 45 +++++++++------------------ linkchecker | 2 +- setup.py | 2 +- 7 files changed, 23 insertions(+), 38 deletions(-) diff --git a/doc/changelog.txt b/doc/changelog.txt index 2fe8f154..70e8cdf4 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -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) diff --git a/doc/en/linkchecker.1 b/doc/en/linkchecker.1 index 3a29e5bf..f34c4e4a 100644 --- a/doc/en/linkchecker.1 +++ b/doc/en/linkchecker.1 @@ -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 diff --git a/doc/install.txt b/doc/install.txt index 95a77775..55779455 100644 --- a/doc/install.txt +++ b/doc/install.txt @@ -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/ diff --git a/doc/web/media/man1/linkchecker.1.html b/doc/web/media/man1/linkchecker.1.html index 00dd851e..0d5f9842 100644 --- a/doc/web/media/man1/linkchecker.1.html +++ b/doc/web/media/man1/linkchecker.1.html @@ -308,7 +308,7 @@ To use a proxy on Unix or Windows set the $http_proxy, $https_proxy or 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. 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.

You can also set a comma-separated domain list in the $no_proxy environment variables to ignore any proxy settings for these domains.

@@ -518,7 +518,7 @@ Copyright © 2000-2014 Bastian Kleineidam - +
2020-04-242020-06-05 LinkChecker
diff --git a/linkcheck/configuration/__init__.py b/linkcheck/configuration/__init__.py index 415926bc..e4ffd424 100644 --- a/linkcheck/configuration/__init__.py +++ b/linkcheck/configuration/__init__.py @@ -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 diff --git a/linkchecker b/linkchecker index 8e9b683a..a3896c38 100755 --- a/linkchecker +++ b/linkchecker @@ -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://[:@][:]". 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 diff --git a/setup.py b/setup.py index 53dc947e..eb29f4a4 100755 --- a/setup.py +++ b/setup.py @@ -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/ # } From 11900984e25856d59603d91fab319f403b26eb65 Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Fri, 5 Jun 2020 16:29:45 +0100 Subject: [PATCH 2/3] Run po4a on doc translatios after GNOME proxy update --- doc/de.po | 25 ++++++++++++++++++++----- doc/de/linkchecker.1 | 14 +++++++------- doc/linkchecker.doc.pot | 14 ++++++++++---- 3 files changed, 37 insertions(+), 16 deletions(-) diff --git a/doc/de.po b/doc/de.po index 01f8cd9e..3661821f 100644 --- a/doc/de.po +++ b/doc/de.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: linkchecker 3.4\n" -"POT-Creation-Date: 2020-06-04 17:30+0100\n" +"POT-Creation-Date: 2020-06-05 16:18+0100\n" "PO-Revision-Date: 2020-06-04 17:33+0100\n" "Last-Translator: Chris Mayo \n" "Language-Team: German - Germany <>\n" @@ -25,9 +25,10 @@ msgid "LINKCHECKER" msgstr "LINKCHECKER" #. type: TH -#: en/linkchecker.1:1 en/linkcheckerrc.5:1 -#, no-wrap -msgid "2020-04-24" +#: en/linkchecker.1:1 +#, fuzzy, no-wrap +#| msgid "2020-04-24" +msgid "2020-06-05" msgstr "2020-04-24" # type: TH @@ -1116,12 +1117,20 @@ msgstr "PROXY UNTERSTÜTZUNG" # type: Plain text #. type: Plain text #: en/linkchecker.1:303 +#, fuzzy +#| msgid "" +#| "To use a proxy on Unix or Windows set the $http_proxy, $https_proxy or " +#| "$ftp_proxy environment variables to the proxy URL. The URL should be of " +#| "the form B[IB<:>IB<@>]I[B<:>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 Config to select a proxy." msgid "" "To use a proxy on Unix or Windows set the $http_proxy, $https_proxy or " "$ftp_proxy environment variables to the proxy URL. The URL should be of the " "form B[IB<:>IB<@>]I[B<:>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 " +"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 " @@ -1756,6 +1765,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 diff --git a/doc/de/linkchecker.1 b/doc/de/linkchecker.1 index 5d1fd3c8..acd87cd6 100644 --- a/doc/de/linkchecker.1 +++ b/doc/de/linkchecker.1 @@ -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 @@ -298,12 +298,12 @@ Das untige Beispiel sendet zwei Cookies zu allen URLs die mit Set\-cookie: baggage="elitist"; comment="hologram" .EE .SH "PROXY UNTERSTÜTZUNG" -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 -\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. +To use a proxy on Unix or Windows set the $http_proxy, $https_proxy or +$ftp_proxy 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 GNOME or KDE on Linux systems. On a Mac use the Internet +Config to select a proxy. .PP Sie können eine komma\-separierte Liste von Domainnamen in der $no_proxy Umgebungsvariable setzen, um alle Proxies für diese Domainnamen zu diff --git a/doc/linkchecker.doc.pot b/doc/linkchecker.doc.pot index d69bffe7..bf965160 100644 --- a/doc/linkchecker.doc.pot +++ b/doc/linkchecker.doc.pot @@ -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 \n" "Language-Team: LANGUAGE \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[IB<:>IB<@>]I[B<:>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 " +"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" From f494b62981f9b9443e7e8919f7eab441977920b3 Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Thu, 11 Jun 2020 19:35:02 +0100 Subject: [PATCH 3/3] Copy date and add translation for GNOME/KDE to de.po --- doc/de.po | 19 +++++-------------- doc/de/linkchecker.1 | 13 +++++++------ 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/doc/de.po b/doc/de.po index 3661821f..9ed0a7a4 100644 --- a/doc/de.po +++ b/doc/de.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: linkchecker 3.4\n" "POT-Creation-Date: 2020-06-05 16:18+0100\n" -"PO-Revision-Date: 2020-06-04 17:33+0100\n" +"PO-Revision-Date: 2020-06-11 19:31+0100\n" "Last-Translator: Chris Mayo \n" "Language-Team: German - Germany <>\n" "Language: de_DE\n" @@ -26,10 +26,9 @@ msgstr "LINKCHECKER" #. type: TH #: en/linkchecker.1:1 -#, fuzzy, no-wrap -#| msgid "2020-04-24" +#, no-wrap msgid "2020-06-05" -msgstr "2020-04-24" +msgstr "2020-06-05" # type: TH #. type: TH @@ -1117,14 +1116,6 @@ msgstr "PROXY UNTERSTÜTZUNG" # type: Plain text #. type: Plain text #: en/linkchecker.1:303 -#, fuzzy -#| msgid "" -#| "To use a proxy on Unix or Windows set the $http_proxy, $https_proxy or " -#| "$ftp_proxy environment variables to the proxy URL. The URL should be of " -#| "the form B[IB<:>IB<@>]I[B<:>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 Config to select a proxy." msgid "" "To use a proxy on Unix or Windows set the $http_proxy, $https_proxy or " "$ftp_proxy environment variables to the proxy URL. The URL should be of the " @@ -1137,8 +1128,8 @@ msgstr "" "$http_proxy, $https_proxy oder $ftp_proxy Umgebungsvariablen auf die Proxy " "URL. Die URL sollte die Form B[IB<:>IB<@>]I[B<:" ">I] 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 diff --git a/doc/de/linkchecker.1 b/doc/de/linkchecker.1 index acd87cd6..a8dc436c 100644 --- a/doc/de/linkchecker.1 +++ b/doc/de/linkchecker.1 @@ -298,12 +298,13 @@ Das untige Beispiel sendet zwei Cookies zu allen URLs die mit Set\-cookie: baggage="elitist"; comment="hologram" .EE .SH "PROXY UNTERSTÜTZUNG" -To use a proxy on Unix or Windows set the $http_proxy, $https_proxy or -$ftp_proxy 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 GNOME or KDE on Linux systems. On a Mac use the Internet -Config to select a proxy. +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 +\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, 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