Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame^] | 1 | From c0ba116eab401431b4f11b66bd7d1b42741b03c3 Mon Sep 17 00:00:00 2001 |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 2 | From: Jason Wessel <jason.wessel@windriver.com> |
| 3 | Date: Thu, 29 Jun 2017 20:33:23 -0700 |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame^] | 4 | Subject: [PATCH] Python3 compatibility: exception cleanup |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 5 | |
| 6 | Commit 52e4a477f0b3c0a0ece7adeede6e06e07814f8b9 from |
| 7 | https://github.com/openvswitch/ovs.git |
| 8 | |
| 9 | The exception syntax which is compatible with python2 and python3 is |
| 10 | to use the "as" form for "except:". |
| 11 | |
| 12 | Signed-off-by: Jason Wessel <jason.wessel@windriver.com> |
| 13 | Signed-off-by: Ben Pfaff <blp@ovn.org> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame^] | 14 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 15 | --- |
| 16 | build-aux/extract-ofp-fields | 2 +- |
| 17 | ovsdb/ovsdb-doc | 4 ++-- |
| 18 | ovsdb/ovsdb-idlc.in | 4 ++-- |
| 19 | 3 files changed, 5 insertions(+), 5 deletions(-) |
| 20 | |
| 21 | diff --git a/build-aux/extract-ofp-fields b/build-aux/extract-ofp-fields |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame^] | 22 | index 80c7d35..6286c9c 100755 |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 23 | --- a/build-aux/extract-ofp-fields |
| 24 | +++ b/build-aux/extract-ofp-fields |
| 25 | @@ -784,7 +784,7 @@ if __name__ == "__main__": |
| 26 | try: |
| 27 | options, args = getopt.gnu_getopt(sys.argv[1:], 'h', |
| 28 | ['help', 'ovs-version=']) |
| 29 | - except getopt.GetoptError, geo: |
| 30 | + except getopt.GetoptError as geo: |
| 31 | sys.stderr.write("%s: %s\n" % (argv0, geo.msg)) |
| 32 | sys.exit(1) |
| 33 | |
| 34 | diff --git a/ovsdb/ovsdb-doc b/ovsdb/ovsdb-doc |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame^] | 35 | index e82ad59..9448713 100755 |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 36 | --- a/ovsdb/ovsdb-doc |
| 37 | +++ b/ovsdb/ovsdb-doc |
| 38 | @@ -278,7 +278,7 @@ if __name__ == "__main__": |
| 39 | options, args = getopt.gnu_getopt(sys.argv[1:], 'hV', |
| 40 | ['er-diagram=', |
| 41 | 'version=', 'help']) |
| 42 | - except getopt.GetoptError, geo: |
| 43 | + except getopt.GetoptError as geo: |
| 44 | sys.stderr.write("%s: %s\n" % (argv0, geo.msg)) |
| 45 | sys.exit(1) |
| 46 | |
| 47 | @@ -306,7 +306,7 @@ if __name__ == "__main__": |
| 48 | if len(line): |
| 49 | print(line) |
| 50 | |
| 51 | - except error.Error, e: |
| 52 | + except error.Error as e: |
| 53 | sys.stderr.write("%s: %s\n" % (argv0, e.msg)) |
| 54 | sys.exit(1) |
| 55 | |
| 56 | diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame^] | 57 | index 62442ee..e7e1c6b 100755 |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 58 | --- a/ovsdb/ovsdb-idlc.in |
| 59 | +++ b/ovsdb/ovsdb-idlc.in |
| 60 | @@ -1098,7 +1098,7 @@ if __name__ == "__main__": |
| 61 | ['directory', |
| 62 | 'help', |
| 63 | 'version']) |
| 64 | - except getopt.GetoptError, geo: |
| 65 | + except getopt.GetoptError as geo: |
| 66 | sys.stderr.write("%s: %s\n" % (argv0, geo.msg)) |
| 67 | sys.exit(1) |
| 68 | |
| 69 | @@ -1136,7 +1136,7 @@ if __name__ == "__main__": |
| 70 | sys.exit(1) |
| 71 | |
| 72 | func(*args[1:]) |
| 73 | - except ovs.db.error.Error, e: |
| 74 | + except ovs.db.error.Error as e: |
| 75 | sys.stderr.write("%s: %s\n" % (argv0, e)) |
| 76 | sys.exit(1) |
| 77 | |