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

Ignore messages on STDERR unless there is a non-zero return code #176

Merged
merged 2 commits into from
Aug 17, 2021
Merged
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
3 changes: 3 additions & 0 deletions doc/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ Change Log
------------------

* Optionally compute the MW dust transmission in the WISE bands (PR `#175`_).
* Do not treat messages printed on STDERR as errors during :command:`desiInstall` (PR `#176`_).

.. _`#175`: https://github.com/desihub/desiutil/pull/175
.. _`#176`: https://github.com/desihub/desiutil/pull/176


3.2.2 (2021-06-03)
------------------
Expand Down
44 changes: 18 additions & 26 deletions py/desiutil/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -833,24 +833,16 @@ def install(self):
self.log.debug(out)
if len(err) > 0:
#
# Some warnings can be produced by processing
# MANIFEST.in and not finding directories. These
# can be ignored.
# Pass STDERR messages to the user, but do not
# raise an error unless the return code was non-zero.
#
manifestre = re.compile(r"(warning: |)no" +
r"( previously-included | )" +
r"(directories|files)", re.I)
# manifestre = re.compile(r"no( previously-included| )" +
# r"( directories| files)" +
# r"( found| ) " +
# r"matching '[^']+'")
lines = [l for l in err.split('\n') if len(l) > 0 and
manifestre.search(l) is None and
'astropy_helpers' not in l and
'astropy-helpers' not in l]
if len(lines) > 0:
message = ("Error during installation: " +
"{0}".format("\n".join(lines)))
if proc.returncode == 0:
message = ("Pip emitted messages on STDERR; these can probably be ignored:\n" +
err)
self.log.warning(message)
else:
message = ("Potentially serious error detected during pip installation:\n" +
err)
self.log.critical(message)
raise DesiInstallException(message)
#
Expand All @@ -877,16 +869,16 @@ def install(self):
self.log.debug(out)
if len(err) > 0:
#
# specex emits warnings that should be ignored.
# lines with -Wunused-value are emitted on all systems
# lines with remark: are emitted on cori
# Pass STDERR messages to the user, but do not
# raise an error unless the return code was non-zero.
#
lines = [l for l in err.split('\n') if len(l) > 0 and
'-Wunused-value' not in l and
'remark:' not in l]
if len(lines) > 0:
message = ("Error during compile: " +
"{0}").format("\n".join(lines))
if proc.returncode == 0:
message = ("Make emitted messages on STDERR; these can probably be ignored:\n" +
err)
self.log.warning(message)
else:
message = ("Potentially serious error detected during compile:\n" +
err)
self.log.critical(message)
raise DesiInstallException(message)
return
Expand Down