def main(argv):
    fn = argv[1]
    with open(fn) as f:
        lines = f.readlines()
    properties = PropFile(lines)

    if fn.endswith('/build.prop'):
        mangle_build_prop(properties)
    elif fn.endswith('/default.prop'):
        mangle_default_prop(properties)
    else:
        sys.stderr.write("%s: Unsupported file: %s\n" % (os.path.realpath(__file__), fn))
        sys.exit(1)

    if not validate(properties):
        # the validate routine prints on error
        sys.exit(1)

    with open(fn, 'w+') as f:
        properties.write(f)
Ejemplo n.º 2
0
def main(argv):
    fn = argv[1]
    with open(fn) as f:
        lines = f.readlines()
    properties = PropFile(lines)

    if fn.endswith('/build.prop'):
        mangle_build_prop(properties)
    elif fn.endswith('/default.prop'):
        mangle_default_prop(properties)
    else:
        sys.stderr.write("%s: Unsupported file: %s\n" % (os.path.realpath(__file__), fn))
        sys.exit(1)

    if not validate(properties):
        # the validate routine prints on error
        sys.exit(1)

    with open(fn, 'w+') as f:
        properties.write(f)