[U-Boot] [PATCH 5/7] tools/genboardscfg.py: fix minor problems on termination

Masahiro Yamada yamada.m at jp.panasonic.com
Thu Aug 21 06:00:07 CEST 2014


Hi Simon,



On Wed, 20 Aug 2014 13:10:52 -0600
Simon Glass <sjg at chromium.org> wrote:

> I try to put an _ before private members to indicate that they should
> not be used outside the class. But It is not particularly important -
> just thought I'd mention it.


I will try my best to keep this in mind
when I send the next version.
(and when I write other Python scripts.)

But I do not have an enough motivation to do so for now.



> > +
> > +        # Parse all the MAINTAINERS files
> > +        maintainers_database = MaintainersDatabase()
> > +        for (dirpath, dirnames, filenames) in os.walk('.'):
> > +            if 'MAINTAINERS' in filenames:
> > +                maintainers_database.parse_file(os.path.join(dirpath,
> > +                                                             'MAINTAINERS'))
> > +        self.maintainers_database = maintainers_database
> > +
> > +    def __del__(self):
> > +        """Delete the incomplete boards.cfg
> > +
> > +        This destructor deletes boards.cfg if the private member 'in_progress'
> > +        is defined as True.  The 'in_progress' member is set to True at the
> > +        beginning of the generate() method and set to False at its end.
> > +        So, in_progress==True means generating boards.cfg was terminated
> > +        on the way.
> > +        """
> > +
> > +        if hasattr(self, 'in_progress') and self.in_progress:
> 
> Would it be better to initialise in_progress to None in the constructor?
> 


At first I thought of that.


If the constructor fails before setting in_progress to None,
the destructor is invoked with undefined in_progress.

Of course, it rarely (never) happens.
But I am trying to be as safe as possible.


Best Regards
Masahiro Yamada



More information about the U-Boot mailing list