public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Cc: SebastianLuther@gmx.de
Subject: Re: [gentoo-portage-dev] [PATCH] egencache: --write-timestamp to create metadata/timestamp.chk
Date: Wed, 27 Nov 2013 16:20:48 -0500	[thread overview]
Message-ID: <201311271620.49611.vapier@gentoo.org> (raw)
In-Reply-To: <1385548277-18122-1-git-send-email-SebastianLuther@gmx.de>

[-- Attachment #1: Type: Text/Plain, Size: 596 bytes --]

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

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2013-11-27 21:20 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 [this message]
2013-11-27 21:41   ` Sebastian Luther
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=201311271620.49611.vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=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