From: Sebastian Luther <SebastianLuther@gmx.de>
To: gentoo-portage-dev@lists.gentoo.org
Subject: Re: [gentoo-portage-dev] [PATCH] egencache: --write-timestamp to create metadata/timestamp.chk
Date: Wed, 27 Nov 2013 22:41:12 +0100 [thread overview]
Message-ID: <529666F8.1040208@gmx.de> (raw)
In-Reply-To: <201311271620.49611.vapier@gentoo.org>
Am 27.11.2013 22:20, schrieb Mike Frysinger:
> On Wednesday 27 November 2013 05:31:17 SebastianLuther@gmx.de
> wrote:
>> + if options.write_timestamp: + timestamp_path =
>> os.path.join(repo_path, "metadata", "timestamp.chk") + try: +
>> timestampfile = open(timestamp_path, "w") + try: +
>> timestampfile.write( + time.strftime("%a, %d %b %Y %H:%M:%S
>> +0000",
> time.gmtime()))
>> + timestampfile.write("\n") + finally: +
>> timestampfile.close()
>
> use a with block, and merge those writes
>
> with open(timestamp_path, 'w') as f: f.write(time.strftime('%a, %d
> %b %Y %H:%M:%S +0000\n', time.gmtime())) -mike
>
What if the f.write raises an exception?
next prev parent reply other threads:[~2013-11-27 21:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-27 10:31 [gentoo-portage-dev] [PATCH] egencache: --write-timestamp to create metadata/timestamp.chk SebastianLuther
2013-11-27 21:20 ` Mike Frysinger
2013-11-27 21:41 ` Sebastian Luther [this message]
2013-11-27 21:45 ` Mike Frysinger
-- strict thread matches above, loose matches on Subject: below --
2013-11-29 13:36 SebastianLuther
2013-11-29 14:17 ` Mike Frysinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=529666F8.1040208@gmx.de \
--to=sebastianluther@gmx.de \
--cc=gentoo-portage-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox