diff --git a/CHANGELOG.txt b/CHANGELOG.txt index be1d0bb5..b860e0e5 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,6 @@ +v1.3.0rc2 +- Check path validity for browser with is_file() +- Add option --verify_local in choreo_diagnose and fix local reporting logic v1.3.0rc1 - We now look for old download path as well as new download path v1.3.0rc0 diff --git a/src/choreographer/browsers/chromium.py b/src/choreographer/browsers/chromium.py index 15eceb9b..88524f33 100644 --- a/src/choreographer/browsers/chromium.py +++ b/src/choreographer/browsers/chromium.py @@ -174,11 +174,12 @@ def __init__( if not self.path: self.path = Chromium.find_browser(skip_local=self.skip_local) - if not self.path: + if not self.path or not Path(self.path).is_file(): raise ChromeNotFoundError( "Browser not found. You can use get_chrome() or " "choreo_get_chrome from bash. please see documentation. " - f"Local copy ignored: {self.skip_local}.", + f"Local copy ignored: {self.skip_local}. ", + f"Path calculated:: {self.path}.", ) _logger.info(f"Found chromium path: {self.path}") diff --git a/src/choreographer/cli/_cli_utils_no_qa.py b/src/choreographer/cli/_cli_utils_no_qa.py index 93e0aaff..562c06aa 100644 --- a/src/choreographer/cli/_cli_utils_no_qa.py +++ b/src/choreographer/cli/_cli_utils_no_qa.py @@ -40,11 +40,18 @@ def diagnose() -> None: ) parser.add_argument("--no-run", dest="run", action="store_false") parser.add_argument("--show", dest="headless", action="store_false") + parser.add_argument( + "--verify_local", + dest="verify_local", + action="store_true", + ) parser.set_defaults(run=True) parser.set_defaults(headless=True) + parser.set_defaults(verify_local=False) args, _ = parser.parse_known_args() run = args.run headless = args.headless + verify_local = args.verify_local fail = [] print("*".center(50, "*")) print("SYSTEM:".center(50, "*")) @@ -56,12 +63,14 @@ def diagnose() -> None: print("BROWSER:".center(50, "*")) try: local_path = Chromium.find_browser(skip_local=False, verify_local=True) - if not local_path or Path(local_path).exists(): + if not local_path or not Path(local_path).exists(): print(f"Local doesn't exist at {local_path}") else: print(f"Found local: {local_path}") except RuntimeError: print("Didn't find local.") + if verify_local: + raise browser_path = Chromium.find_browser(skip_local=True) print(browser_path) print("*".center(50, "*"))