summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-11-05 06:16:16 +0000
committerZac Medico <zmedico@gentoo.org>2007-11-05 06:16:16 +0000
commitd3aa10fe409faeeb765c00c82fa6fc36dcfb2073 (patch)
tree9812549e116a8594fe92f99c01d320ccc35be7fd
parent898a3ea077f154bd6dbce98f2240ab2b318d1b00 (diff)
downloadportage-d3aa10fe409faeeb765c00c82fa6fc36dcfb2073.tar.gz
portage-d3aa10fe409faeeb765c00c82fa6fc36dcfb2073.tar.bz2
portage-d3aa10fe409faeeb765c00c82fa6fc36dcfb2073.zip
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
-rwxr-xr-xbin/repoman14
1 files changed, 6 insertions, 8 deletions
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()