From a057e65f6e294d183d3af78956e8706364f7b9ac Mon Sep 17 00:00:00 2001 From: John Comeau Date: Sun, 5 Jan 2025 07:22:47 -0800 Subject: [PATCH 1/5] debugging why command-line URL isn't honored --- torbrowser_launcher/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/torbrowser_launcher/__init__.py b/torbrowser_launcher/__init__.py index 4eef7fe..19955cf 100644 --- a/torbrowser_launcher/__init__.py +++ b/torbrowser_launcher/__init__.py @@ -1,3 +1,4 @@ +#!/usr/bin/python3 -OO """ Tor Browser Launcher https://gitlab.torproject.org/tpo/applications/torbrowser-launcher/ @@ -31,6 +32,9 @@ import sys import argparse import signal +import logging + +logging.basicConfig(level=logging.DEBUG if __debug__ else logging.WARNING) from PyQt5 import QtCore, QtWidgets @@ -89,6 +93,7 @@ def main(): gui = Settings(common, app) else: # Launcher mode + logging.debug('url_list: %s', url_list) gui = Launcher(common, app, url_list) # Center the window From 024ac59cef98738a3dafc6755753f87ab9d12402 Mon Sep 17 00:00:00 2001 From: John Comeau Date: Sun, 5 Jan 2025 07:43:08 -0800 Subject: [PATCH 2/5] patch launcher for debugging --- torbrowser-launcher | 2 ++ 1 file changed, 2 insertions(+) diff --git a/torbrowser-launcher b/torbrowser-launcher index f8b7c4b..ce0bce9 100755 --- a/torbrowser-launcher +++ b/torbrowser-launcher @@ -27,5 +27,7 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ +import sys +sys.path.insert(0, '/usr/src/jcomeauictx/torbrowser-launcher') import torbrowser_launcher torbrowser_launcher.main() From 2693668453feec3ca607ce368c1ac17765300ab7 Mon Sep 17 00:00:00 2001 From: John Comeau Date: Wed, 15 Jan 2025 06:15:13 -0800 Subject: [PATCH 3/5] now uses specified URL --- torbrowser_launcher/launcher.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/torbrowser_launcher/launcher.py b/torbrowser_launcher/launcher.py index d339366..3f0b692 100644 --- a/torbrowser_launcher/launcher.py +++ b/torbrowser_launcher/launcher.py @@ -478,7 +478,8 @@ def run(self): # Run Tor Browser subprocess.call( - [self.common.paths["tbb"]["start"]], cwd=self.common.paths["tbb"]["dir_tbb"] + [self.common.paths["tbb"]["start"], *self.url_list], + cwd=self.common.paths["tbb"]["dir_tbb"] ) sys.exit(0) From 0d811e9593bba32143fc03a99f9ba1b5401d7c75 Mon Sep 17 00:00:00 2001 From: John Comeau Date: Wed, 15 Jan 2025 06:17:44 -0800 Subject: [PATCH 4/5] reverted changes to __init__.py, no longer needed --- torbrowser_launcher/__init__.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/torbrowser_launcher/__init__.py b/torbrowser_launcher/__init__.py index 19955cf..4eef7fe 100644 --- a/torbrowser_launcher/__init__.py +++ b/torbrowser_launcher/__init__.py @@ -1,4 +1,3 @@ -#!/usr/bin/python3 -OO """ Tor Browser Launcher https://gitlab.torproject.org/tpo/applications/torbrowser-launcher/ @@ -32,9 +31,6 @@ import sys import argparse import signal -import logging - -logging.basicConfig(level=logging.DEBUG if __debug__ else logging.WARNING) from PyQt5 import QtCore, QtWidgets @@ -93,7 +89,6 @@ def main(): gui = Settings(common, app) else: # Launcher mode - logging.debug('url_list: %s', url_list) gui = Launcher(common, app, url_list) # Center the window From ccc32075651cf3c1ecd8a528ec7da5468064a454 Mon Sep 17 00:00:00 2001 From: John Comeau Date: Wed, 15 Jan 2025 06:33:03 -0800 Subject: [PATCH 5/5] fixed deprecation warning, removed sys.path insert used for troubleshooting --- setup.py | 13 +++++++++++-- torbrowser-launcher | 2 -- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 2e09799..52c188e 100644 --- a/setup.py +++ b/setup.py @@ -36,8 +36,17 @@ SHARE = "share" # detect linux distribution -distro = distro.linux_distribution()[0] - +# (fixing deprecation warning, noticed the following: +# distro.linux_distribution() returns ('Debian GNU/Linux', '12', 'bookworm') +# on my system. But the deprecation warning says to use +# "distro.id(), distro.version() and distro.name() instead.", which would be, +# in order, ('debian', '12', 'Debian GNU/Linux') +# To get the same output as `linux_distribution()`, one would need to use +# (distro.name(), distro.version(), distro.codename()). +# But since this variable is only used to check for the value "Ubuntu", +# it seems `distro.name` is the desired value, not `distro.id`.) +# (jc@unternet.net) +distro = distro.name() def file_list(path): files = [] diff --git a/torbrowser-launcher b/torbrowser-launcher index ce0bce9..f8b7c4b 100755 --- a/torbrowser-launcher +++ b/torbrowser-launcher @@ -27,7 +27,5 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -import sys -sys.path.insert(0, '/usr/src/jcomeauictx/torbrowser-launcher') import torbrowser_launcher torbrowser_launcher.main()