<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
On Wed, May 5, 2021 at 9:47 AM Gedare Bloom <gedare@rtems.org> wrote:<br>
><br>
> Why?</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
To prevent the '--mail' and '--use-gitconfig' options from being added more than once to the ArgumentParser in add_arguments.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Alex</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
><br>
> On Wed, May 5, 2021 at 8:08 AM Alex White <alex.white@oarcorp.com> wrote:<br>
> ><br>
> > The ordering of keys cannot be guaranteed in a dictionary. This changes<br>
> > the options dictionary to an OrderedDict to preserve key order. This<br>
> > also fixes the iteration start point in add_arguments.<br>
> ><br>
> > Closes #4402<br>
> > ---<br>
> > rtemstoolkit/mailer.py | 24 +++++++++++++-----------<br>
> > 1 file changed, 13 insertions(+), 11 deletions(-)<br>
> ><br>
> > diff --git a/rtemstoolkit/mailer.py b/rtemstoolkit/mailer.py<br>
> > index ae51d78..ad832d5 100644<br>
> > --- a/rtemstoolkit/mailer.py<br>
> > +++ b/rtemstoolkit/mailer.py<br>
> > @@ -1,6 +1,7 @@<br>
> > #<br>
> > # RTEMS Tools Project (http://www.rtems.org/)<br>
> > # Copyright 2013-2016 Chris Johns (chrisj@rtems.org)<br>
> > +# Copyright (C) 2021 On-Line Applications Research Corporation (OAR)<br>
> > # All rights reserved.<br>
> > #<br>
> > # This file is part of the RTEMS Tools package in 'rtems-tools'.<br>
> > @@ -33,6 +34,7 @@<br>
> > #<br>
> ><br>
> > from __future__ import print_function<br>
> > +from collections import OrderedDict<br>
> ><br>
> > import os<br>
> > import smtplib<br>
> > @@ -43,16 +45,16 @@ from rtemstoolkit import execute<br>
> > from rtemstoolkit import options<br>
> > from rtemstoolkit import path<br>
> ><br>
> > -_options = {<br>
> > - '--mail' : 'Send email report or results.',<br>
> > - '--use-gitconfig': 'Use mail configuration from git config.',<br>
> > - '--mail-to' : 'Email address to send the email to.',<br>
> > - '--mail-from' : 'Email address the report is from.',<br>
> > - '--smtp-host' : 'SMTP host to send via.',<br>
> > - '--smtp-port' : 'SMTP port to send via.',<br>
> > - '--smtp-user' : 'User for SMTP authentication.',<br>
> > - '--smtp-password': 'Password for SMTP authentication.'<br>
> > -}<br>
> > +_options = OrderedDict([<br>
> > + ('--mail' , 'Send email report or results.'),<br>
> > + ('--use-gitconfig', 'Use mail configuration from git config.'),<br>
> > + ('--mail-to' , 'Email address to send the email to.'),<br>
> > + ('--mail-from' , 'Email address the report is from.'),<br>
> > + ('--smtp-host' , 'SMTP host to send via.'),<br>
> > + ('--smtp-port' , 'SMTP port to send via.'),<br>
> > + ('--smtp-user' , 'User for SMTP authentication.'),<br>
> > + ('--smtp-password', 'Password for SMTP authentication.')<br>
> > +])<br>
> ><br>
> > def append_options(opts):<br>
> > for o in _options:<br>
> > @@ -61,7 +63,7 @@ def append_options(opts):<br>
> > def add_arguments(argsp):<br>
> > argsp.add_argument('--mail', help = _options['--mail'], action = 'store_true')<br>
> > argsp.add_argument('--use-gitconfig', help = _options['--use-gitconfig'], action = 'store_true')<br>
> > - for o in list(_options)[1:]:<br>
> > + for o in list(_options)[2:]:<br>
> > argsp.add_argument(o, help = _options[o], type = str)<br>
> ><br>
> > class mail:<br>
> > --<br>
> > 2.27.0<br>
> ><br>
> > _______________________________________________<br>
> > devel mailing list<br>
> > devel@rtems.org<br>
> > http://lists.rtems.org/mailman/listinfo/devel<br>
> _______________________________________________<br>
> devel mailing list<br>
> devel@rtems.org<br>
> <a href="http://lists.rtems.org/mailman/listinfo/devel" id="LPlnk315873">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</div>
</body>
</html>