Skip to content

Commit

Permalink
Ensure esbuild can be detected on windows (#7625)
Browse files Browse the repository at this point in the history
* Ensure esbuild can be detected on windows

* Use backoff instead

* Use shutil.which instead
  • Loading branch information
philippjfr authored Jan 17, 2025
1 parent 3b06d16 commit 44fc301
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions panel/io/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,17 @@ def setup_build_dir(build_dir: str | os.PathLike | None = None):
shutil.rmtree(temp_dir)


def check_cli_tool(tool_name):
def check_cli_tool(tool_name: str) -> bool:
try:
result = subprocess.run([tool_name, '--version'], capture_output=True)
if result.returncode == 0:
return True
else:
return False
cmd = shutil.which(tool_name)
except Exception:
return False
cmd = None
if cmd:
return True
if sys.platform == 'win32':
tool_name = f'{tool_name}.cmd'
return check_cli_tool(tool_name)
return False


def find_module_bundles(module_spec: str) -> dict[pathlib.Path, list[ReactiveESM]]:
Expand Down

0 comments on commit 44fc301

Please sign in to comment.