File: genschema.py

package info (click to toggle)
gsettings-desktop-schemas 3.22.0-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 6,836 kB
  • ctags: 214
  • sloc: sh: 728; python: 200; ansic: 170; makefile: 103
file content (25 lines) | stat: -rw-r--r-- 852 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Simple Python script to generate the full .schema.xml files

import os
import sys
import argparse

from replace import replace_multi

def main(argv):
    parser = argparse.ArgumentParser(description='Generate .schema.xml from its template.')
    parser.add_argument('-i', '--input', help='Input file', required=True)
    parser.add_argument('-o', '--output', help='Output file', required=True)
    parser.add_argument('--package', help='Package Name', required=True)
    parser.add_argument('--prefix', help='Installation Prefix', required=True)
    args = parser.parse_args()

    replace_items = {'@GETTEXT_PACKAGE@': args.package,
                     '@datadir@': '/' + args.prefix + '/share'}

    replace_multi(args.input,
                  args.output,
                  replace_items)

if __name__ == '__main__':
    sys.exit(main(sys.argv))