From 577484cd8898c4bbcf6178e4c2362e44c24a88f4 Mon Sep 17 00:00:00 2001 From: Marco Capetta Date: Thu, 29 Aug 2019 17:40:50 +0200 Subject: [PATCH] TT#64352 Switch from app-python to app-python3 Necessary because python2 is being removed from Debian, and is going to be EOL soon enough by python upstream Change-Id: I98d94cdfdac2d8ebc8d5a22130656d198433f5eb --- debian/control | 12 +-- debian/patches/series | 1 + .../switch_from_python2_to_python3.patch | 86 +++++++++++++++++++ 3 files changed, 93 insertions(+), 6 deletions(-) create mode 100644 debian/patches/sipwise/switch_from_python2_to_python3.patch diff --git a/debian/control b/debian/control index be975804d..f92f600aa 100644 --- a/debian/control +++ b/debian/control @@ -45,8 +45,8 @@ Build-Depends: ngcp-libtcap-dev, openssl, pkg-config, - python, - python-dev, + python3, + python3-dev, unixodbc-dev, uuid-dev, xsltproc, @@ -63,7 +63,7 @@ Pre-Depends: ${misc:Pre-Depends}, Depends: adduser, - python, + python3, ${misc:Depends}, ${shlibs:Depends}, Conflicts: @@ -245,19 +245,19 @@ Pre-Depends: ${misc:Pre-Depends}, Depends: ngcp-kamailio (= ${binary:Version}), - python-dev, + python3-dev, ${misc:Depends}, ${shlibs:Depends}, Conflicts: kamailio-python-modules, Replaces: kamailio-python-modules, -Description: contains the app_python module +Description: contains the app_python3 module Kamailio is a very fast and flexible SIP (RFC3261) proxy server. Written entirely in C, Kamailio can handle thousands calls per second even on low-budget hardware. . - This package provides the app_python module, an extension allowing to + This package provides the app_python3 module, an extension allowing to execute embedded Python applications within configuration file. Package: ngcp-kamailio-redis-modules diff --git a/debian/patches/series b/debian/patches/series index 4ccf69c45..7f561007d 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -53,3 +53,4 @@ sipwise/db_redis_master_sets.patch sipwise/db_redis_fixes.patch sipwise/sca-fix-memleaks.patch sipwise/presence_dfks_null_ptr_fixes.patch +sipwise/switch_from_python2_to_python3.patch diff --git a/debian/patches/sipwise/switch_from_python2_to_python3.patch b/debian/patches/sipwise/switch_from_python2_to_python3.patch new file mode 100644 index 000000000..f727f554c --- /dev/null +++ b/debian/patches/sipwise/switch_from_python2_to_python3.patch @@ -0,0 +1,86 @@ +--- a/utils/kamctl/dbtextdb/__init__.py ++++ b/utils/kamctl/dbtextdb/__init__.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/python ++#!/usr/bin/python3 + # + # Copyright 2008 Google Inc. All Rights Reserved. + +--- a/utils/kamctl/dbtextdb/dbtextdb.py ++++ b/utils/kamctl/dbtextdb/dbtextdb.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/python ++#!/usr/bin/python3 + # + # Copyright 2008 Google Inc. All Rights Reserved. + +@@ -27,7 +27,7 @@ else: + def Debug(msg): + """Debug print method.""" + if DEBUG: +- print msg ++ print(msg) + + + class DBText(object): +@@ -958,11 +958,11 @@ class DBText(object): + try: + if val: + val = eval(val) +- except NameError, e: ++ except NameError as e: + raise ExecuteError('Failed to parse %s in %s ' + '(unable to convert to type %s): %s' % + (col, self.table, self.header[col]['type'], e)) +- except SyntaxError, e: ++ except SyntaxError as e: + raise ExecuteError('Failed to parse %s in %s ' + '(unable to convert to type %s): %s' % + (col, self.table, self.header[col]['type'], e)) +@@ -1045,7 +1045,7 @@ class DBText(object): + self.data = self._GetData() + self.orig_data = self.data[:] # save a copy of the data before modifying + +- except IOError, e: ++ except IOError as e: + raise ExecuteError('Unable to open table %s: %s' % (self.table, e)) + + Debug('Header is: %s' % self.header) +@@ -1172,11 +1172,11 @@ class ExecuteError(Error): + def main(argv): + + if len(argv) < 2: +- print 'Usage %s query' % argv[0] ++ print('Usage %s query' % argv[0]) + sys.exit(1) + + if 'DBTEXT_PATH' not in os.environ or not os.environ['DBTEXT_PATH']: +- print 'DBTEXT_PATH must be set' ++ print('DBTEXT_PATH must be set') + sys.exit(1) + else: + location = os.environ['DBTEXT_PATH'] +@@ -1187,11 +1187,11 @@ def main(argv): + if dataset: + for row in dataset: + if conn.command != 'SELECT': +- print 'Updated %s, rows affected: %d' % (conn.table, row) ++ print('Updated %s, rows affected: %d' % (conn.table, row)) + else: +- print row +- except Error, e: +- print e ++ print(row) ++ except Error as e: ++ print(e) + sys.exit(1) + + +--- a/utils/kamctl/dbtextdb/dbtextdb_test.py ++++ b/utils/kamctl/dbtextdb/dbtextdb_test.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/python ++#!/usr/bin/python3 + # + # Copyright 2008 Google Inc. All Rights Reserved. +