[Merge] lp:~rbalint/update-manager/lp-1795898-lp-1790670-cosmic into lp:update-manager

Brian Murray brian at ubuntu.com
Wed Oct 3 21:41:55 UTC 2018


I've just a couple of minor in-line comments, otherwise this looks good to me.

Diff comments:

> 
> === modified file 'UpdateManager/backend/__init__.py'
> --- UpdateManager/backend/__init__.py	2018-10-01 15:56:40 +0000
> +++ UpdateManager/backend/__init__.py	2018-10-03 21:05:47 +0000
> @@ -94,6 +94,24 @@
>                  is_cancelled_update = not success
>                  self.window_main.start_available(is_cancelled_update)
>  
> +# try aptdaemon
> +if (os.path.exists("/usr/sbin/aptd")
> +    and "UPDATE_MANAGER_FORCE_BACKEND_SYNAPTIC" not in os.environ):
> +    # check if the gtkwidgets are installed as well
> +    try:
> +        from .InstallBackendAptdaemon import InstallBackendAptdaemon
> +    except ImportError:
> +        import logging
> +        logging.exception("importing aptdaemon")
> +# try synaptic
> +if os.path.exists("/usr/sbin/synaptic") \
> +   and "UPDATE_MANAGER_FORCE_BACKEND_APTDAEMON" not in os.environ:

Could use parens, round braces, for this if statement as you did with aptdaemon?

> +    try:
> +        from .InstallBackendSynaptic import InstallBackendSynaptic
> +    except ImportError:
> +        import logging
> +        logging.exception("importing synaptic")
> +
>  
>  def get_backend(*args, **kwargs):
>      """Select and return a package manager backend."""
> @@ -102,16 +120,17 @@
>              and "UPDATE_MANAGER_FORCE_BACKEND_SYNAPTIC" not in os.environ):
>          # check if the gtkwidgets are installed as well
>          try:
> -            from .InstallBackendAptdaemon import InstallBackendAptdaemon
>              return InstallBackendAptdaemon(*args, **kwargs)
> -        except ImportError:
> +        except NameError:
>              import logging
> -            logging.exception("importing aptdaemon")
> +            logging.exception("using aptdaemon failed")
>      # try synaptic
>      if (os.path.exists("/usr/sbin/synaptic")
>              and "UPDATE_MANAGER_FORCE_BACKEND_APTDAEMON" not in os.environ):
> -        from .InstallBackendSynaptic import InstallBackendSynaptic
> -        return InstallBackendSynaptic(*args, **kwargs)
> +        try:
> +            return InstallBackendSynaptic(*args, **kwargs)
> +        except NameError:
> +            pass
>      # nothing found, raise
>      raise Exception("No working backend found, please try installing "
>                      "synaptic or aptdaemon")

Since aptdaemon is preferred could we put that first in the error message?



-- 
https://code.launchpad.net/~rbalint/update-manager/lp-1795898-lp-1790670-cosmic/+merge/356105
Your team Ubuntu Core Development Team is requested to review the proposed merge of lp:~rbalint/update-manager/lp-1795898-lp-1790670-cosmic into lp:update-manager.



More information about the Ubuntu-reviews mailing list