public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Jauhien Piatlicki" <piatlicki@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/g-sorcery:master commit in: gs_db_tool/
Date: Wed,  4 Sep 2013 18:03:39 +0000 (UTC)	[thread overview]
Message-ID: <1378305341.28e010cc203fb9415d9d88677681ff03f8be5072.jauhien@gentoo> (raw)

commit:     28e010cc203fb9415d9d88677681ff03f8be5072
Author:     Jauhien Piatlicki (jauhien) <piatlicki <AT> gmail <DOT> com>
AuthorDate: Wed Sep  4 14:35:41 2013 +0000
Commit:     Jauhien Piatlicki <piatlicki <AT> gmail <DOT> com>
CommitDate: Wed Sep  4 14:35:41 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/g-sorcery.git;a=commit;h=28e010cc

gs_db_tool/gs_db_tool: for_all added

---
 gs_db_tool/gs_db_tool.py | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/gs_db_tool/gs_db_tool.py b/gs_db_tool/gs_db_tool.py
index 94d8a14..5594a12 100644
--- a/gs_db_tool/gs_db_tool.py
+++ b/gs_db_tool/gs_db_tool.py
@@ -40,6 +40,10 @@ def main():
     p_ebuild_data_show_all = p_ebuild_data_subparsers.add_parser('show_all')
     p_ebuild_data_show_all.set_defaults(func=show_all)
 
+    p_ebuild_data_for_all = p_ebuild_data_subparsers.add_parser('for_all')
+    p_ebuild_data_for_all.add_argument('function')
+    p_ebuild_data_for_all.set_defaults(func=for_all)
+
     p_sync = subparsers.add_parser('sync')
     p_sync.set_defaults(func=sync)
     p_sync.add_argument('uri')
@@ -57,6 +61,19 @@ def transform_db(function):
     return transformator
 
 
+def read_db(function):
+    def reader(pkg_db, args):
+        pkg_db.read()
+        function(pkg_db, args)
+    return reader
+
+
+@read_db
+def for_all(pkg_db, args):
+    for package, ebuild_data in pkg_db:
+        exec(args.function)
+
+
 @transform_db
 def add_var(pkg_db, args):
     if args.function:
@@ -79,8 +96,8 @@ def add_var(pkg_db, args):
             pkg_db.add_package(package, ebuild_data)
 
 
+@read_db
 def show_all(pkg_db, args):
-    pkg_db.read()
     for package, ebuild_data in pkg_db:
         print(package)
         print('-' * len(str(package)))


             reply	other threads:[~2013-09-04 18:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-04 18:03 Jauhien Piatlicki [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-09-05 16:33 [gentoo-commits] proj/g-sorcery:master commit in: gs_db_tool/ Jauhien Piatlicki
2013-08-29 21:30 Jauhien Piatlicki

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=1378305341.28e010cc203fb9415d9d88677681ff03f8be5072.jauhien@gentoo \
    --to=piatlicki@gmail.com \
    --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