build: Upgrade scripts to Python 3 (many changes due to Ankit Deepak)

This commit is contained in:
Tom Henderson
2019-08-12 16:55:34 -07:00
parent 2b10629465
commit 0258405cc6
59 changed files with 79 additions and 69 deletions

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
import sys
import os.path
@@ -110,7 +110,7 @@ class PreScanHook:
## classes
if isinstance(pygccxml_definition, class_t):
print >> sys.stderr, pygccxml_definition
print(pygccxml_definition, file=sys.stderr)
# no need for helper classes to allow subclassing in Python, I think...
#if pygccxml_definition.name.endswith('Helper'):
# global_annotations['allow_subclassing'] = 'false'
@@ -199,7 +199,7 @@ class PreScanHook:
except KeyError:
pass
else:
for key,value in annotations.items():
for key,value in list(annotations.items()):
if key == 'params':
parameter_annotations.update (value)
del annotations['params']

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
import sys
import os.path

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
from __future__ import print_function
import sys
from optparse import OptionParser

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain

28
test.py
View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
#
# Copyright (c) 2009 University of Washington
@@ -16,7 +16,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
from __future__ import print_function
import os
import sys
import time
@@ -595,7 +594,18 @@ def sigint_hook(signal, frame):
# and use that result.
#
def read_waf_config():
for line in open(".lock-waf_" + sys.platform + "_build", "rt"):
f = None
try:
# sys.platform reports linux2 for python2 and linux for python3
f = open(".lock-waf_" + sys.platform + "_build", "rt")
except FileNotFoundError:
try:
f = open(".lock-waf_linux2_build", "rt")
except FileNotFoundError:
print('The .lock-waf ... directory was not found. You must do waf build before running test.py.', file=sys.stderr)
sys.exit(2)
for line in f:
if line.startswith("top_dir ="):
key, val = line.split('=')
top_dir = eval(val.strip())
@@ -1077,20 +1087,20 @@ def run_tests():
#
if options.kinds or options.list or (len(options.constrain) and options.constrain in core_kinds):
if sys.platform == "win32":
waf_cmd = sys.executable + " waf --target=test-runner"
waf_cmd = "./waf --target=test-runner"
else:
waf_cmd = sys.executable + " waf --target=test-runner"
waf_cmd = "./waf --target=test-runner"
elif len(options.example):
if sys.platform == "win32": #Modify for windows
waf_cmd = sys.executable + " waf --target=%s" % os.path.basename(options.example)
waf_cmd = "./waf --target=%s" % os.path.basename(options.example)
else:
waf_cmd = sys.executable + " waf --target=%s" % os.path.basename(options.example)
waf_cmd = "./waf --target=%s" % os.path.basename(options.example)
else:
if sys.platform == "win32": #Modify for windows
waf_cmd = sys.executable + " waf"
waf_cmd = "./waf"
else:
waf_cmd = sys.executable + " waf"
waf_cmd = "./waf"
if options.verbose:
print("Building: %s" % waf_cmd)

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
# These methods are used by test.py and waf to look for and read the
# .ns3rc configuration file, which is used to specify the modules that

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import os
import subprocess

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
import cairo

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
#
# Copyright (c) 2014 Siddharth Santurkar

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
#
# Copyright (c) 2014 Siddharth Santurkar

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
#
# Copyright (c) 2014 Siddharth Santurkar

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# encoding: utf-8
#
# partially based on boost.py written by Gernot Vormayr

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# encoding: utf-8
# Christoph Koke, 2013

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# encoding: utf-8
# Thomas Nagy, 2006-2010 (ita)

View File

@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
# encoding: utf-8
"""