Hi Simon,
On Wed, 20 Aug 2014 13:13:13 -0600 Simon Glass <s...@chromium.org> wrote: > > +def output_is_new(): > > + """Check if the boards.cfg file is up to date. > > + > > + Returns: > > + True if the boards.cfg file exists and is newer than any of > > + *_defconfig, MAINTAINERS and Kconfig*. False otherwise. > > + """ > > + try: > > + ctime = os.path.getctime(BOARD_FILE) > > + except OSError, exception: > > + if exception.errno == errno.ENOENT: > > + # return False on 'No such file or directory' error > > + return False > > + else: > > + raise > > if not os.path.exists(BOARD_FILE) > return False > > would probably be enough. > Actually my first code was as follows: ------------>8------------------------ if not os.path.exists(BOARD_FILE) return False ctime = os.path.getctime(BOARD_FILE) -------------8<---------------------- But what if someone deletes BOARD_FILE between os.path.exists(BOARD_FILE) and os.path.getctime(BOARD_FILE)? I know it is ridiculous to consider such a rare case. But I believe it is Python style to follow "try something and then handle an exception" thing. I am trying to be a bit strict to this rule when invoking OS system calls where there is possibility of failure. Best Regards Masahiro Yamada _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot