From 70e08ed40f32875fc1389a39c2ee0628ffecdf1e Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Mon, 8 Jan 2018 02:47:36 +0100 Subject: [PATCH 1/3] [fix] pkg is None, can't continue loop --- src/yunohost/utils/packages.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/yunohost/utils/packages.py b/src/yunohost/utils/packages.py index 9242d22d1..bc822da1f 100644 --- a/src/yunohost/utils/packages.py +++ b/src/yunohost/utils/packages.py @@ -414,6 +414,8 @@ def get_installed_version(*pkgnames, **kwargs): if strict: raise UnknownPackage(pkgname) logger.warning(m18n.n('package_unknown', pkgname=pkgname)) + continue + try: version = pkg.installed.version except AttributeError: From e0edbeca357f7aecae159a1e7c71aef006d9462d Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Mon, 8 Jan 2018 03:10:16 +0100 Subject: [PATCH 2/3] [enh] --version now display stable/testing/unstable information --- src/yunohost/utils/packages.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/yunohost/utils/packages.py b/src/yunohost/utils/packages.py index bc822da1f..18c4f2a3d 100644 --- a/src/yunohost/utils/packages.py +++ b/src/yunohost/utils/packages.py @@ -422,7 +422,21 @@ def get_installed_version(*pkgnames, **kwargs): if strict: raise UninstalledPackage(pkgname) version = None - versions[pkgname] = version + + try: + # stable, testing, unstable + repo = pkg.installed.origins[0].component + except AttributeError: + if strict: + raise UninstalledPackage(pkgname) + repo = "" + + versions[pkgname] = { + "version": version, + # when we don't have component it's because it's from a local + # install or from an image (like in vagrant) + "repo": repo if repo else "local", + } if len(pkgnames) == 1 and not as_dict: return versions[pkgnames[0]] @@ -438,6 +452,9 @@ def meets_version_specifier(pkgname, specifier): # YunoHost related methods --------------------------------------------------- def ynh_packages_version(*args, **kwargs): + # from cli the received arguments are: + # (Namespace(_callbacks=deque([]), _tid='_global', _to_return={}), []) {} + # they don't seems to serve any purpose """Return the version of each YunoHost package""" return get_installed_version( 'yunohost', 'yunohost-admin', 'moulinette', 'ssowat', From 4f679367eb8905aee52a76dcefac4a2190a9a382 Mon Sep 17 00:00:00 2001 From: JimboJoe Date: Tue, 9 Jan 2018 20:30:43 +0100 Subject: [PATCH 3/3] Typo --- src/yunohost/utils/packages.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/yunohost/utils/packages.py b/src/yunohost/utils/packages.py index 18c4f2a3d..7df311406 100644 --- a/src/yunohost/utils/packages.py +++ b/src/yunohost/utils/packages.py @@ -454,7 +454,7 @@ def meets_version_specifier(pkgname, specifier): def ynh_packages_version(*args, **kwargs): # from cli the received arguments are: # (Namespace(_callbacks=deque([]), _tid='_global', _to_return={}), []) {} - # they don't seems to serve any purpose + # they don't seem to serve any purpose """Return the version of each YunoHost package""" return get_installed_version( 'yunohost', 'yunohost-admin', 'moulinette', 'ssowat',