diff mbox series

[v2,1/3] rteval: Allow arguments specific to module group

Message ID 20230811095228.200772-2-tglozar@redhat.com
State New
Headers show
Series rteval: Add cmdline option to run measurements on isolcpus by default | expand

Commit Message

Tomas Glozar Aug. 11, 2023, 9:52 a.m. UTC
Return grparser from ModuleContainer.SetupModuleOptions, which allows it
to be used to setup additional options in *Modules class.

Signed-off-by: Tomas Glozar <tglozar@redhat.com>
---
 rteval/modules/__init__.py | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

Comments

John Kacur Sept. 15, 2023, 6:58 p.m. UTC | #1
On Fri, 11 Aug 2023, Tomas Glozar wrote:

> Return grparser from ModuleContainer.SetupModuleOptions, which allows it
> to be used to setup additional options in *Modules class.
> 
> Signed-off-by: Tomas Glozar <tglozar@redhat.com>
> ---
>  rteval/modules/__init__.py | 18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/rteval/modules/__init__.py b/rteval/modules/__init__.py
> index 794135d..f4fd160 100644
> --- a/rteval/modules/__init__.py
> +++ b/rteval/modules/__init__.py
> @@ -312,7 +312,7 @@ the information provided by the module"""
>                  # Ignore if a section is not found
>                  cfg = None
>  
> -            grparser = parser.add_argument_group("Options for the %s module" % shortmod)
> +            modgrparser = parser.add_argument_group("Options for the %s module" % shortmod)
>              for (o, s) in list(opts.items()):
>                  descr = 'descr' in s and s['descr'] or ""
>                  metavar = 'metavar' in s and s['metavar'] or None
> @@ -327,13 +327,15 @@ the information provided by the module"""
>                      default = 'default' in s and s['default'] or None
>  
>  
> -                grparser.add_argument('--%s-%s' % (shortmod, o),
> -                                    dest="%s___%s" % (shortmod, o),
> -                                    action='store',
> -                                    help='%s%s' % (descr,
> -                                                   default and ' (default: %s)' % default or ''),
> -                                    default=default,
> -                                    metavar=metavar)
> +                modgrparser.add_argument('--%s-%s' % (shortmod, o),
> +                                         dest="%s___%s" % (shortmod, o),
> +                                         action='store',
> +                                         help='%s%s' % (descr,
> +                                                        default and ' (default: %s)' % default or ''),
> +                                         default=default,
> +                                         metavar=metavar)
> +
> +            return grparser
>  
>  
>      def InstantiateModule(self, modname, modcfg, modroot=None):
> -- 
> 2.41.0
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>
diff mbox series

Patch

diff --git a/rteval/modules/__init__.py b/rteval/modules/__init__.py
index 794135d..f4fd160 100644
--- a/rteval/modules/__init__.py
+++ b/rteval/modules/__init__.py
@@ -312,7 +312,7 @@  the information provided by the module"""
                 # Ignore if a section is not found
                 cfg = None
 
-            grparser = parser.add_argument_group("Options for the %s module" % shortmod)
+            modgrparser = parser.add_argument_group("Options for the %s module" % shortmod)
             for (o, s) in list(opts.items()):
                 descr = 'descr' in s and s['descr'] or ""
                 metavar = 'metavar' in s and s['metavar'] or None
@@ -327,13 +327,15 @@  the information provided by the module"""
                     default = 'default' in s and s['default'] or None
 
 
-                grparser.add_argument('--%s-%s' % (shortmod, o),
-                                    dest="%s___%s" % (shortmod, o),
-                                    action='store',
-                                    help='%s%s' % (descr,
-                                                   default and ' (default: %s)' % default or ''),
-                                    default=default,
-                                    metavar=metavar)
+                modgrparser.add_argument('--%s-%s' % (shortmod, o),
+                                         dest="%s___%s" % (shortmod, o),
+                                         action='store',
+                                         help='%s%s' % (descr,
+                                                        default and ' (default: %s)' % default or ''),
+                                         default=default,
+                                         metavar=metavar)
+
+            return grparser
 
 
     def InstantiateModule(self, modname, modcfg, modroot=None):