From de09867f877eb8779127143b68b248d09d701437 Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Thu, 3 Oct 2024 04:10:52 -0700 Subject: [PATCH] ignore lib/bin symlinking errors --- archivebox/abx/archivebox/base_binary.py | 15 ++++++++++----- archivebox/plugins_extractor/chrome/apps.py | 19 ++++++++++++------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/archivebox/abx/archivebox/base_binary.py b/archivebox/abx/archivebox/base_binary.py index 92720b98..2389b3e1 100644 --- a/archivebox/abx/archivebox/base_binary.py +++ b/archivebox/abx/archivebox/base_binary.py @@ -60,11 +60,16 @@ class BaseBinary(BaseHook, Binary): if not (binary.abspath and binary.abspath.exists()): return - bin_dir.mkdir(parents=True, exist_ok=True) - symlink = bin_dir / binary.name - symlink.unlink(missing_ok=True) - symlink.symlink_to(binary.abspath) - symlink.chmod(0o777) # make sure its executable by everyone + try: + bin_dir.mkdir(parents=True, exist_ok=True) + symlink = bin_dir / binary.name + symlink.unlink(missing_ok=True) + symlink.symlink_to(binary.abspath) + symlink.chmod(0o777) # make sure its executable by everyone + except Exception as err: + # print(f'[red]:warning: Failed to symlink {symlink} -> {binary.abspath}[/red] {err}') + # not actually needed, we can just run without it + pass @validate_call def load(self, fresh=False, **kwargs) -> Self: diff --git a/archivebox/plugins_extractor/chrome/apps.py b/archivebox/plugins_extractor/chrome/apps.py index 796a51c5..2f5d3f73 100644 --- a/archivebox/plugins_extractor/chrome/apps.py +++ b/archivebox/plugins_extractor/chrome/apps.py @@ -221,13 +221,18 @@ class ChromeBinary(BaseBinary): bin_dir.mkdir(parents=True, exist_ok=True) symlink = bin_dir / binary.name - if platform.system().lower() == 'darwin': - # if on macOS, browser binary is inside a .app, so we need to create a tiny bash script instead of a symlink - create_macos_app_symlink(binary.abspath, symlink) - else: - # otherwise on linux we can symlink directly to binary executable - symlink.unlink(missing_ok=True) - symlink.symlink_to(binary.abspath) + try: + if platform.system().lower() == 'darwin': + # if on macOS, browser binary is inside a .app, so we need to create a tiny bash script instead of a symlink + create_macos_app_symlink(binary.abspath, symlink) + else: + # otherwise on linux we can symlink directly to binary executable + symlink.unlink(missing_ok=True) + symlink.symlink_to(binary.abspath) + except Exception as err: + # print(f'[red]:warning: Failed to symlink {symlink} -> {binary.abspath}[/red] {err}') + # not actually needed, we can just run without it + pass @staticmethod def chrome_cleanup_lockfile():