From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1RG2nr-0003Ol-C1 for garchives@archives.gentoo.org; Tue, 18 Oct 2011 06:05:31 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C74BD21C01F; Tue, 18 Oct 2011 06:05:23 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 8410C21C01F for ; Tue, 18 Oct 2011 06:05:23 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E5ADE1B401D for ; Tue, 18 Oct 2011 06:05:22 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 4A62280042 for ; Tue, 18 Oct 2011 06:05:22 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: Subject: [gentoo-commits] proj/portage:master commit in: bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/repoman X-VCS-Directories: bin/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: cb3f4b3c7a81ea5f15f9e5dbc67ede961511d2f8 Date: Tue, 18 Oct 2011 06:05:22 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 5df8dc79bcb23f845380e5db20a7bd2b commit: cb3f4b3c7a81ea5f15f9e5dbc67ede961511d2f8 Author: Zac Medico gentoo org> AuthorDate: Tue Oct 18 06:05:09 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Tue Oct 18 06:05:09 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Dcb3f4b3c python3.2 fixes: "ResourceWarning: unclosed file" --- bin/repoman | 68 +++++++++++++++++++++++++++++++++++++++++------------= ----- 1 files changed, 48 insertions(+), 20 deletions(-) diff --git a/bin/repoman b/bin/repoman index ad1e688..4966d22 100755 --- a/bin/repoman +++ b/bin/repoman @@ -1105,36 +1105,46 @@ if vcs =3D=3D "cvs": myremoved =3D cvstree.findremoved(mycvstree, recursive=3D1, basedir=3D= "./") =20 if vcs =3D=3D "svn": - svnstatus =3D os.popen("svn status").readlines() + with os.popen("svn status") as f: + svnstatus =3D f.readlines() mychanged =3D [ "./" + elem.split()[-1:][0] for elem in svnstatus if el= em and elem[:1] in "MR" ] mynew =3D [ "./" + elem.split()[-1:][0] for elem in svnstatus if el= em.startswith("A") ] if options.if_modified =3D=3D "y": myremoved =3D [ "./" + elem.split()[-1:][0] for elem in svnstatus if e= lem.startswith("D")] =20 elif vcs =3D=3D "git": - mychanged =3D os.popen("git diff-index --name-only --relative --diff-fi= lter=3DM HEAD").readlines() + with os.popen("git diff-index --name-only " + "--relative --diff-filter=3DM HEAD") as f: + mychanged =3D f.readlines() mychanged =3D ["./" + elem[:-1] for elem in mychanged] =20 - mynew =3D os.popen("git diff-index --name-only --relative --diff-filter= =3DA HEAD").readlines() + with os.popen("git diff-index --name-only " + "--relative --diff-filter=3DA HEAD") as f: + mynew =3D f.readlines() mynew =3D ["./" + elem[:-1] for elem in mynew] if options.if_modified =3D=3D "y": - myremoved =3D os.popen("git diff-index --name-only --relative --diff-f= ilter=3DD HEAD").readlines() + with os.popen("git diff-index --name-only " + "--relative --diff-filter=3DD HEAD") as f: + myremoved =3D f.readlines() myremoved =3D ["./" + elem[:-1] for elem in myremoved] =20 elif vcs =3D=3D "bzr": - bzrstatus =3D os.popen("bzr status -S .").readlines() + with os.popen("bzr status -S .") as f: + bzrstatus =3D f.readlines() mychanged =3D [ "./" + elem.split()[-1:][0].split('/')[-1:][0] for elem= in bzrstatus if elem and elem[1:2] =3D=3D "M" ] mynew =3D [ "./" + elem.split()[-1:][0].split('/')[-1:][0] for elem= in bzrstatus if elem and ( elem[1:2] =3D=3D "NK" or elem[0:1] =3D=3D "R"= ) ] if options.if_modified =3D=3D "y": myremoved =3D [ "./" + elem.split()[-3:-2][0].split('/')[-1:][0] for e= lem in bzrstatus if elem and ( elem[1:2] =3D=3D "K" or elem[0:1] =3D=3D "= R" ) ] =20 elif vcs =3D=3D "hg": - mychanged =3D os.popen("hg status --no-status --modified .").readlines(= ) + with os.popen("hg status --no-status --modified .") as f: + mychanged =3D f.readlines() mychanged =3D ["./" + elem.rstrip() for elem in mychanged] mynew =3D os.popen("hg status --no-status --added .").readlines() mynew =3D ["./" + elem.rstrip() for elem in mynew] if options.if_modified =3D=3D "y": - myremoved =3D os.popen("hg status --no-status --removed .").readlines(= ) + with os.popen("hg status --no-status --removed .") as f: + myremoved =3D f.readlines() myremoved =3D ["./" + elem.rstrip() for elem in myremoved] =20 if vcs: @@ -2239,7 +2249,8 @@ else: err("Error retrieving CVS tree; exiting.") if vcs =3D=3D "svn": try: - svnstatus=3Dos.popen("svn status --no-ignore").readlines() + with os.popen("svn status --no-ignore") as f: + svnstatus =3D f.readlines() myunadded =3D [ "./"+elem.rstrip().split()[1] for elem in svnstatus i= f elem.startswith("?") or elem.startswith("I") ] except SystemExit as e: raise # TODO propagate this @@ -2252,20 +2263,23 @@ else: myf.close() if vcs =3D=3D "bzr": try: - bzrstatus=3Dos.popen("bzr status -S .").readlines() + with os.popen("bzr status -S .") as f: + bzrstatus =3D f.readlines() myunadded =3D [ "./"+elem.rstrip().split()[1].split('/')[-1:][0] for = elem in bzrstatus if elem.startswith("?") or elem[0:2] =3D=3D " D" ] except SystemExit as e: raise # TODO propagate this except: err("Error retrieving bzr info; exiting.") if vcs =3D=3D "hg": - myunadded =3D os.popen("hg status --no-status --unknown .").readlines(= ) + with os.popen("hg status --no-status --unknown .") as f: + myunadded =3D f.readlines() myunadded =3D ["./" + elem.rstrip() for elem in myunadded] =09 # Mercurial doesn't handle manually deleted files as removed from # the repository, so the user need to remove them before commit, # using "hg remove [FILES]" - mydeleted =3D os.popen("hg status --no-status --deleted .").readlines(= ) + with os.popen("hg status --no-status --deleted .") as f: + mydeleted =3D f.readlines() mydeleted =3D ["./" + elem.rstrip() for elem in mydeleted] =20 =20 @@ -2310,28 +2324,37 @@ else: =20 =20 if vcs =3D=3D "svn": - svnstatus =3D os.popen("svn status").readlines() + with os.popen("svn status") as f: + svnstatus =3D f.readlines() mychanged =3D [ "./" + elem.split()[-1:][0] for elem in svnstatus if (= elem[:1] in "MR" or elem[1:2] in "M")] mynew =3D [ "./" + elem.split()[-1:][0] for elem in svnstatus if e= lem.startswith("A")] myremoved =3D [ "./" + elem.split()[-1:][0] for elem in svnstatus if e= lem.startswith("D")] =20 # Subversion expands keywords specified in svn:keywords properties. - props =3D os.popen("svn propget -R svn:keywords").readlines() + with os.popen("svn propget -R svn:keywords") as f: + props =3D f.readlines() expansion =3D dict(("./" + prop.split(" - ")[0], prop.split(" - ")[1].= split()) \ for prop in props if " - " in prop) =20 elif vcs =3D=3D "git": - mychanged =3D os.popen("git diff-index --name-only --relative --diff-f= ilter=3DM HEAD").readlines() + with os.popen("git diff-index --name-only " + "--relative --diff-filter=3DM HEAD") as f: + mychanged =3D f.readlines() mychanged =3D ["./" + elem[:-1] for elem in mychanged] =20 - mynew =3D os.popen("git diff-index --name-only --relative --diff-filte= r=3DA HEAD").readlines() + with os.popen("git diff-index --name-only " + "--relative --diff-filter=3DA HEAD") as f: + mynew =3D f.readlines() mynew =3D ["./" + elem[:-1] for elem in mynew] =20 - myremoved =3D os.popen("git diff-index --name-only --relative --diff-f= ilter=3DD HEAD").readlines() + with os.popen("git diff-index --name-only " + "--relative --diff-filter=3DD HEAD") as f: + myremoved =3D f.readlines() myremoved =3D ["./" + elem[:-1] for elem in myremoved] =20 if vcs =3D=3D "bzr": - bzrstatus =3D os.popen("bzr status -S .").readlines() + with os.popen("bzr status -S .") as f: + bzrstatus =3D f.readlines() mychanged =3D [ "./" + elem.split()[-1:][0].split('/')[-1:][0] for ele= m in bzrstatus if elem and elem[1:2] =3D=3D "M" ] mynew =3D [ "./" + elem.split()[-1:][0].split('/')[-1:][0] for ele= m in bzrstatus if elem and ( elem[1:2] in "NK" or elem[0:1] =3D=3D "R" ) = ] myremoved =3D [ "./" + elem.split()[-1:][0].split('/')[-1:][0] for ele= m in bzrstatus if elem.startswith("-") ] @@ -2339,11 +2362,16 @@ else: # Bazaar expands nothing. =20 if vcs =3D=3D "hg": - mychanged =3D os.popen("hg status --no-status --modified .").readlines= () + with os.popen("hg status --no-status --modified .") as f: + mychanged =3D f.readlines() mychanged =3D ["./" + elem.rstrip() for elem in mychanged] - mynew =3D os.popen("hg status --no-status --added .").readlines() + + with os.popen("hg status --no-status --added .") as f: + mynew =3D f.readlines() mynew =3D ["./" + elem.rstrip() for elem in mynew] - myremoved =3D os.popen("hg status --no-status --removed .").readlines(= ) + + with os.popen("hg status --no-status --removed .") as f: + myremoved =3D f.readlines() myremoved =3D ["./" + elem.rstrip() for elem in myremoved] =20 if vcs: