Skip to content

Commit 934443a

Browse files
authored
Merge pull request #263 from tjwalton/patch-1
Fix issue with get_rust_version
2 parents ecc0d70 + 8d05107 commit 934443a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

setuptools_rust/rustc_info.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def get_rust_version() -> Optional[Version]: # type: ignore[no-any-unimported]
1010
try:
1111
# first line of rustc -Vv is something like
1212
# rustc 1.61.0 (fe5b13d68 2022-05-18)
13-
return Version(_rust_version_verbose().split(" ")[1])
13+
return Version(_rust_version().split(" ")[1])
1414
except (subprocess.CalledProcessError, OSError):
1515
return None
1616

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

6060

61+
@lru_cache()
62+
def _rust_version() -> str:
63+
return subprocess.check_output(["rustc", "-V"], text=True)
64+
65+
6166
@lru_cache()
6267
def _rust_version_verbose() -> str:
6368
return subprocess.check_output(["rustc", "-Vv"], text=True)

0 commit comments

Comments
 (0)