]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_avmd, esl/python] Two build fixups (#611)
authorChristian Glombek <LorbusChris@users.noreply.github.com>
Wed, 24 Mar 2021 16:30:52 +0000 (17:30 +0100)
committerGitHub <noreply@github.com>
Wed, 24 Mar 2021 16:30:52 +0000 (19:30 +0300)
libs/esl/python/python-config
src/mod/applications/mod_avmd/mod_avmd.c

index 71699916f590596f9b83678a1310a956b26e8c42..1e60a8904705ae695333472658f66c1277787a55 100644 (file)
@@ -1,5 +1,6 @@
-#! /usr/bin/python2.5
+#!/usr/bin/env python
 
+from __future__ import print_function
 import sys
 import os
 import getopt
@@ -9,8 +10,7 @@ valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags',
               'ldflags', 'help']
 
 def exit_with_usage(code=1):
-    print >>sys.stderr, "Usage: %s [%s]" % (sys.argv[0], 
-                                            '|'.join('--'+opt for opt in valid_opts))
+    print("Usage: %s [%s]" % (sys.argv[0], '|'.join('--'+opt for opt in valid_opts)), file=sys.stderr)
     sys.exit(code)
 
 try:
@@ -30,17 +30,17 @@ if opt == '--help':
     exit_with_usage(0)
 
 elif opt == '--prefix':
-    print sysconfig.PREFIX
+    print(sysconfig.PREFIX)
 
 elif opt == '--exec-prefix':
-    print sysconfig.EXEC_PREFIX
+    print(sysconfig.EXEC_PREFIX)
 
 elif opt in ('--includes', '--cflags'):
     flags = ['-I' + sysconfig.get_python_inc(),
              '-I' + sysconfig.get_python_inc(plat_specific=True)]
     if opt == '--cflags':
         flags.extend(getvar('CFLAGS').split())
-    print ' '.join(flags)
+    print(' '.join(flags))
 
 elif opt in ('--libs', '--ldflags'):
     libs = getvar('LIBS').split() + getvar('SYSLIBS').split()
@@ -49,5 +49,5 @@ elif opt in ('--libs', '--ldflags'):
     # shared library in prefix/lib/.
     if opt == '--ldflags' and not getvar('Py_ENABLE_SHARED'):
         libs.insert(0, '-L' + getvar('LIBPL'))
-    print ' '.join(libs)
+    print(' '.join(libs))
 
index a7a59d928941351d3e070a09ca71857fcc730908..ea1c5f483aee449f6af2cd8637eff406a99197e3 100644 (file)
@@ -1343,8 +1343,10 @@ static switch_status_t avmd_parse_cmd_data(avmd_session_t *s, const char *cmd_da
                 switch_assert(argv[idx]);
                 status = avmd_parse_cmd_data_one_entry(argv[idx], &settings);
                 if (status != SWITCH_STATUS_SUCCESS) {
-                    switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_ERROR,
+                    if (argv[idx]) {
+                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_ERROR,
                             "Error parsing option [%d] [%s]\n", idx + 1, argv[idx]);    /* idx + 1 to report option 0 as 1 for users convenience */
+                    }
                     switch (status)
                     {
                         case SWITCH_STATUS_TERM: