def main()

in android_sdk/PropertiesWriter.py [0:0]


    def main(self):
        cp = ConfigParser.SafeConfigParser()
        cp.optionxform = str

        sort = sorted(self.env["properties"].items(), key=lambda t: t[0])
        properties = OrderedDict(sort)

        for key, value in properties.iteritems():
            cp.set("", str(key), value)
        # Write the file out
        with open(self.env["file_path"], "wb") as f:
            try:
                cp.write(EqualsSpaceRemover(f))
            except IOError as err:
                raise ProcessorError(err)
        # Now delete the first line, the section header
        with open(self.env["file_path"], "rb") as old:
            lines = old.readlines()
        lines[0] = "# Generated by AutoPkg\n"
        with open(self.env["file_path"], "wb") as new:
            for line in lines:
                new.write(line)