[master][PATCH] Raise exception if our module fails to be imported

Samantha N. Bueno sbueno+anaconda at redhat.com
Mon Apr 22 13:54:40 UTC 2013


Ack.

On Mon, Apr 22, 2013 at 01:37:27PM +0200, Vratislav Podzimek wrote:
> If an addon or something like that fails to be imported we may want to just log
> an error, but if an import of our own module fails it is a bug.
> 
> Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
> ---
>  pyanaconda/ui/common.py | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/pyanaconda/ui/common.py b/pyanaconda/ui/common.py
> index 2bae250..bc1009e 100644
> --- a/pyanaconda/ui/common.py
> +++ b/pyanaconda/ui/common.py
> @@ -567,8 +567,11 @@ def collect(module_pattern, path, pred):
>              # skip the file as well
>              if not module_flags[0].startswith(".py") and loaded_ext.startswith(".py"):
>                  continue
> -            
> +
>          except ImportError as imperr:
> +            if "pyanaconda" in module_path:
> +                # failure when importing our own module:
> +                raise
>              log.error("Failed to import module in collect: %s" % imperr)
>              continue
>          finally:
> -- 
> 1.7.11.7
> 
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches


More information about the anaconda-patches mailing list