public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/metagen:master commit in: metagen/
@ 2011-08-13 22:08 Jesus Rivero
  0 siblings, 0 replies; 23+ messages in thread
From: Jesus Rivero @ 2011-08-13 22:08 UTC (permalink / raw
  To: gentoo-commits

commit:     ddf1d9bb078a010915d576fb1ce50024c836fa2d
Author:     Jesus Rivero (Neurogeek) <jer <AT> acla-overseas <DOT> com>
AuthorDate: Sat Aug 13 18:06:30 2011 +0000
Commit:     Jesus Rivero <neurogeek <AT> gentoo <DOT> org>
CommitDate: Sat Aug 13 18:06:30 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/metagen.git;a=commit;h=ddf1d9bb

Added checks for HERD existance

---
 metagen/main.py |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/metagen/main.py b/metagen/main.py
index 06f0239..22abbd5 100755
--- a/metagen/main.py
+++ b/metagen/main.py
@@ -1,31 +1,31 @@
 #!/usr/bin/python
 
-
 """
 
 NAME     - metagen
-
 SYNOPSIS - Adds metadata.xml to current directory
-
-AUTHOR   - Rob Cakebread <pythonhead@gentoo.org>
-
+AUTHOR   - Rob Cakebread <cakebread@gmail.com>
+AUTHOR   - Jesus Rivero <neurogeek@gentoo.org>
 USE      - metagen --help
-
 EXAMPLES - man metagen
 
 """
 
-import sys
 import re
 import os
+import sys
 from optparse import OptionParser
 from commands import getstatusoutput
 
+from portage import config
+from repoman import herdbase
 from portage.output import red, blue
 
 from metagen.version import __version__
 from metagen import metagenerator
 
+PORTDIR = config(local_config=False)["PORTDIR"]
+HB = herdbase.make_herd_base(os.path.sep.join([PORTDIR, 'metadata', 'herds.xml']))
 
 def parse_echangelog_variable(name, email):
     """Extract developer name and email from ECHANGELOG_USER variable"""
@@ -64,6 +64,12 @@ def generate_xml(options):
         herds = options.herd.split(",")
     else:
         herds = ["no-herd"]
+
+    for herd in herds:
+        if not HB.known_herd(herd):
+            print red("!!! Error. Herd %s does not exist." % herd)
+            sys.exit(1) 
+            
     metadata.set_herd(herds)
 
     if options.echangelog:



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [gentoo-commits] proj/metagen:master commit in: metagen/
@ 2011-09-09 13:16 Jesus Rivero
  0 siblings, 0 replies; 23+ messages in thread
From: Jesus Rivero @ 2011-09-09 13:16 UTC (permalink / raw
  To: gentoo-commits

commit:     4b7238c6f5c70e2b1db43a499363107a5cafc18e
Author:     Jesus Rivero (Neurogeek) <jer <AT> acla-overseas <DOT> com>
AuthorDate: Fri Sep  9 09:12:48 2011 +0000
Commit:     Jesus Rivero <neurogeek <AT> gentoo <DOT> org>
CommitDate: Fri Sep  9 09:12:48 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/metagen.git;a=commit;h=4b7238c6

Version change for the inminent release of 0.6

---
 metagen/version.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/metagen/version.py b/metagen/version.py
index 7f40384..743d158 100644
--- a/metagen/version.py
+++ b/metagen/version.py
@@ -1 +1 @@
-__version__="0.5.2"
+__version__="0.6"



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [gentoo-commits] proj/metagen:master commit in: metagen/
@ 2011-09-09 13:42 Jesus Rivero
  0 siblings, 0 replies; 23+ messages in thread
From: Jesus Rivero @ 2011-09-09 13:42 UTC (permalink / raw
  To: gentoo-commits

commit:     72dcc70b58cfbe705696fefeb3e3a2f6dc309d20
Author:     Jesus Rivero (Neurogeek) <jer <AT> acla-overseas <DOT> com>
AuthorDate: Fri Sep  9 09:39:23 2011 +0000
Commit:     Jesus Rivero <neurogeek <AT> gentoo <DOT> org>
CommitDate: Fri Sep  9 09:39:23 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/metagen.git;a=commit;h=72dcc70b

Fixed some failing tests

---
 metagen/meta_unittest.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/metagen/meta_unittest.py b/metagen/meta_unittest.py
index 06208a6..2e6440a 100644
--- a/metagen/meta_unittest.py
+++ b/metagen/meta_unittest.py
@@ -6,13 +6,13 @@ from metagenerator import MyMetadata
 def test1():
     """1 herd specified"""
     metadata = MyMetadata()
-    metadata.set_herd(("python"))
+    metadata.set_herd(["python"])
     return metadata 
  
 def test2():
     """No herd specified, 1 maintainer"""
     metadata = MyMetadata()
-    metadata.set_herd([""])
+    metadata.set_herd()
     metadata.set_maintainer(["<pythonhead@gentoo.org>"], 
                             ["Rob Cakebread"], 
                             ["Maintainer description."]



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [gentoo-commits] proj/metagen:master commit in: metagen/
@ 2011-09-25 14:04 Jesus Rivero
  0 siblings, 0 replies; 23+ messages in thread
From: Jesus Rivero @ 2011-09-25 14:04 UTC (permalink / raw
  To: gentoo-commits

commit:     6da27c26ecd3534a2eac3a1dbeb776b91cf6dd4e
Author:     Jesus Rivero <neurogeek <AT> gentoo <DOT> org>
AuthorDate: Fri Sep  9 09:12:48 2011 +0000
Commit:     Jesus Rivero <neurogeek <AT> gentoo <DOT> org>
CommitDate: Fri Sep  9 09:12:48 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/metagen.git;a=commit;h=6da27c26

Version change for the inminent release of 0.6

---
 metagen/version.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/metagen/version.py b/metagen/version.py
index 7f40384..743d158 100644
--- a/metagen/version.py
+++ b/metagen/version.py
@@ -1 +1 @@
-__version__="0.5.2"
+__version__="0.6"



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [gentoo-commits] proj/metagen:master commit in: metagen/
@ 2011-09-25 14:04 Jesus Rivero
  0 siblings, 0 replies; 23+ messages in thread
From: Jesus Rivero @ 2011-09-25 14:04 UTC (permalink / raw
  To: gentoo-commits

commit:     e12d9d99dd921803e5c1f7afd9d1132d3ee472ac
Author:     Jesus Rivero <neurogeek <AT> gentoo <DOT> org>
AuthorDate: Fri Sep  9 09:39:23 2011 +0000
Commit:     Jesus Rivero <neurogeek <AT> gentoo <DOT> org>
CommitDate: Fri Sep  9 09:39:23 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/metagen.git;a=commit;h=e12d9d99

Fixed some failing tests

---
 metagen/meta_unittest.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/metagen/meta_unittest.py b/metagen/meta_unittest.py
index 06208a6..2e6440a 100644
--- a/metagen/meta_unittest.py
+++ b/metagen/meta_unittest.py
@@ -6,13 +6,13 @@ from metagenerator import MyMetadata
 def test1():
     """1 herd specified"""
     metadata = MyMetadata()
-    metadata.set_herd(("python"))
+    metadata.set_herd(["python"])
     return metadata 
  
 def test2():
     """No herd specified, 1 maintainer"""
     metadata = MyMetadata()
-    metadata.set_herd([""])
+    metadata.set_herd()
     metadata.set_maintainer(["<pythonhead@gentoo.org>"], 
                             ["Rob Cakebread"], 
                             ["Maintainer description."]



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [gentoo-commits] proj/metagen:master commit in: metagen/
@ 2011-09-25 14:04 Jesus Rivero
  0 siblings, 0 replies; 23+ messages in thread
From: Jesus Rivero @ 2011-09-25 14:04 UTC (permalink / raw
  To: gentoo-commits

commit:     a61a2f518af0ae586be95ddf21a6c0d6ac6e6dcb
Author:     Jesus Rivero <neurogeek <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 13 18:06:30 2011 +0000
Commit:     Jesus Rivero <neurogeek <AT> gentoo <DOT> org>
CommitDate: Sat Aug 13 18:06:30 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/metagen.git;a=commit;h=a61a2f51

Added checks for HERD existance

---
 metagen/main.py |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/metagen/main.py b/metagen/main.py
index 06f0239..22abbd5 100755
--- a/metagen/main.py
+++ b/metagen/main.py
@@ -1,31 +1,31 @@
 #!/usr/bin/python
 
-
 """
 
 NAME     - metagen
-
 SYNOPSIS - Adds metadata.xml to current directory
-
-AUTHOR   - Rob Cakebread <pythonhead@gentoo.org>
-
+AUTHOR   - Rob Cakebread <cakebread@gmail.com>
+AUTHOR   - Jesus Rivero <neurogeek@gentoo.org>
 USE      - metagen --help
-
 EXAMPLES - man metagen
 
 """
 
-import sys
 import re
 import os
+import sys
 from optparse import OptionParser
 from commands import getstatusoutput
 
+from portage import config
+from repoman import herdbase
 from portage.output import red, blue
 
 from metagen.version import __version__
 from metagen import metagenerator
 
+PORTDIR = config(local_config=False)["PORTDIR"]
+HB = herdbase.make_herd_base(os.path.sep.join([PORTDIR, 'metadata', 'herds.xml']))
 
 def parse_echangelog_variable(name, email):
     """Extract developer name and email from ECHANGELOG_USER variable"""
@@ -64,6 +64,12 @@ def generate_xml(options):
         herds = options.herd.split(",")
     else:
         herds = ["no-herd"]
+
+    for herd in herds:
+        if not HB.known_herd(herd):
+            print red("!!! Error. Herd %s does not exist." % herd)
+            sys.exit(1) 
+            
     metadata.set_herd(herds)
 
     if options.echangelog:



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [gentoo-commits] proj/metagen:master commit in: metagen/
@ 2011-09-28 14:46 Jesus Rivero
  0 siblings, 0 replies; 23+ messages in thread
From: Jesus Rivero @ 2011-09-28 14:46 UTC (permalink / raw
  To: gentoo-commits

commit:     afb0f03400b82effd5699d3202ac389f9cc42156
Author:     Jesus Rivero <neurogeek <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 28 10:44:10 2011 +0000
Commit:     Jesus Rivero <neurogeek <AT> gentoo <DOT> org>
CommitDate: Wed Sep 28 10:44:10 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/metagen.git;a=commit;h=afb0f034

Fixed bug #384535, modified test_cli and upped the version

---
 metagen/main.py    |    1 +
 metagen/test_cli   |   14 +++++++-------
 metagen/version.py |    2 +-
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/metagen/main.py b/metagen/main.py
index 0a996f7..a8e8515 100755
--- a/metagen/main.py
+++ b/metagen/main.py
@@ -58,6 +58,7 @@ def parse_echangelog_variable(name, email):
 def generate_xml(options):
     """Returns metadata.xml text"""
 
+    herds=[]
     metadata = metagenerator.MyMetadata()
 
     if options.herd:

diff --git a/metagen/test_cli b/metagen/test_cli
index 84cf9cf..847ae07 100755
--- a/metagen/test_cli
+++ b/metagen/test_cli
@@ -2,27 +2,27 @@
 
 #Should fail if ECHANGELOG_USER not set:
 echo 'metagen -m -Q'
-./metagen.py -m -Q
+metagen -m -Q
 
 echo 'metagen -e "someguy@gentoo.org" -d "Maint desc" -Q'
-./metagen.py -e "someguy@gentoo.org" -d "Maint desc" -Q
+metagen -e "someguy@gentoo.org" -d "Maint desc" -Q
 
 echo 'metagen -e "someguy@gentoo.org" -n "Jon Doe" -d "Maint desc" -Q'
-./metagen.py -e "someguy@gentoo.org" -n "Jon Doe" -d "Maint desc" -Q
+metagen -e "someguy@gentoo.org" -n "Jon Doe" -d "Maint desc" -Q
 
 #Should fail if ECHANGELOG_USER not set:
 echo 'metagen -m -H python -e "foo@bar.com" -d "Foo bar.","Chow fun" -Q'
-./metagen.py -m -H python -e "foo@bar.com" -d "Foo bar.","Chow fun" -Q
+metagen -m -H python -e "foo@bar.com" -d "Foo bar.","Chow fun" -Q
 
 #Should fail:
 echo 'metagen -Q'
-./metagen.py -Q
+metagen -Q
 
 #Should fail:
 echo 'metagen -l "Long desc" -Q'
-./metagen.py -l "Long desc" -Q
+metagen -l "Long desc" -Q
 
 #Should fail:
 echo 'metagen -d "Maintainer desc" -Q'
-./metagen.py -d "Maintainer desc" -Q
+metagen -d "Maintainer desc" -Q
 

diff --git a/metagen/version.py b/metagen/version.py
index f320129..34954ba 100644
--- a/metagen/version.py
+++ b/metagen/version.py
@@ -1 +1 @@
-__version__="0.6.1"
+__version__="0.6.2"



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [gentoo-commits] proj/metagen:master commit in: metagen/
@ 2015-10-30 15:13 Sebastian Pipping
  0 siblings, 0 replies; 23+ messages in thread
From: Sebastian Pipping @ 2015-10-30 15:13 UTC (permalink / raw
  To: gentoo-commits

commit:     3b82d27c1f7f52fbd2970886c7f1c26c92678d35
Author:     Sebastian Pipping <sebastian <AT> pipping <DOT> org>
AuthorDate: Fri Oct 30 15:11:11 2015 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Fri Oct 30 15:11:11 2015 +0000
URL:        https://gitweb.gentoo.org/proj/metagen.git/commit/?id=3b82d27c

Fix herdbase import for portage >=2.2.22 (bug #561908)

 metagen/main.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/metagen/main.py b/metagen/main.py
index a8e8515..d9aded4 100755
--- a/metagen/main.py
+++ b/metagen/main.py
@@ -18,9 +18,16 @@ from optparse import OptionParser
 from commands import getstatusoutput
 
 from portage import config
-from repoman import herdbase
 from portage.output import red, blue
 
+try:
+    # portage <2.2.22
+    # https://bugs.gentoo.org/show_bug.cgi?id=561908
+    from repoman import herdbase
+except ImportError:
+    # portage >=2.2.22
+    from repoman.checks.herds import herdbase
+
 from metagen.version import __version__
 from metagen import metagenerator
 


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [gentoo-commits] proj/metagen:master commit in: metagen/
@ 2015-10-30 15:13 Sebastian Pipping
  0 siblings, 0 replies; 23+ messages in thread
From: Sebastian Pipping @ 2015-10-30 15:13 UTC (permalink / raw
  To: gentoo-commits

commit:     2ea2f2e1d67c88ade1ed1c8a8c0f8a1ead1746d7
Author:     Sebastian Pipping <sebastian <AT> pipping <DOT> org>
AuthorDate: Fri Oct 30 15:12:17 2015 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Fri Oct 30 15:12:17 2015 +0000
URL:        https://gitweb.gentoo.org/proj/metagen.git/commit/?id=2ea2f2e1

Bump version to 0.6.3

 metagen/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/metagen/version.py b/metagen/version.py
index 34954ba..728a43d 100644
--- a/metagen/version.py
+++ b/metagen/version.py
@@ -1 +1 @@
-__version__="0.6.2"
+__version__="0.6.3"


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [gentoo-commits] proj/metagen:master commit in: metagen/
@ 2016-02-21 22:14 Sebastian Pipping
  0 siblings, 0 replies; 23+ messages in thread
From: Sebastian Pipping @ 2016-02-21 22:14 UTC (permalink / raw
  To: gentoo-commits

commit:     8f51fde869db377563e9554db7bed6288b42a9cc
Author:     Sebastian Pipping <sebastian <AT> pipping <DOT> org>
AuthorDate: Sun Feb 21 19:52:17 2016 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Sun Feb 21 21:53:07 2016 +0000
URL:        https://gitweb.gentoo.org/proj/metagen.git/commit/?id=8f51fde8

Group command line arguments

 metagen/main.py | 33 ++++++++++++++-------------------
 1 file changed, 14 insertions(+), 19 deletions(-)

diff --git a/metagen/main.py b/metagen/main.py
index d243c24..1648f92 100755
--- a/metagen/main.py
+++ b/metagen/main.py
@@ -113,41 +113,36 @@ if __name__ == '__main__':
     parser = ArgumentParser(prog='metagen')
     parser.add_argument('--version', action='version', version='%(prog)s ' + __version__)
 
-    parser.add_argument("-H", action="store", dest="herd",
+    maintainer = parser.add_argument_group(title='maintainer arguments')
+    maintainer.add_argument("-H", action="store", dest="herd",
                          help="Name of herd. If not specified, It will be empty. " +
                          "This requires either the -e or -m option.")
-
-    parser.add_argument("-e", action="store", dest="email",
+    maintainer.add_argument("-e", action="store", dest="email",
                          help="Maintainer's email address")
-
-    parser.add_argument("-n", action="store", dest="name",
+    maintainer.add_argument("-n", action="store", dest="name",
                          help="Maintainer's name")
-
-    parser.add_argument("-m", action="store_true", dest="echangelog",
+    maintainer.add_argument("-m", action="store_true", dest="echangelog",
                          default=False,
                          help="Use name and email address from ECHANGELOG_USER "+
                          "environmental variable. "+
                          "This is a shortcut for -e <email> -n <name>")
-
-    parser.add_argument("-d", action="store", dest="desc",
+    maintainer.add_argument("-d", action="store", dest="desc",
                          help="Description of maintainership")
 
-    parser.add_argument("-l", action="store", dest="long",
+    package = parser.add_argument_group(title='package arguments')
+    package.add_argument("-l", action="store", dest="long",
                          help="Long description of package.")
 
-    parser.add_argument("-o", action="store", dest="output",
+    operation = parser.add_argument_group(title='operation arguments')
+    operation.add_argument("-o", action="store", dest="output",
                          help="Specify location of output file.")
-
-    parser.add_argument("-f", action="store_true", dest="force", default=False,
+    operation.add_argument("-f", action="store_true", dest="force", default=False,
                          help="Force overwrite of existing metadata.")
-
-    parser.add_argument("-v", action="store_true", dest="verbose", default=True,
+    operation.add_argument("-v", action="store_true", dest="verbose", default=True,
                          help="Verbose. Output of file to stdout. (default)")
-
-    parser.add_argument("-q", action="store_false", dest="verbose",
+    operation.add_argument("-q", action="store_false", dest="verbose",
                          help="Squelch output of file to stdout.")
-
-    parser.add_argument("-Q", action="store_true", dest="no_write",
+    operation.add_argument("-Q", action="store_true", dest="no_write",
                          default=False,
                          help="Do not write file to disk.")
 


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [gentoo-commits] proj/metagen:master commit in: metagen/
@ 2016-02-21 22:14 Sebastian Pipping
  0 siblings, 0 replies; 23+ messages in thread
From: Sebastian Pipping @ 2016-02-21 22:14 UTC (permalink / raw
  To: gentoo-commits

commit:     0050b9afd963fddfab4035007770a0c9099fbaa0
Author:     Sebastian Pipping <sebastian <AT> pipping <DOT> org>
AuthorDate: Sun Feb 21 21:32:58 2016 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Sun Feb 21 21:47:53 2016 +0000
URL:        https://gitweb.gentoo.org/proj/metagen.git/commit/?id=0050b9af

Turn test_cli into a bit more of test suite

 metagen/test_cli | 39 +++++++++++++++++++++++++++------------
 1 file changed, 27 insertions(+), 12 deletions(-)

diff --git a/metagen/test_cli b/metagen/test_cli
index 847ae07..d0c9792 100755
--- a/metagen/test_cli
+++ b/metagen/test_cli
@@ -1,28 +1,43 @@
 #!/bin/bash
+handle_error() {
+    ret=$?
+    echo FAILED. >&2
+    exit ${ret}
+}
+trap handle_error ERR
+
+unset ECHANGELOG_USER
+PS4='# '
+set -x
+########################################
+# BEGIN tests
+########################################
+
 
 #Should fail if ECHANGELOG_USER not set:
-echo 'metagen -m -Q'
-metagen -m -Q
+ECHANGELOG_USER='First Last <mail@example.org>' metagen -m -Q
+! metagen -m -Q
 
-echo 'metagen -e "someguy@gentoo.org" -d "Maint desc" -Q'
 metagen -e "someguy@gentoo.org" -d "Maint desc" -Q
 
-echo 'metagen -e "someguy@gentoo.org" -n "Jon Doe" -d "Maint desc" -Q'
 metagen -e "someguy@gentoo.org" -n "Jon Doe" -d "Maint desc" -Q
 
 #Should fail if ECHANGELOG_USER not set:
-echo 'metagen -m -H python -e "foo@bar.com" -d "Foo bar.","Chow fun" -Q'
-metagen -m -H python -e "foo@bar.com" -d "Foo bar.","Chow fun" -Q
+ECHANGELOG_USER='First Last <mail@example.org>' metagen -m -H python -e "foo@bar.com" -d "Foo bar.","Chow fun" -Q
+! metagen -m -H python -e "foo@bar.com" -d "Foo bar.","Chow fun" -Q
 
 #Should fail:
-echo 'metagen -Q'
-metagen -Q
+! metagen -Q
 
 #Should fail:
-echo 'metagen -l "Long desc" -Q'
-metagen -l "Long desc" -Q
+! metagen -l "Long desc" -Q
 
 #Should fail:
-echo 'metagen -d "Maintainer desc" -Q'
-metagen -d "Maintainer desc" -Q
+! metagen -d "Maintainer desc" -Q
+
 
+########################################
+# END tests
+########################################
+echo
+echo PASSED.


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [gentoo-commits] proj/metagen:master commit in: metagen/
@ 2016-02-21 22:14 Sebastian Pipping
  0 siblings, 0 replies; 23+ messages in thread
From: Sebastian Pipping @ 2016-02-21 22:14 UTC (permalink / raw
  To: gentoo-commits

commit:     b2608987bf726600397a455638464cffd6af47a7
Author:     Sebastian Pipping <sebastian <AT> pipping <DOT> org>
AuthorDate: Sun Feb 21 19:36:19 2016 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Sun Feb 21 21:49:14 2016 +0000
URL:        https://gitweb.gentoo.org/proj/metagen.git/commit/?id=b2608987

Minimal migration to argparse

 metagen/main.py | 34 ++++++++++++++++------------------
 1 file changed, 16 insertions(+), 18 deletions(-)

diff --git a/metagen/main.py b/metagen/main.py
index d9aded4..d243c24 100755
--- a/metagen/main.py
+++ b/metagen/main.py
@@ -14,7 +14,7 @@ EXAMPLES - man metagen
 import re
 import os
 import sys
-from optparse import OptionParser
+from argparse import ArgumentParser
 from commands import getstatusoutput
 
 from portage import config
@@ -110,50 +110,48 @@ def validate_xml(my_xml):
 
 
 if __name__ == '__main__':
-    optParser = OptionParser(version=__version__)
-    optParser.add_option("-H", action="store", dest="herd", type="string",
+    parser = ArgumentParser(prog='metagen')
+    parser.add_argument('--version', action='version', version='%(prog)s ' + __version__)
+
+    parser.add_argument("-H", action="store", dest="herd",
                          help="Name of herd. If not specified, It will be empty. " +
                          "This requires either the -e or -m option.")
 
-    optParser.add_option("-e", action="store", dest="email", type="string",
+    parser.add_argument("-e", action="store", dest="email",
                          help="Maintainer's email address")
 
-    optParser.add_option("-n", action="store", dest="name", type="string",
+    parser.add_argument("-n", action="store", dest="name",
                          help="Maintainer's name")
 
-    optParser.add_option("-m", action="store_true", dest="echangelog", 
+    parser.add_argument("-m", action="store_true", dest="echangelog",
                          default=False,
                          help="Use name and email address from ECHANGELOG_USER "+
                          "environmental variable. "+
                          "This is a shortcut for -e <email> -n <name>")
 
-    optParser.add_option("-d", action="store", dest="desc", type="string",
+    parser.add_argument("-d", action="store", dest="desc",
                          help="Description of maintainership")
 
-    optParser.add_option("-l", action="store", dest="long", type="string",
+    parser.add_argument("-l", action="store", dest="long",
                          help="Long description of package.")
 
-    optParser.add_option("-o", action="store", dest="output", type="string",
+    parser.add_argument("-o", action="store", dest="output",
                          help="Specify location of output file.")
 
-    optParser.add_option("-f", action="store_true", dest="force", default=False,
+    parser.add_argument("-f", action="store_true", dest="force", default=False,
                          help="Force overwrite of existing metadata.")
 
-    optParser.add_option("-v", action="store_true", dest="verbose", default=True,
+    parser.add_argument("-v", action="store_true", dest="verbose", default=True,
                          help="Verbose. Output of file to stdout. (default)")
 
-    optParser.add_option("-q", action="store_false", dest="verbose",
+    parser.add_argument("-q", action="store_false", dest="verbose",
                          help="Squelch output of file to stdout.")
 
-    optParser.add_option("-Q", action="store_true", dest="no_write",
+    parser.add_argument("-Q", action="store_true", dest="no_write",
                          default=False,
                          help="Do not write file to disk.")
 
-    (options, remainingArgs) = optParser.parse_args()
-
-    if len(sys.argv) == 1:
-        optParser.print_help()
-        sys.exit(1)
+    options = parser.parse_args()
 
     if options.desc or options.name:
         if not options.email and not options.echangelog:


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [gentoo-commits] proj/metagen:master commit in: metagen/
@ 2016-02-21 22:14 Sebastian Pipping
  0 siblings, 0 replies; 23+ messages in thread
From: Sebastian Pipping @ 2016-02-21 22:14 UTC (permalink / raw
  To: gentoo-commits

commit:     7fd15c9e226f6c4886d5236abbb2557817ecbd10
Author:     Sebastian Pipping <sebastian <AT> pipping <DOT> org>
AuthorDate: Sun Feb 21 21:36:44 2016 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Sun Feb 21 21:47:53 2016 +0000
URL:        https://gitweb.gentoo.org/proj/metagen.git/commit/?id=7fd15c9e

Make test_cli call local metagen, not system version

 metagen/test_cli | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/metagen/test_cli b/metagen/test_cli
index d0c9792..79fa443 100755
--- a/metagen/test_cli
+++ b/metagen/test_cli
@@ -1,4 +1,8 @@
 #!/bin/bash
+metagen() {
+    PYTHONPATH=. ./metagen/main.py "$@"
+}
+
 handle_error() {
     ret=$?
     echo FAILED. >&2


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [gentoo-commits] proj/metagen:master commit in: metagen/
@ 2016-02-21 22:17 Sebastian Pipping
  0 siblings, 0 replies; 23+ messages in thread
From: Sebastian Pipping @ 2016-02-21 22:17 UTC (permalink / raw
  To: gentoo-commits

commit:     5c05c90269bf3c8c4b70d4ed9c5c3b70227a5779
Author:     Sebastian Pipping <sebastian <AT> pipping <DOT> org>
AuthorDate: Sun Feb 21 22:17:38 2016 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Sun Feb 21 22:17:38 2016 +0000
URL:        https://gitweb.gentoo.org/proj/metagen.git/commit/?id=5c05c902

Shorten MAINTAINER_TYPE to TYPE in --help output

 metagen/main.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/metagen/main.py b/metagen/main.py
index 1e30a20..a190733 100755
--- a/metagen/main.py
+++ b/metagen/main.py
@@ -145,7 +145,8 @@ if __name__ == '__main__':
                          "This is a shortcut for -e <email> -n <name>")
     maintainer.add_argument("--desc", "-d", action="store",
                          help="Description of maintainership")
-    maintainer.add_argument("--type", "-t", dest='maintainer_type', type=_check_maintainer_type_list,
+    maintainer.add_argument("--type", "-t", dest='maintainer_type', metavar='TYPE',
+                         type=_check_maintainer_type_list,
                          help="Maintainer type as of GLEP 67; valid values are: %s" \
                              % ', '.join('"%s"' % e for e in _VALID_MAINTAINER_TYPES))
 


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [gentoo-commits] proj/metagen:master commit in: metagen/
@ 2016-02-21 22:24 Sebastian Pipping
  0 siblings, 0 replies; 23+ messages in thread
From: Sebastian Pipping @ 2016-02-21 22:24 UTC (permalink / raw
  To: gentoo-commits

commit:     17dcb8c7a88a7234baca64ec01c7fc2f256ba640
Author:     Sebastian Pipping <sebastian <AT> pipping <DOT> org>
AuthorDate: Sun Feb 21 22:23:39 2016 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Sun Feb 21 22:23:39 2016 +0000
URL:        https://gitweb.gentoo.org/proj/metagen.git/commit/?id=17dcb8c7

Fix test suite

 metagen/meta_unittest.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/metagen/meta_unittest.py b/metagen/meta_unittest.py
index 83c311d..4af902c 100644
--- a/metagen/meta_unittest.py
+++ b/metagen/meta_unittest.py
@@ -15,7 +15,8 @@ def test2():
     metadata.set_herd()
     metadata.set_maintainer(["<pythonhead@gentoo.org>"], 
                             ["Rob Cakebread"], 
-                            ["Maintainer description."])
+                            ["Maintainer description."],
+                            ["person"])
     return metadata 
     
 def test3():
@@ -24,7 +25,8 @@ def test3():
     metadata.set_herd(["python"])
     metadata.set_maintainer(["<pythonhead@gentoo.org>"],
                             ["Rob Cakebread"],
-                            ["Maintainer description."])
+                            ["Maintainer description."],
+                            ["person"])
     return metadata 
 
 def test4():
@@ -33,7 +35,8 @@ def test4():
     metadata.set_herd(["python", "gnome"])
     metadata.set_maintainer(["pythonhead@gentoo.org"],
                             ["Rob Cakebread"],
-                            ["Maintainer description."])
+                            ["Maintainer description."],
+                            ["person"])
     return metadata 
 
 def test5():
@@ -42,7 +45,8 @@ def test5():
     metadata.set_herd(["python", "gnome"])
     metadata.set_maintainer(["goofy@gentoo.org", "pythonhead@gentoo.org"],
                             ["Goo Fi", "Rob Cakebread"],
-                            ["Maintainer one.", "Maintainer two"])
+                            ["Maintainer one.", "Maintainer two"],
+                            ["person", "person"])
     metadata.set_longdescription("This packages does X Y and Z.")
     return metadata 
 


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [gentoo-commits] proj/metagen:master commit in: metagen/
@ 2016-02-21 22:27 Sebastian Pipping
  0 siblings, 0 replies; 23+ messages in thread
From: Sebastian Pipping @ 2016-02-21 22:27 UTC (permalink / raw
  To: gentoo-commits

commit:     c4bcec6e6928d5676f8121489b2b04fb108a72eb
Author:     Sebastian Pipping <sebastian <AT> pipping <DOT> org>
AuthorDate: Sun Feb 21 22:26:37 2016 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Sun Feb 21 22:26:37 2016 +0000
URL:        https://gitweb.gentoo.org/proj/metagen.git/commit/?id=c4bcec6e

Sync version to 0.6.4.2

 metagen/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/metagen/version.py b/metagen/version.py
index 728a43d..0b07dbe 100644
--- a/metagen/version.py
+++ b/metagen/version.py
@@ -1 +1 @@
-__version__="0.6.3"
+__version__="0.6.4.2"


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [gentoo-commits] proj/metagen:master commit in: metagen/
@ 2016-06-23 21:21 Sebastian Pipping
  0 siblings, 0 replies; 23+ messages in thread
From: Sebastian Pipping @ 2016-06-23 21:21 UTC (permalink / raw
  To: gentoo-commits

commit:     951ed36b0df62fd96640eee80c030f169adb5163
Author:     Sebastian Pipping <sebastian <AT> pipping <DOT> org>
AuthorDate: Thu Jun 23 20:51:47 2016 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Thu Jun 23 21:20:20 2016 +0000
URL:        https://gitweb.gentoo.org/proj/metagen.git/commit/?id=951ed36b

No longer crash if herds.xml is missing (bug #577148)

 metagen/main.py | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/metagen/main.py b/metagen/main.py
index a190733..235fb53 100755
--- a/metagen/main.py
+++ b/metagen/main.py
@@ -14,11 +14,14 @@ EXAMPLES - man metagen
 import re
 import os
 import sys
+import tempfile
 from argparse import ArgumentParser
 from commands import getstatusoutput
+from textwrap import dedent
 
 from portage import config
-from portage.output import red, blue
+from portage.exception import FileNotFound
+from portage.output import red, blue, yellow
 
 try:
     # portage <2.2.22
@@ -32,7 +35,6 @@ from metagen.version import __version__
 from metagen import metagenerator
 
 PORTDIR = config(local_config=False)["PORTDIR"]
-HB = herdbase.make_herd_base(os.path.sep.join([PORTDIR, 'metadata', 'herds.xml']))
 
 # GLEP 67
 _MAINTAINER_TYPE_PERSON = 'person'
@@ -68,6 +70,20 @@ def parse_echangelog_variable(name, email):
         name = my_name
     return name, email
 
+def check_herds(herds):
+    herds_xml_path = os.path.sep.join([PORTDIR, 'metadata', 'herds.xml'])
+    try:
+        HB = herdbase.make_herd_base(herds_xml_path)
+    except FileNotFound as e:  # bug 577148
+        print yellow('!!! Warning. Herd names could not be checked '
+                'against the list of known herds as '
+                'file "%s" was not found.' % e.value)
+    else:
+        for herd in herds:
+            if not HB.known_herd(herd):
+                print red("!!! Error. Herd %s does not exist." % herd)
+                sys.exit(1)
+
 def generate_xml(options):
     """Returns metadata.xml text"""
 
@@ -76,12 +92,8 @@ def generate_xml(options):
 
     if options.herd:
         herds = options.herd.split(",")
+        check_herds(herds)
 
-    for herd in herds:
-        if not HB.known_herd(herd):
-            print red("!!! Error. Herd %s does not exist." % herd)
-            sys.exit(1) 
-            
     metadata.set_herd(herds)
 
     if options.echangelog:


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [gentoo-commits] proj/metagen:master commit in: metagen/
@ 2016-06-23 21:23 Sebastian Pipping
  0 siblings, 0 replies; 23+ messages in thread
From: Sebastian Pipping @ 2016-06-23 21:23 UTC (permalink / raw
  To: gentoo-commits

commit:     eec986f4ed2e7b4d996e7a9b8b6bced257962c4f
Author:     Sebastian Pipping <sebastian <AT> pipping <DOT> org>
AuthorDate: Thu Jun 23 21:23:05 2016 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Thu Jun 23 21:23:05 2016 +0000
URL:        https://gitweb.gentoo.org/proj/metagen.git/commit/?id=eec986f4

Bump version to 0.6.5

 metagen/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/metagen/version.py b/metagen/version.py
index 0b07dbe..0fd024b 100644
--- a/metagen/version.py
+++ b/metagen/version.py
@@ -1 +1 @@
-__version__="0.6.4.2"
+__version__="0.6.5"


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [gentoo-commits] proj/metagen:master commit in: metagen/
@ 2017-03-13 19:38 Sebastian Pipping
  0 siblings, 0 replies; 23+ messages in thread
From: Sebastian Pipping @ 2017-03-13 19:38 UTC (permalink / raw
  To: gentoo-commits

commit:     ec7bb7b30304033140271c151f42a83161dce464
Author:     Sebastian Pipping <sebastian <AT> pipping <DOT> org>
AuthorDate: Mon Mar 13 19:36:25 2017 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Mon Mar 13 19:37:47 2017 +0000
URL:        https://gitweb.gentoo.org/proj/metagen.git/commit/?id=ec7bb7b3

Bump version to 0.6.6

 metagen/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/metagen/version.py b/metagen/version.py
index 0fd024b..074d83e 100644
--- a/metagen/version.py
+++ b/metagen/version.py
@@ -1 +1 @@
-__version__="0.6.5"
+__version__="0.6.6"


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [gentoo-commits] proj/metagen:master commit in: metagen/
@ 2020-01-31 17:55 Sebastian Pipping
  0 siblings, 0 replies; 23+ messages in thread
From: Sebastian Pipping @ 2020-01-31 17:55 UTC (permalink / raw
  To: gentoo-commits

commit:     0337a270b6f07b99fb781d2741c0a54415aced57
Author:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 31 16:07:22 2020 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Fri Jan 31 17:55:00 2020 +0000
URL:        https://gitweb.gentoo.org/proj/metagen.git/commit/?id=0337a270

Bump version to 0.7.2

Signed-off-by: Sebastian Pipping <sping <AT> gentoo.org>

 metagen/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/metagen/version.py b/metagen/version.py
index 2099629..4094945 100644
--- a/metagen/version.py
+++ b/metagen/version.py
@@ -1 +1 @@
-__version__="0.7.1"
+__version__="0.7.2"


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [gentoo-commits] proj/metagen:master commit in: metagen/
@ 2020-01-31 17:55 Sebastian Pipping
  0 siblings, 0 replies; 23+ messages in thread
From: Sebastian Pipping @ 2020-01-31 17:55 UTC (permalink / raw
  To: gentoo-commits

commit:     0c06fc1d848f0b891b210778b2a99b7396aa8871
Author:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 31 17:51:23 2020 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Fri Jan 31 17:54:35 2020 +0000
URL:        https://gitweb.gentoo.org/proj/metagen.git/commit/?id=0c06fc1d

Get document type declaration back to a single

Signed-off-by: Sebastian Pipping <sping <AT> gentoo.org>

 metagen/metagenerator.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/metagen/metagenerator.py b/metagen/metagenerator.py
index e733997..c0b79d7 100755
--- a/metagen/metagenerator.py
+++ b/metagen/metagenerator.py
@@ -75,7 +75,13 @@ class MyMetadata:
         # Re-write indentation to tabulators
         # (for backwards compatibility and smaller diffs with existing files)
         reparsed = minidom.parseString(xml_text)
-        return reparsed.toprettyxml(indent='\t', encoding='UTF-8').decode()
+        xml_text = reparsed.toprettyxml(indent='\t', encoding='UTF-8').decode()
+
+        # Get doctype back on a single line
+        # - for compatibility with output produced by metagen <0.7
+        # - to make pkgcheck stop from warning about PkgMetadataXmlIndentation
+        return xml_text.replace('<!DOCTYPE pkgmetadata\n  SYSTEM',
+                                '<!DOCTYPE pkgmetadata SYSTEM')
 
 
 def do_tests():


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [gentoo-commits] proj/metagen:master commit in: metagen/
@ 2022-01-25 18:06 Sebastian Pipping
  0 siblings, 0 replies; 23+ messages in thread
From: Sebastian Pipping @ 2022-01-25 18:06 UTC (permalink / raw
  To: gentoo-commits

commit:     bfde1b53cf1f90955caff48c554055fe55469e42
Author:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 25 18:03:44 2022 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Tue Jan 25 18:06:20 2022 +0000
URL:        https://gitweb.gentoo.org/proj/metagen.git/commit/?id=bfde1b53

Bump version to 0.7.3

Signed-off-by: Sebastian Pipping <sping <AT> gentoo.org>

 metagen/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/metagen/version.py b/metagen/version.py
index 4094945..8cc627b 100644
--- a/metagen/version.py
+++ b/metagen/version.py
@@ -1 +1 @@
-__version__="0.7.2"
+__version__="0.7.3"


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [gentoo-commits] proj/metagen:master commit in: metagen/
@ 2024-03-31  0:10 Sebastian Pipping
  0 siblings, 0 replies; 23+ messages in thread
From: Sebastian Pipping @ 2024-03-31  0:10 UTC (permalink / raw
  To: gentoo-commits

commit:     2e1de5adeba1590d03a07d70f971ded91f47ad5b
Author:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 30 23:29:03 2024 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Sun Mar 31 00:09:56 2024 +0000
URL:        https://gitweb.gentoo.org/proj/metagen.git/commit/?id=2e1de5ad

Bump version to 0.7.4

Signed-off-by: Sebastian Pipping <sping <AT> gentoo.org>

 metagen/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/metagen/version.py b/metagen/version.py
index 8cc627b..430b222 100644
--- a/metagen/version.py
+++ b/metagen/version.py
@@ -1 +1 @@
-__version__="0.7.3"
+__version__="0.7.4"


^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2024-03-31  0:10 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-23 21:23 [gentoo-commits] proj/metagen:master commit in: metagen/ Sebastian Pipping
  -- strict thread matches above, loose matches on Subject: below --
2024-03-31  0:10 Sebastian Pipping
2022-01-25 18:06 Sebastian Pipping
2020-01-31 17:55 Sebastian Pipping
2020-01-31 17:55 Sebastian Pipping
2017-03-13 19:38 Sebastian Pipping
2016-06-23 21:21 Sebastian Pipping
2016-02-21 22:27 Sebastian Pipping
2016-02-21 22:24 Sebastian Pipping
2016-02-21 22:17 Sebastian Pipping
2016-02-21 22:14 Sebastian Pipping
2016-02-21 22:14 Sebastian Pipping
2016-02-21 22:14 Sebastian Pipping
2016-02-21 22:14 Sebastian Pipping
2015-10-30 15:13 Sebastian Pipping
2015-10-30 15:13 Sebastian Pipping
2011-09-28 14:46 Jesus Rivero
2011-09-25 14:04 Jesus Rivero
2011-09-25 14:04 Jesus Rivero
2011-09-25 14:04 Jesus Rivero
2011-09-09 13:42 Jesus Rivero
2011-09-09 13:16 Jesus Rivero
2011-08-13 22:08 Jesus Rivero

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox