public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/dbapi/, pym/_emerge/
Date: Tue, 18 Oct 2011 05:45:24 +0000 (UTC)	[thread overview]
Message-ID: <654fd3e173e7e92f9ff1ee1e55caa5c2e7a96ad9.zmedico@gentoo> (raw)

commit:     654fd3e173e7e92f9ff1ee1e55caa5c2e7a96ad9
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 18 05:45:13 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Oct 18 05:45:13 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=654fd3e1

python3.2 fixes: "ResourceWarning: unclosed file"

---
 pym/_emerge/EbuildMetadataPhase.py     |    6 +++---
 pym/portage/dbapi/porttree.py          |    6 +++---
 pym/portage/package/ebuild/doebuild.py |    7 ++++---
 3 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/pym/_emerge/EbuildMetadataPhase.py b/pym/_emerge/EbuildMetadataPhase.py
index 06cabe7..aa26e19 100644
--- a/pym/_emerge/EbuildMetadataPhase.py
+++ b/pym/_emerge/EbuildMetadataPhase.py
@@ -38,11 +38,11 @@ class EbuildMetadataPhase(SubProcess):
 		eapi = self.eapi
 		if eapi is None and \
 			'parse-eapi-ebuild-head' in settings.features:
-			eapi = portage._parse_eapi_ebuild_head(
-				io.open(_unicode_encode(ebuild_path,
+			with io.open(_unicode_encode(ebuild_path,
 				encoding=_encodings['fs'], errors='strict'),
 				mode='r', encoding=_encodings['repo.content'],
-				errors='replace'))
+				errors='replace') as f:
+				eapi = portage._parse_eapi_ebuild_head(f)
 
 		if eapi is not None:
 			if not portage.eapi_is_supported(eapi):

diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index aad72e1..6f3d90f 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -519,11 +519,11 @@ class portdbapi(dbapi):
 
 			if eapi is None and \
 				'parse-eapi-ebuild-head' in self.doebuild_settings.features:
-				eapi = portage._parse_eapi_ebuild_head(io.open(
-					_unicode_encode(myebuild,
+				with io.open(_unicode_encode(myebuild,
 					encoding=_encodings['fs'], errors='strict'),
 					mode='r', encoding=_encodings['repo.content'],
-					errors='replace'))
+					errors='replace') as f:
+					eapi = portage._parse_eapi_ebuild_head(f)
 
 			if eapi is not None:
 				self.doebuild_settings.configdict['pkg']['EAPI'] = eapi

diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index e479159..a324af2 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -290,10 +290,11 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
 	eapi = None
 	if mydo == 'depend' and 'EAPI' not in mysettings.configdict['pkg']:
 		if eapi is None and 'parse-eapi-ebuild-head' in mysettings.features:
-			eapi = _parse_eapi_ebuild_head(
-				io.open(_unicode_encode(ebuild_path,
+			with io.open(_unicode_encode(ebuild_path,
 				encoding=_encodings['fs'], errors='strict'),
-				mode='r', encoding=_encodings['content'], errors='replace'))
+				mode='r', encoding=_encodings['content'],
+				errors='replace') as f:
+				eapi = _parse_eapi_ebuild_head(f)
 
 		if eapi is not None:
 			if not eapi_is_supported(eapi):



             reply	other threads:[~2011-10-18  5:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-18  5:45 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-01-14 15:30 [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/dbapi/, pym/_emerge/ Zac Medico
2012-06-11 23:08 Zac Medico
2013-01-04  2:23 Zac Medico
2013-07-25 21:54 Zac Medico

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=654fd3e173e7e92f9ff1ee1e55caa5c2e7a96ad9.zmedico@gentoo \
    --to=zmedico@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-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