From fa17f42d7d195dab77c042ac4881ac63bfb638f3 Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Mon, 17 Mar 2014 09:46:58 +1300 Subject: Allow examining parsing exceptions. Having to put breakpoints in pbr to diagnose issues is bad for dealing with reports from users. Change-Id: Ifecf4c4e4bb5955e0e5feb4bf5b5b85150b08ebe --- pbr/core.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pbr/core.py b/pbr/core.py index 0aff652..0f4b94a 100644 --- a/pbr/core.py +++ b/pbr/core.py @@ -40,6 +40,7 @@ from distutils import core from distutils import errors +import logging import os import sys import warnings @@ -103,6 +104,10 @@ def pbr(dist, attr, value): attrs = util.cfg_to_args(path) except Exception: e = sys.exc_info()[1] + # NB: This will output to the console if no explicit logging has + # been setup - but thats fine, this is a fatal distutils error, so + # being pretty isn't the #1 goal.. being diagnosable is. + logging.exception('Error parsing') raise errors.DistutilsSetupError( 'Error parsing %s: %s: %s' % (path, e.__class__.__name__, e)) -- cgit v1.2.1