public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: pym/repoman/, pym/portage/package/ebuild/, bin/, pym/_emerge/
@ 2013-02-10  3:48 Arfrever Frehtes Taifersar Arahesis
  0 siblings, 0 replies; only message in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2013-02-10  3:48 UTC (permalink / raw
  To: gentoo-commits

commit:     e993a6e34c564211242cbaa76b082f95ec713097
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Sun Feb 10 03:47:21 2013 +0000
Commit:     Arfrever Frehtes Taifersar Arahesis <arfrever.fta <AT> gmail <DOT> com>
CommitDate: Sun Feb 10 03:47:21 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e993a6e3

Fix some ResourceWarnings.

---
 bin/archive-conf                                   |    4 ++--
 bin/repoman                                        |    3 ++-
 pym/_emerge/depgraph.py                            |    5 +++--
 pym/_emerge/getloadavg.py                          |    5 +++--
 .../package/ebuild/deprecated_profile_check.py     |    7 ++++---
 pym/repoman/utilities.py                           |    5 +++--
 6 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/bin/archive-conf b/bin/archive-conf
index 2c10884..42b6274 100755
--- a/bin/archive-conf
+++ b/bin/archive-conf
@@ -63,8 +63,8 @@ def archive_conf():
         md5_match_hash[conf] = ''
 
     # Find all the CONTENT files in VDB_PATH.
-    content_files += os.popen(FIND_EXTANT_CONTENTS %
-			(os.path.join(portage.settings['EROOT'], portage.VDB_PATH))).readlines()
+    with os.popen(FIND_EXTANT_CONTENTS % (os.path.join(portage.settings['EROOT'], portage.VDB_PATH))) as f:
+	    content_files += f.readlines()
 
     # Search for the saved md5 checksum of all the specified config files
     # and see if the current file is unmodified or not.

diff --git a/bin/repoman b/bin/repoman
index 58d4f23..3532bab 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -1218,7 +1218,8 @@ elif vcs == "hg":
 	with repoman_popen("hg status --no-status --modified .") as f:
 		mychanged = f.readlines()
 	mychanged = ["./" + elem.rstrip() for elem in mychanged]
-	mynew = repoman_popen("hg status --no-status --added .").readlines()
+	with repoman_popen("hg status --no-status --added .") as f:
+		mynew = f.readlines()
 	mynew = ["./" + elem.rstrip() for elem in mynew]
 	if options.if_modified == "y":
 		with repoman_popen("hg status --no-status --removed .") as f:

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 3f24267..27104e1 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -6609,11 +6609,12 @@ class depgraph(object):
 		def write_changes(root, changes, file_to_write_to):
 			file_contents = None
 			try:
-				file_contents = io.open(
+				with io.open(
 					_unicode_encode(file_to_write_to,
 					encoding=_encodings['fs'], errors='strict'),
 					mode='r', encoding=_encodings['content'],
-					errors='replace').readlines()
+					errors='replace') as f:
+					file_contents = f.readlines()
 			except IOError as e:
 				if e.errno == errno.ENOENT:
 					file_contents = []

diff --git a/pym/_emerge/getloadavg.py b/pym/_emerge/getloadavg.py
index e9babf1..6a2794f 100644
--- a/pym/_emerge/getloadavg.py
+++ b/pym/_emerge/getloadavg.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2009 Gentoo Foundation
+# Copyright 1999-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 from portage import os
@@ -11,7 +11,8 @@ if getloadavg is None:
 		Raises OSError if the load average was unobtainable.
 		"""
 		try:
-			loadavg_str = open('/proc/loadavg').readline()
+			with open('/proc/loadavg') as f:
+				loadavg_str = f.readline()
 		except IOError:
 			# getloadavg() is only supposed to raise OSError, so convert
 			raise OSError('unknown')

diff --git a/pym/portage/package/ebuild/deprecated_profile_check.py b/pym/portage/package/ebuild/deprecated_profile_check.py
index ddb8c70..2acf8e3 100644
--- a/pym/portage/package/ebuild/deprecated_profile_check.py
+++ b/pym/portage/package/ebuild/deprecated_profile_check.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Gentoo Foundation
+# Copyright 2010-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 __all__ = ['deprecated_profile_check']
@@ -32,9 +32,10 @@ def deprecated_profile_check(settings=None):
 			if not os.access(deprecated_profile_file, os.R_OK):
 				return
 
-	dcontent = io.open(_unicode_encode(deprecated_profile_file,
+	with io.open(_unicode_encode(deprecated_profile_file,
 		encoding=_encodings['fs'], errors='strict'), 
-		mode='r', encoding=_encodings['content'], errors='replace').readlines()
+		mode='r', encoding=_encodings['content'], errors='replace') as f:
+		dcontent = f.readlines()
 	writemsg(colorize("BAD", _("\n!!! Your current profile is "
 		"deprecated and not supported anymore.")) + "\n", noiselevel=-1)
 	writemsg(colorize("BAD", _("!!! Use eselect profile to update your "

diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py
index cb03621..990090c 100644
--- a/pym/repoman/utilities.py
+++ b/pym/repoman/utilities.py
@@ -380,10 +380,11 @@ def get_commit_message_with_editor(editor, message=None):
 		if not (os.WIFEXITED(retval) and os.WEXITSTATUS(retval) == os.EX_OK):
 			return None
 		try:
-			mylines = io.open(_unicode_encode(filename,
+			with io.open(_unicode_encode(filename,
 				encoding=_encodings['fs'], errors='strict'),
 				mode='r', encoding=_encodings['content'], errors='replace'
-				).readlines()
+				) as f:
+				mylines = f.readlines()
 		except OSError as e:
 			if e.errno != errno.ENOENT:
 				raise


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-02-10  3:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-10  3:48 [gentoo-commits] proj/portage:master commit in: pym/repoman/, pym/portage/package/ebuild/, bin/, pym/_emerge/ Arfrever Frehtes Taifersar Arahesis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox