Skip to content
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

be more verbose when subprocess fails #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
11 changes: 8 additions & 3 deletions snaek/setuptools_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from distutils.core import Extension
from distutils.command.build_py import build_py
from distutils.command.build_ext import build_ext
from distutils.errors import DistutilsExecError, DistutilsSetupError
from cffi.setuptools_ext import cffi_modules

from ._compat import text_type
Expand Down Expand Up @@ -43,7 +44,6 @@


def error(msg):
from distutils.errors import DistutilsSetupError
raise DistutilsSetupError(msg)


Expand Down Expand Up @@ -126,9 +126,14 @@ def build_rustlib(module_def, base_path):
cmdline = ['cargo', 'build', '--release']
if not sys.stdout.isatty():
cmdline.append('--color=always')
rv = subprocess.Popen(cmdline, cwd=module_def.crate_path).wait()
try:
rv = subprocess.call(cmdline, cwd=module_def.crate_path)
except OSError as e:
raise DistutilsExecError("unable to execute %r: %s" %
(cmdline[0], e.strerror))
if rv != 0:
sys.exit(rv)
raise DistutilsExecError("command %r failed with exit status %d" %
(cmdline[0], rv))

src_path = os.path.join(module_def.crate_path, 'target', 'release')
for filename in os.listdir(src_path):
Expand Down