def _read_header()

in xar/deprecated/mount_xar.py [0:0]


    def _read_header(self):
        self.attributes = {}
        fh = open(self.filename, "rb")
        try:
            header = fh.read(4096).split("\n")
            for line in header:
                if line == "#xar_stop":
                    break

                if line[0] == "#":
                    continue
                m = attr_re.match(line)
                if m:
                    self.attributes[m.group(1)] = m.group(2)
        finally:
            fh.close()

        for attr in required_attributes:
            if attr not in self.attributes:
                raise ValueError("Attribute %s missing from %s" % (attr, self.filename))

        self.version = int(self.attributes["VERSION"])
        # todo: handle dependencies, mount them, etc
        self.dependencies = []
        self.optional_dependencies = []