Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 1 | gconf: use python3 |
| 2 | |
| 3 | Convert gsettings-schema-convert to use python3. |
| 4 | |
| 5 | Upstream-Status: Inappropriate [gconf is deprecated] |
| 6 | |
| 7 | Signed-off-by: Joe Slater <joe.slater@windriver.com> |
| 8 | |
| 9 | |
| 10 | --- a/gsettings/gsettings-schema-convert |
| 11 | +++ b/gsettings/gsettings-schema-convert |
| 12 | @@ -1,4 +1,4 @@ |
| 13 | -#!/usr/bin/env python |
| 14 | +#!/usr/bin/env python3 |
| 15 | # vim: set ts=4 sw=4 et: coding=UTF-8 |
| 16 | # |
| 17 | # Copyright (c) 2010, Novell, Inc. |
| 18 | @@ -603,7 +603,7 @@ class SimpleSchemaParser: |
| 19 | for line in lines: |
| 20 | current_line_nb += 1 |
| 21 | self.parse_line(line) |
| 22 | - except GSettingsSchemaConvertException, e: |
| 23 | + except GSettingsSchemaConvertException as e: |
| 24 | raise GSettingsSchemaConvertException('%s:%s: %s' % (os.path.basename(self.file), current_line_nb, e)) |
| 25 | |
| 26 | return self.root |
| 27 | @@ -1095,7 +1095,7 @@ def main(args): |
| 28 | try: |
| 29 | parser = GConfSchemaParser(argfile, options.gettext_domain, options.schema_id, options.keep_underscores) |
| 30 | schema_root = parser.parse() |
| 31 | - except SyntaxError, e: |
| 32 | + except SyntaxError as e: |
| 33 | raise GSettingsSchemaConvertException('\'%s\' does not look like a valid gconf schema file: %s' % (argfile, e)) |
| 34 | else: |
| 35 | # autodetect if file is XML or not |
| 36 | @@ -1104,7 +1104,7 @@ def main(args): |
| 37 | schema_root = parser.parse() |
| 38 | if not options.simple and not options.xml: |
| 39 | options.simple = True |
| 40 | - except SyntaxError, e: |
| 41 | + except SyntaxError as e: |
| 42 | parser = SimpleSchemaParser(argfile) |
| 43 | schema_root = parser.parse() |
| 44 | if not options.simple and not options.xml: |
| 45 | @@ -1127,13 +1127,13 @@ def main(args): |
| 46 | fout = open(options.output, 'w') |
| 47 | fout.write(output) |
| 48 | fout.close() |
| 49 | - except GSettingsSchemaConvertException, e: |
| 50 | + except GSettingsSchemaConvertException as e: |
| 51 | fout.close() |
| 52 | if os.path.exists(options.output): |
| 53 | os.unlink(options.output) |
| 54 | raise e |
| 55 | |
| 56 | - except GSettingsSchemaConvertException, e: |
| 57 | + except GSettingsSchemaConvertException as e: |
| 58 | print >> sys.stderr, '%s' % e |
| 59 | return 1 |
| 60 | |