summaryrefslogtreecommitdiff
blob: de99f3b9cf7d01a59c9a964ce757978889320ed1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#we use this class to easily read the PACKAGES file
#an empty line denotes a new package, but readline() usually
#doesn't return empty lines
class EmptyLinesFile:
    def __init__(self,myfile):
        self.file=myfile
        self.eof=False
        self.lines=self.generate_lines()
    def generate_lines(self,size=-1):
        for line in self.file:
            yield line
        self.eof=True
    def readline(self):
        try:
            return self.lines.next()
        except StopIteration:
            return ''