Skip to content

Commit

Permalink
Simplify system node usage logic
Browse files Browse the repository at this point in the history
No need to try and be overly smart about this.
  • Loading branch information
pradyunsg committed Jan 4, 2022
1 parent 32377e2 commit 7e5b61e
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions src/sphinx_theme_builder/_internal/nodejs.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,23 +96,7 @@ def _run_python_nodeenv(*args: str) -> None:


def _should_use_system_node(node_version: str) -> bool:
try:
process = subprocess.run(["node", "--version"], capture_output=True, check=True)
except FileNotFoundError:
log("[yellow]#[/] [cyan]Could not find a `node` executable.[/]")
return False
except subprocess.CalledProcessError as error:
log(
"[yellow]#[/] [cyan]`node` executable did not exit cleanly.[/]\n"
f"{error.stderr.decode()}"
)
return False

if process.stdout.decode().strip() != f"v{node_version}":
log("[yellow]#[/] [cyan]The system `node` has a different version:[/] {}")
return False

return True
return os.environ.get("STB_USE_SYSTEM_NODE", "false") == "true"


def create_nodeenv(nodeenv: Path, node_version: str) -> None:
Expand Down

0 comments on commit 7e5b61e

Please sign in to comment.