mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-23 14:44:28 +00:00
Build System: Enable python3 compatibility.
* Consistently use spaces in rest-api-templates/asterisk_processor.py. * Exclude third-party from docs/full-en_US.xml. * Add docs/full-en_US.xml to .gitignore. * Use list() to convert python3 view. * Use python3 print function. * Replace cmp() with equivalent equation. * Replace reference to out of scope subtype variable with name parameter. * Use unescaping triple bracket notation in mustache templates where needed. This causes behavior of Python2 to be maintained when using Python3. * Fix references to has_websocket / is_websocket in res_ari_resource.c.mustache. * Update calculation of has_websocket to use any(). * Use unicode mode for writing output file in transform.py. * Replace 'from swagger_model import *' with explicit import of required symbols. I have not tested spandspflow2pcap.py or voicemailpwcheck.py, only the print syntax has been fixed. Change-Id: If5c5b556a2800d41a3e2cfef080ac2e151178c33
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
Matt Jordan <mjordan@digium.com>
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
import os
|
||||
|
||||
@@ -35,8 +36,8 @@ def parse_line(line):
|
||||
"""
|
||||
tokens = line.strip().split(',', 7)
|
||||
if len(tokens) < 8:
|
||||
print "ERROR: ref debug line '%s' contains fewer tokens than " \
|
||||
"expected: %d" % (line.strip(), len(tokens))
|
||||
print("ERROR: ref debug line '%s' contains fewer tokens than "
|
||||
"expected: %d" % (line.strip(), len(tokens)))
|
||||
return None
|
||||
|
||||
processed_line = {'addr': tokens[0],
|
||||
@@ -142,7 +143,7 @@ def process_file(options):
|
||||
del current_objects[obj]
|
||||
|
||||
if options.leaks:
|
||||
for key, lines in current_objects.iteritems():
|
||||
for (key, lines) in current_objects.items():
|
||||
leaked_objects.append((key, lines))
|
||||
return (finished_objects, invalid_objects, leaked_objects, skewed_objects)
|
||||
|
||||
@@ -156,13 +157,13 @@ def print_objects(objects, prefix=""):
|
||||
this object
|
||||
"""
|
||||
|
||||
print "======== %s Objects ========" % prefix
|
||||
print "\n"
|
||||
print("======== %s Objects ========" % prefix)
|
||||
print("\n")
|
||||
for obj in objects:
|
||||
print "==== %s Object %s history ====" % (prefix, obj[0])
|
||||
print("==== %s Object %s history ====" % (prefix, obj[0]))
|
||||
for line in obj[1]['log']:
|
||||
print line
|
||||
print "\n"
|
||||
print(line)
|
||||
print("\n")
|
||||
|
||||
|
||||
def main(argv=None):
|
||||
@@ -198,11 +199,11 @@ def main(argv=None):
|
||||
|
||||
if not options.invalid and not options.leaks and not options.normal \
|
||||
and not options.skewed:
|
||||
print >>sys.stderr, "All options disabled"
|
||||
print("All options disabled", file=sys.stderr)
|
||||
return -1
|
||||
|
||||
if not os.path.isfile(options.filepath):
|
||||
print >>sys.stderr, "File not found: %s" % options.filepath
|
||||
print("File not found: %s" % options.filepath, file=sys.stderr)
|
||||
return -1
|
||||
|
||||
try:
|
||||
@@ -227,7 +228,7 @@ def main(argv=None):
|
||||
print_objects(finished_objects, "Finalized")
|
||||
|
||||
except (KeyboardInterrupt, SystemExit, IOError):
|
||||
print >>sys.stderr, "File processing cancelled"
|
||||
print("File processing cancelled", file=sys.stderr)
|
||||
return -1
|
||||
|
||||
return ret_code
|
||||
|
Reference in New Issue
Block a user