From d3aa10fe409faeeb765c00c82fa6fc36dcfb2073 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 5 Nov 2007 06:16:16 +0000 Subject: Replace StringIO usage with a simple list of lines. The iteration interface is practically identical but the list of lines if more efficient because the lines only have to be split one time for each ebuild instead of for each check. svn path=/main/trunk/; revision=8428 --- bin/repoman | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'bin/repoman') diff --git a/bin/repoman b/bin/repoman index 27e6dfb11..5a5455bbd 100755 --- a/bin/repoman +++ b/bin/repoman @@ -52,11 +52,6 @@ except ImportError: from repoman.checks import EbuildWhitespace, EbuildHeader, EbuildQuote, \ EbuildAssignment, EbuildNestedDie, EbuildUselessDodoc, EbuildUselessCdS -try: - import cStringIO as StringIO -except ImportError: - import StringIO - import portage.checksum import portage.const import portage.dep @@ -1374,7 +1369,12 @@ for x in scanlist: # Syntax Checks path = checkdir + '/' + y + '.ebuild' myear = time.gmtime(os.stat(path)[ST_MTIME])[0] - contents = StringIO.StringIO(open(path, 'rb').read()) + f = open(path, 'rb') + try: + contents = f.readlines() + finally: + f.close() + del f for check in (EbuildWhitespace, EbuildQuote, EbuildAssignment, EbuildUselessDodoc, EbuildUselessCdS): c = check(contents) @@ -1382,14 +1382,12 @@ for x in scanlist: for e in errors: stats[c.repoman_check_name] += 1 fails[c.repoman_check_name].append(x + '/' + y + '.ebuild: %s' % e[1] % e[0]) - contents.seek(0) # move fp to the beginning of the StringIO Object del check check = EbuildHeader(contents, str(myear)) errors = check.Run() for e in errors: stats[check.repoman_check_name] += 1 fails[check.repoman_check_name].append(x + '/' + y + '.ebuild: %s' % e[1] % e[0]) - contents.seek(0) del check check = EbuildNestedDie(contents) errors = check.Run() -- cgit v1.2.3-1-g7c22