On Wed, May 5, 2021 at 9:47 AM Gedare Bloom <ged...@rtems.org> wrote: > > Why?
To prevent the '--mail' and '--use-gitconfig' options from being added more than once to the ArgumentParser in add_arguments. Alex > > On Wed, May 5, 2021 at 8:08 AM Alex White <alex.wh...@oarcorp.com> wrote: > > > > The ordering of keys cannot be guaranteed in a dictionary. This changes > > the options dictionary to an OrderedDict to preserve key order. This > > also fixes the iteration start point in add_arguments. > > > > Closes #4402 > > --- > > rtemstoolkit/mailer.py | 24 +++++++++++++----------- > > 1 file changed, 13 insertions(+), 11 deletions(-) > > > > diff --git a/rtemstoolkit/mailer.py b/rtemstoolkit/mailer.py > > index ae51d78..ad832d5 100644 > > --- a/rtemstoolkit/mailer.py > > +++ b/rtemstoolkit/mailer.py > > @@ -1,6 +1,7 @@ > > # > > # RTEMS Tools Project (http://www.rtems.org/) > > # Copyright 2013-2016 Chris Johns (chr...@rtems.org) > > +# Copyright (C) 2021 On-Line Applications Research Corporation (OAR) > > # All rights reserved. > > # > > # This file is part of the RTEMS Tools package in 'rtems-tools'. > > @@ -33,6 +34,7 @@ > > # > > > > from __future__ import print_function > > +from collections import OrderedDict > > > > import os > > import smtplib > > @@ -43,16 +45,16 @@ from rtemstoolkit import execute > > from rtemstoolkit import options > > from rtemstoolkit import path > > > > -_options = { > > - '--mail' : 'Send email report or results.', > > - '--use-gitconfig': 'Use mail configuration from git config.', > > - '--mail-to' : 'Email address to send the email to.', > > - '--mail-from' : 'Email address the report is from.', > > - '--smtp-host' : 'SMTP host to send via.', > > - '--smtp-port' : 'SMTP port to send via.', > > - '--smtp-user' : 'User for SMTP authentication.', > > - '--smtp-password': 'Password for SMTP authentication.' > > -} > > +_options = OrderedDict([ > > + ('--mail' , 'Send email report or results.'), > > + ('--use-gitconfig', 'Use mail configuration from git config.'), > > + ('--mail-to' , 'Email address to send the email to.'), > > + ('--mail-from' , 'Email address the report is from.'), > > + ('--smtp-host' , 'SMTP host to send via.'), > > + ('--smtp-port' , 'SMTP port to send via.'), > > + ('--smtp-user' , 'User for SMTP authentication.'), > > + ('--smtp-password', 'Password for SMTP authentication.') > > +]) > > > > def append_options(opts): > > for o in _options: > > @@ -61,7 +63,7 @@ def append_options(opts): > > def add_arguments(argsp): > > argsp.add_argument('--mail', help = _options['--mail'], action = > > 'store_true') > > argsp.add_argument('--use-gitconfig', help = > > _options['--use-gitconfig'], action = 'store_true') > > - for o in list(_options)[1:]: > > + for o in list(_options)[2:]: > > argsp.add_argument(o, help = _options[o], type = str) > > > > class mail: > > -- > > 2.27.0 > > > > _______________________________________________ > > devel mailing list > > devel@rtems.org > > http://lists.rtems.org/mailman/listinfo/devel > _______________________________________________ > devel mailing list > devel@rtems.org > http://lists.rtems.org/mailman/listinfo/devel
_______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel