mirror of
https://github.com/saymrwulf/cryptography.git
synced 2026-05-14 20:37:55 +00:00
Add the rustc version to debug assistance output when setup.py fails (#7382)
* Add the rustc version to debug assistance output when setup.py fails * Update setup.py Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com> * Apply formatter, better string manipulation * Try again with string manipulation * check=True * apply formatter Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
This commit is contained in:
parent
2bd0dda700
commit
5c33dcac26
1 changed files with 19 additions and 0 deletions
19
setup.py
19
setup.py
|
|
@ -6,6 +6,9 @@
|
|||
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from setuptools import setup
|
||||
|
|
@ -89,6 +92,22 @@ except: # noqa: E722
|
|||
except pkg_resources.DistributionNotFound:
|
||||
version = "n/a"
|
||||
print(f" {dist}: {version}")
|
||||
version = "n/a"
|
||||
if shutil.which("rustc") is not None:
|
||||
try:
|
||||
# If for any reason `rustc --version` fails, silently ignore it
|
||||
rustc_output = subprocess.run(
|
||||
["rustc", "--version"],
|
||||
capture_output=True,
|
||||
timeout=0.5,
|
||||
encoding="utf8",
|
||||
check=True,
|
||||
).stdout
|
||||
version = re.sub("^rustc ", "", rustc_output.strip())
|
||||
except subprocess.SubprocessError:
|
||||
pass
|
||||
print(f" rustc: {version}")
|
||||
|
||||
print(
|
||||
"""\
|
||||
=============================DEBUG ASSISTANCE=============================
|
||||
|
|
|
|||
Loading…
Reference in a new issue