Skip to content

fix test-cross build failure #517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions setuptools_rust/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@
from setuptools.command.build_ext import get_abi3_suffix
from setuptools.command.install_scripts import install_scripts as CommandInstallScripts

from ._utils import check_subprocess_output, format_called_process_error, Env
from ._utils import (
check_subprocess_output,
format_called_process_error,
Env,
run_subprocess,
)
from .command import RustCommand
from .extension import Binding, RustBin, RustExtension, Strip
from .rustc_info import (
Expand Down Expand Up @@ -252,12 +257,14 @@ def build_extension(
# If quiet, capture all output and only show it in the exception
# If not quiet, forward all cargo output to stderr
stderr = subprocess.PIPE if quiet else None
cargo_messages = check_subprocess_output(
cargo_messages = run_subprocess(
command,
env=env,
check=True,
stdout=subprocess.PIPE,
stderr=stderr,
text=True,
)
).stdout
except subprocess.CalledProcessError as e:
# Don't include stdout in the formatted error as it is a huge dump
# of cargo json lines which aren't helpful for the end user.
Expand Down
13 changes: 9 additions & 4 deletions setuptools_rust/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
if TYPE_CHECKING:
from semantic_version import SimpleSpec

from ._utils import check_subprocess_output, format_called_process_error, Env
from ._utils import format_called_process_error, Env, run_subprocess


class Binding(IntEnum):
Expand Down Expand Up @@ -265,9 +265,14 @@ def _metadata(self, cargo: str, quiet: bool) -> "CargoMetadata":
# If quiet, capture stderr and only show it on exceptions
# If not quiet, let stderr be inherited
stderr = subprocess.PIPE if quiet else None
payload = check_subprocess_output(
metadata_command, stderr=stderr, encoding="latin-1", env=self.env.env
)
payload = run_subprocess(
metadata_command,
env=self.env,
check=True,
stdout=subprocess.PIPE,
stderr=stderr,
encoding="latin-1",
).stdout
except subprocess.CalledProcessError as e:
raise SetupError(format_called_process_error(e))
try:
Expand Down
Loading