Skip to content

Commit

Permalink
Merge pull request #263 from tjwalton/patch-1
Browse files Browse the repository at this point in the history
Fix issue with get_rust_version
  • Loading branch information
davidhewitt authored Jul 5, 2022
2 parents ecc0d70 + 8d05107 commit 934443a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion setuptools_rust/rustc_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def get_rust_version() -> Optional[Version]: # type: ignore[no-any-unimported]
try:
# first line of rustc -Vv is something like
# rustc 1.61.0 (fe5b13d68 2022-05-18)
return Version(_rust_version_verbose().split(" ")[1])
return Version(_rust_version().split(" ")[1])
except (subprocess.CalledProcessError, OSError):
return None

Expand Down Expand Up @@ -58,6 +58,11 @@ def get_rust_target_list() -> List[str]:
return output.splitlines()


@lru_cache()
def _rust_version() -> str:
return subprocess.check_output(["rustc", "-V"], text=True)


@lru_cache()
def _rust_version_verbose() -> str:
return subprocess.check_output(["rustc", "-Vv"], text=True)

0 comments on commit 934443a

Please sign in to comment.