public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Devan Franchini" <twitch153@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/webapp-config:experimental commit in: WebappConfig/
Date: Sat, 16 May 2015 02:16:40 +0000 (UTC)	[thread overview]
Message-ID: <1431742257.ff6001dfb23b82ae9c24a571f5ad1346f2b19210.twitch153@gentoo> (raw)

commit:     ff6001dfb23b82ae9c24a571f5ad1346f2b19210
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sat May 16 02:10:54 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sat May 16 02:10:57 2015 +0000
URL:        https://gitweb.gentoo.org/proj/webapp-config.git/commit/?id=ff6001df

{config, db}.py: Adds proper support for list-installs command

The webapp-config man page says that the --list-installs flag
can be the package name, and/or version, or "*". So changes
needed to be made to allow for this functionality.

 WebappConfig/config.py | 43 +++++++++++++++++++++++++++----------------
 WebappConfig/db.py     |  2 +-
 2 files changed, 28 insertions(+), 17 deletions(-)

diff --git a/WebappConfig/config.py b/WebappConfig/config.py
index c87b93b..2c14baa 100644
--- a/WebappConfig/config.py
+++ b/WebappConfig/config.py
@@ -579,7 +579,7 @@ class Config:
 
         info_opts.add_argument('-li',
                                '--list-installs',
-                               nargs = 2,
+                               nargs = '*',
                                help = 'List all current virtual installs for <a'
                                'pplication>. Use * for the package name and/or '
                                'version number to list more than one package / '
@@ -972,32 +972,43 @@ class Config:
 
         OUT.debug('Checking command line arguments', 1)
 
-        if self.work in ['install', 'clean', 'query', 'show_postinst',
-                         'show_postupgrade', 'upgrade']:
+        if self.work in ['install', 'clean', 'query', 'list_installs',
+                         'show_postinst', 'show_postupgrade', 'upgrade']:
             # get cat / pn
             args = options[self.work]
+            m    = args[0].split('/')
+
+            if self.work == 'list_installs' and len(args) > 2:
+                msg = os.path.basename(sys.argv[0]) + ': error: argument -li/'\
+                      '--list-installs: expected up to 2 arguments'
 
-            m = args[0].split('/')
+                self.parser.print_usage()
+                print(msg)
+                sys.exit()
 
             if len(m) == 1:
-                self.config.set('USER', 'pn',  m[0])
+                if '*' not in m:
+                    self.config.set('USER', 'pn',  m[0])
             elif len(m) == 2:
                 self.config.set('USER', 'cat', m[0])
-                self.config.set('USER', 'pn',  m[1])
+                if '*' not in m:
+                    self.config.set('USER', 'pn',  m[1])
             else:
                 OUT.die('Invalid package name')
 
-            argsvr = args[1].split('.')
-            if len(argsvr) == 1:
-                OUT.die('Invalid package version: %(pvr)s' % {'pvr': args[1]})
+            if len(args) > 1:
+                argsvr = args[1].split('.')
+                if len(argsvr) == 1:
+                    OUT.die('Invalid package version: %(pvr)s' % {'pvr': args[1]})
+
+                pvr = ''
+                for i in range(0, len(argsvr)):
+                    if not i == len(argsvr) - 1:
+                        pvr += argsvr[i] + '.'
+                    else:
+                        pvr += argsvr[i]
+                self.config.set('USER', 'pvr', pvr)
 
-            pvr = ''
-            for i in range(0, len(argsvr)):
-                if not i == len(argsvr) - 1:
-                    pvr += argsvr[i] + '.'
-                else:
-                    pvr += argsvr[i]
-            self.config.set('USER', 'pvr', pvr)
 
     # --------------------------------------------------------------------
     # Helper functions

diff --git a/WebappConfig/db.py b/WebappConfig/db.py
index 0fbd34a..06d9e04 100644
--- a/WebappConfig/db.py
+++ b/WebappConfig/db.py
@@ -403,7 +403,7 @@ class WebappDB(AppHierarchy):
                     OUT.info('  ' + i[3].strip(), 1)
                 else:
                     # This is a simplified form for the webapp.eclass
-                    print(i[3].strip())
+                    OUT.info(i[3].strip(), 1)
 
 # ========================================================================
 # Handler for /usr/share/webapps


             reply	other threads:[~2015-05-16  2:16 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-16  2:16 Devan Franchini [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-06-19 19:19 [gentoo-commits] proj/webapp-config:experimental commit in: WebappConfig/ Devan Franchini
2015-06-19 19:19 Devan Franchini
2015-06-19 19:19 Devan Franchini
2015-06-19 19:19 Devan Franchini
2015-06-19 19:19 Devan Franchini
2015-06-19 19:19 Devan Franchini
2015-06-19 19:19 Devan Franchini
2015-06-19 19:19 Devan Franchini
2015-06-19 19:19 Devan Franchini
2015-06-19 19:19 Devan Franchini
2015-06-19 19:19 Devan Franchini
2015-06-19 19:19 Devan Franchini
2015-06-19 19:19 Devan Franchini
2015-05-17  3:54 Devan Franchini
2015-05-17  3:44 Devan Franchini
2015-05-17  3:19 Devan Franchini
2015-05-17  2:51 Devan Franchini
2015-05-17  2:42 Devan Franchini
2015-05-17  2:28 Devan Franchini
2015-05-17  0:38 Devan Franchini
2014-11-18  0:03 Devan Franchini
2014-11-17 23:58 Devan Franchini
2014-11-17 23:42 Devan Franchini
2014-11-14  1:14 Devan Franchini
2014-10-16 19:18 Devan Franchini
2014-10-15 13:27 Devan Franchini
2014-10-15 13:27 Devan Franchini
2014-10-15 13:27 Devan Franchini
2014-10-14 19:13 Devan Franchini
2014-10-14 17:14 Devan Franchini
2014-10-09 18:02 Devan Franchini
2014-10-09 17:58 Devan Franchini
2014-10-09 17:52 Devan Franchini
2014-09-23 17:09 Devan Franchini
2014-04-26 19:33 Devan Franchini
2014-01-24 21:45 Devan Franchini
2014-01-22 15:32 Devan Franchini
2014-01-08  4:03 Devan Franchini
2014-01-04  1:40 Devan Franchini
2014-01-04  1:13 Devan Franchini
2013-12-19  6:34 Devan Franchini
2013-12-10  1:34 Devan Franchini
2013-12-09  8:31 Devan Franchini
2013-12-01  8:50 Devan Franchini
2013-12-01  8:44 Devan Franchini
2013-11-05 22:17 Devan Franchini
2013-11-05 22:17 Devan Franchini
2013-10-29  2:18 Devan Franchini
2013-10-27 19:27 Devan Franchini
2013-10-27  2:26 Devan Franchini
2013-10-19  3:34 Devan Franchini
2013-10-18  3:39 Devan Franchini
2013-10-10  3:46 Devan Franchini
2013-10-10  3:41 Devan Franchini
2013-10-10  3:36 Devan Franchini
2013-10-10  2:00 Devan Franchini
2013-09-23  3:51 Devan Franchini
2013-09-23  1:13 Devan Franchini
2013-09-23  1:06 Devan Franchini
2013-09-23  0:19 Devan Franchini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1431742257.ff6001dfb23b82ae9c24a571f5ad1346f2b19210.twitch153@gentoo \
    --to=twitch153@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox