Skip to content

Commit

Permalink
fix fnm version check (#2014)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lendemor authored Oct 23, 2023
1 parent 490ae40 commit d004252
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions reflex/utils/exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,13 @@ def output_system_info():
if system != "Windows":
dependencies.extend(
[
f"[FNM {constants.Fnm.VERSION} (Expected: {constants.Fnm.VERSION}) (PATH: {constants.Fnm.EXE})]",
f"[FNM {prerequisites.get_fnm_version()} (Expected: {constants.Fnm.VERSION}) (PATH: {constants.Fnm.EXE})]",
f"[Bun {prerequisites.get_bun_version()} (Expected: {constants.Bun.VERSION}) (PATH: {config.bun_path})]",
],
)
else:
dependencies.append(
f"[FNM {constants.Fnm.VERSION} (Expected: {constants.Fnm.VERSION}) (PATH: {constants.Fnm.EXE})]",
f"[FNM {prerequisites.get_fnm_version()} (Expected: {constants.Fnm.VERSION}) (PATH: {constants.Fnm.EXE})]",
)

if system == "Linux":
Expand Down
13 changes: 13 additions & 0 deletions reflex/utils/prerequisites.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,19 @@ def get_node_version() -> version.Version | None:
return None


def get_fnm_version() -> version.Version | None:
"""Get the version of fnm.
Returns:
The version of FNM.
"""
try:
result = processes.new_process([constants.Fnm.EXE, "--version"], run=True)
return version.parse(result.stdout.split(" ")[1]) # type: ignore
except (FileNotFoundError, TypeError):
return None


def get_bun_version() -> version.Version | None:
"""Get the version of bun.
Expand Down

0 comments on commit d004252

Please sign in to comment.