mirror of
https://github.com/daijro/camoufox.git
synced 2026-10-04 16:00:21 +00:00
fix(python)!: remove dead public API and make list all --path work
Breaking changes: - Remove the exceptions UnknownProperty, InvalidDebugPort and MissingDebugPort. Nothing in the package raises them, so code catching them was catching nothing. - Remove the legacy `allow_webgl` keyword of launch_options(). Use `block_webgl=True`. The keyword now reaches Playwright as an unknown launch option and fails there instead of being silently consumed. `camoufox list all --path` accepted the flag and ignored it. It now prints the install path beside each installed build, as `camoufox list --path` already does for the installed tree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
fb21b2e35a
commit
4616aa58ca
@@ -680,7 +680,7 @@ def _list_installed(show_paths: bool):
|
||||
rprint(" └── Not configured", fg="yellow")
|
||||
|
||||
|
||||
def _list_all(_show_paths: bool):
|
||||
def _list_all(show_paths: bool):
|
||||
"""
|
||||
List all available versions from synced repos
|
||||
"""
|
||||
@@ -720,6 +720,8 @@ def _list_all(_show_paths: bool):
|
||||
click.secho(" (installed, active)", fg="green", bold=True, nl=False)
|
||||
else:
|
||||
click.secho(" (installed)", fg="green", nl=False)
|
||||
if show_paths:
|
||||
click.secho(f" -> {inst.path}", fg="bright_black", nl=False)
|
||||
|
||||
click.echo()
|
||||
|
||||
|
||||
@@ -38,14 +38,6 @@ class UnsupportedOS(Exception):
|
||||
...
|
||||
|
||||
|
||||
class UnknownProperty(Exception):
|
||||
"""
|
||||
Raised when the property is unknown.
|
||||
"""
|
||||
|
||||
...
|
||||
|
||||
|
||||
class InvalidPropertyType(Exception):
|
||||
"""
|
||||
Raised when the property type is invalid.
|
||||
@@ -62,22 +54,6 @@ class InvalidAddonPath(FileNotFoundError):
|
||||
...
|
||||
|
||||
|
||||
class InvalidDebugPort(ValueError):
|
||||
"""
|
||||
Raised when the debug port is invalid.
|
||||
"""
|
||||
|
||||
...
|
||||
|
||||
|
||||
class MissingDebugPort(ValueError):
|
||||
"""
|
||||
Raised when the debug port is missing.
|
||||
"""
|
||||
|
||||
...
|
||||
|
||||
|
||||
class LocaleError(Exception):
|
||||
"""
|
||||
Raised when the locale is invalid.
|
||||
|
||||
@@ -1412,8 +1412,7 @@ def launch_options(
|
||||
LeakWarning.warn('disable_coop', i_know_what_im_doing)
|
||||
firefox_user_prefs['browser.tabs.remote.useCrossOriginOpenerPolicy'] = False
|
||||
|
||||
# Allow allow_webgl parameter for backwards compatibility
|
||||
if block_webgl or launch_options.pop('allow_webgl', True) is False:
|
||||
if block_webgl:
|
||||
firefox_user_prefs['webgl.disabled'] = True
|
||||
LeakWarning.warn('block_webgl', i_know_what_im_doing)
|
||||
else:
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
"""`camoufox list --path` shows install paths in both listing modes."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from click.testing import CliRunner
|
||||
|
||||
from camoufox import __main__ as cli
|
||||
from camoufox.multiversion import InstalledVersion
|
||||
from camoufox.pkgman import Version
|
||||
|
||||
|
||||
def test_list_all_shows_the_path_of_an_installed_build(monkeypatch):
|
||||
install = Path("/cache/browsers/official/152.0.4-beta.30")
|
||||
installed = InstalledVersion(
|
||||
repo_name="official", version=Version(build="beta.30", version="152.0.4"), path=install
|
||||
)
|
||||
cache = {"repos": [{"name": "official", "versions": [{"version": "152.0.4", "build": "beta.30"}]}]}
|
||||
monkeypatch.setattr(cli, "_ensure_synced", lambda: True)
|
||||
monkeypatch.setattr(cli, "load_repo_cache", lambda: cache)
|
||||
monkeypatch.setattr(cli, "list_installed", lambda: [installed])
|
||||
|
||||
result = CliRunner().invoke(cli.cli, ["list", "all", "--path"])
|
||||
|
||||
assert result.exit_code == 0, result.output
|
||||
assert str(install) in result.output
|
||||
Reference in New Issue
Block a user