Merge "tox: include command output in log/error"
This commit is contained in:
commit
dab423acaf
@ -96,7 +96,8 @@ def get_sibling_python_packages(projects, tox_python):
|
|||||||
# package name is.
|
# package name is.
|
||||||
package_name = subprocess.check_output(
|
package_name = subprocess.check_output(
|
||||||
[os.path.abspath(tox_python), 'setup.py', '--name'],
|
[os.path.abspath(tox_python), 'setup.py', '--name'],
|
||||||
cwd=os.path.abspath(root)).decode('utf-8')
|
cwd=os.path.abspath(root),
|
||||||
|
stderr=subprocess.STDOUT).decode('utf-8')
|
||||||
if package_name:
|
if package_name:
|
||||||
package_name = package_name.strip()
|
package_name = package_name.strip()
|
||||||
packages[package_name] = root
|
packages[package_name] = root
|
||||||
@ -111,7 +112,8 @@ def get_installed_packages(tox_python):
|
|||||||
# We use the output of pip freeze here as that is pip's stable public
|
# We use the output of pip freeze here as that is pip's stable public
|
||||||
# interface.
|
# interface.
|
||||||
frozen_pkgs = subprocess.check_output(
|
frozen_pkgs = subprocess.check_output(
|
||||||
[tox_python, '-m', 'pip', '-qqq', 'freeze']
|
[tox_python, '-m', 'pip', '-qqq', 'freeze'],
|
||||||
|
stderr=subprocess.STDOUT
|
||||||
).decode('utf-8')
|
).decode('utf-8')
|
||||||
# Matches strings of the form:
|
# Matches strings of the form:
|
||||||
# 1. '<package_name>==<version>'
|
# 1. '<package_name>==<version>'
|
||||||
@ -330,6 +332,13 @@ def main():
|
|||||||
projects,
|
projects,
|
||||||
package_name,
|
package_name,
|
||||||
constraints)
|
constraints)
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
tb = traceback.format_exc()
|
||||||
|
log.append(str(e))
|
||||||
|
log.append(tb)
|
||||||
|
log.append("Output:")
|
||||||
|
log.extend(e.output.decode('utf-8').split('\n'))
|
||||||
|
module.fail_json(msg=str(e), log="\n".join(log))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
tb = traceback.format_exc()
|
tb = traceback.format_exc()
|
||||||
log.append(str(e))
|
log.append(str(e))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user