From 0258405cc6acd751f545cbab597cf1bcd5382b79 Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Mon, 12 Aug 2019 16:55:34 -0700 Subject: [PATCH] build: Upgrade scripts to Python 3 (many changes due to Ankit Deepak) --- bindings/python/ns3modulescan-modular.py | 6 ++-- bindings/python/ns3modulescan.py | 2 +- examples/energy/examples-to-run.py | 2 +- examples/error-model/examples-to-run.py | 2 +- examples/ipv6/examples-to-run.py | 2 +- examples/naming/examples-to-run.py | 2 +- examples/realtime/examples-to-run.py | 2 +- examples/routing/examples-to-run.py | 2 +- examples/stats/examples-to-run.py | 2 +- examples/tcp/examples-to-run.py | 2 +- examples/traffic-control/examples-to-run.py | 2 +- examples/tutorial/examples-to-run.py | 2 +- examples/udp/examples-to-run.py | 2 +- examples/wireless/examples-to-run.py | 2 +- src/aodv/test/examples-to-run.py | 2 +- src/bridge/test/examples-to-run.py | 2 +- src/brite/test/examples-to-run.py | 2 +- src/buildings/test/examples-to-run.py | 2 +- src/click/test/examples-to-run.py | 2 +- src/config-store/test/examples-to-run.py | 2 +- src/core/test/examples-to-run.py | 2 +- src/create-module.py | 2 +- src/csma/test/examples-to-run.py | 2 +- src/energy/test/examples-to-run.py | 2 +- src/fd-net-device/test/examples-to-run.py | 2 +- src/flow-monitor/test/examples-to-run.py | 2 +- src/internet/test/examples-to-run.py | 2 +- src/lr-wpan/test/examples-to-run.py | 2 +- src/lte/test/examples-to-run.py | 2 +- src/mesh/test/examples-to-run.py | 2 +- src/mobility/test/examples-to-run.py | 2 +- src/netanim/test/examples-to-run.py | 2 +- src/network/test/examples-to-run.py | 2 +- .../test/examples-to-run.py | 2 +- src/olsr/test/examples-to-run.py | 2 +- src/openflow/test/examples-to-run.py | 2 +- src/point-to-point/test/examples-to-run.py | 2 +- src/propagation/test/examples-to-run.py | 2 +- src/spectrum/test/examples-to-run.py | 2 +- src/stats/test/examples-to-run.py | 2 +- src/tap-bridge/test/examples-to-run.py | 2 +- src/topology-read/test/examples-to-run.py | 2 +- src/traffic-control/test/examples-to-run.py | 2 +- src/uan/test/examples-to-run.py | 2 +- .../test/examples-to-run.py | 2 +- src/wave/test/examples-to-run.py | 2 +- src/wifi/test/examples-to-run.py | 2 +- src/wimax/test/examples-to-run.py | 2 +- test.py | 28 +++++++++++++------ utils.py | 2 +- utils/check-style.py | 2 +- utils/grid.py | 2 +- utils/tests/TestBase.py | 2 +- utils/tests/test-test.py | 2 +- utils/tests/test-waf.py | 2 +- waf-tools/boost.py | 2 +- waf-tools/clang_compilation_database.py | 2 +- waf-tools/misc.py | 2 +- waf-tools/relocation.py | 2 +- 59 files changed, 79 insertions(+), 69 deletions(-) diff --git a/bindings/python/ns3modulescan-modular.py b/bindings/python/ns3modulescan-modular.py index e8b67df26..5e5bee5da 100644 --- a/bindings/python/ns3modulescan-modular.py +++ b/bindings/python/ns3modulescan-modular.py @@ -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'] diff --git a/bindings/python/ns3modulescan.py b/bindings/python/ns3modulescan.py index 316267734..f69f287fa 100644 --- a/bindings/python/ns3modulescan.py +++ b/bindings/python/ns3modulescan.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 import sys import os.path diff --git a/examples/energy/examples-to-run.py b/examples/energy/examples-to-run.py index deb7fcc3d..20dc70007 100644 --- a/examples/energy/examples-to-run.py +++ b/examples/energy/examples-to-run.py @@ -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 diff --git a/examples/error-model/examples-to-run.py b/examples/error-model/examples-to-run.py index 81c72c95d..19b3ec789 100644 --- a/examples/error-model/examples-to-run.py +++ b/examples/error-model/examples-to-run.py @@ -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 diff --git a/examples/ipv6/examples-to-run.py b/examples/ipv6/examples-to-run.py index aa0d54593..e2a5317cc 100644 --- a/examples/ipv6/examples-to-run.py +++ b/examples/ipv6/examples-to-run.py @@ -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 diff --git a/examples/naming/examples-to-run.py b/examples/naming/examples-to-run.py index 6e748c820..7c468cae9 100644 --- a/examples/naming/examples-to-run.py +++ b/examples/naming/examples-to-run.py @@ -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 diff --git a/examples/realtime/examples-to-run.py b/examples/realtime/examples-to-run.py index 03bf39217..6d94ea760 100644 --- a/examples/realtime/examples-to-run.py +++ b/examples/realtime/examples-to-run.py @@ -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 diff --git a/examples/routing/examples-to-run.py b/examples/routing/examples-to-run.py index 9569cd552..cdaf08ba4 100644 --- a/examples/routing/examples-to-run.py +++ b/examples/routing/examples-to-run.py @@ -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 diff --git a/examples/stats/examples-to-run.py b/examples/stats/examples-to-run.py index 7ee30700e..929f1c418 100644 --- a/examples/stats/examples-to-run.py +++ b/examples/stats/examples-to-run.py @@ -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 diff --git a/examples/tcp/examples-to-run.py b/examples/tcp/examples-to-run.py index d22490362..ae6de0fee 100644 --- a/examples/tcp/examples-to-run.py +++ b/examples/tcp/examples-to-run.py @@ -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 diff --git a/examples/traffic-control/examples-to-run.py b/examples/traffic-control/examples-to-run.py index 9399fb317..9ec71d6b8 100755 --- a/examples/traffic-control/examples-to-run.py +++ b/examples/traffic-control/examples-to-run.py @@ -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 diff --git a/examples/tutorial/examples-to-run.py b/examples/tutorial/examples-to-run.py index d6fa3a232..7461e8cc0 100644 --- a/examples/tutorial/examples-to-run.py +++ b/examples/tutorial/examples-to-run.py @@ -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 diff --git a/examples/udp/examples-to-run.py b/examples/udp/examples-to-run.py index 7997cfadb..bd29fcd67 100644 --- a/examples/udp/examples-to-run.py +++ b/examples/udp/examples-to-run.py @@ -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 diff --git a/examples/wireless/examples-to-run.py b/examples/wireless/examples-to-run.py index db8c24bc4..008b63a27 100755 --- a/examples/wireless/examples-to-run.py +++ b/examples/wireless/examples-to-run.py @@ -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 diff --git a/src/aodv/test/examples-to-run.py b/src/aodv/test/examples-to-run.py index 066683cfc..05d689e44 100644 --- a/src/aodv/test/examples-to-run.py +++ b/src/aodv/test/examples-to-run.py @@ -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 diff --git a/src/bridge/test/examples-to-run.py b/src/bridge/test/examples-to-run.py index 9c82c126a..e4ad040ee 100644 --- a/src/bridge/test/examples-to-run.py +++ b/src/bridge/test/examples-to-run.py @@ -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 diff --git a/src/brite/test/examples-to-run.py b/src/brite/test/examples-to-run.py index 7dee389cf..5197de2ea 100644 --- a/src/brite/test/examples-to-run.py +++ b/src/brite/test/examples-to-run.py @@ -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 diff --git a/src/buildings/test/examples-to-run.py b/src/buildings/test/examples-to-run.py index 0af57a19f..96d77d7a2 100644 --- a/src/buildings/test/examples-to-run.py +++ b/src/buildings/test/examples-to-run.py @@ -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; -*- diff --git a/src/click/test/examples-to-run.py b/src/click/test/examples-to-run.py index cc7330e01..e5f2e74a4 100644 --- a/src/click/test/examples-to-run.py +++ b/src/click/test/examples-to-run.py @@ -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 diff --git a/src/config-store/test/examples-to-run.py b/src/config-store/test/examples-to-run.py index 6eeae4d1d..80064ee8c 100644 --- a/src/config-store/test/examples-to-run.py +++ b/src/config-store/test/examples-to-run.py @@ -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 diff --git a/src/core/test/examples-to-run.py b/src/core/test/examples-to-run.py index 4a3ae6b3d..f3befa574 100644 --- a/src/core/test/examples-to-run.py +++ b/src/core/test/examples-to-run.py @@ -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 diff --git a/src/create-module.py b/src/create-module.py index 0e0de9dc1..1d19f21c9 100755 --- a/src/create-module.py +++ b/src/create-module.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 from __future__ import print_function import sys from optparse import OptionParser diff --git a/src/csma/test/examples-to-run.py b/src/csma/test/examples-to-run.py index 909251f3c..eba7b5b77 100644 --- a/src/csma/test/examples-to-run.py +++ b/src/csma/test/examples-to-run.py @@ -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 diff --git a/src/energy/test/examples-to-run.py b/src/energy/test/examples-to-run.py index 1cba3c38d..0b49ab771 100644 --- a/src/energy/test/examples-to-run.py +++ b/src/energy/test/examples-to-run.py @@ -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 diff --git a/src/fd-net-device/test/examples-to-run.py b/src/fd-net-device/test/examples-to-run.py index 07af236d8..92e76667b 100644 --- a/src/fd-net-device/test/examples-to-run.py +++ b/src/fd-net-device/test/examples-to-run.py @@ -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 diff --git a/src/flow-monitor/test/examples-to-run.py b/src/flow-monitor/test/examples-to-run.py index a00bc7b9c..7e5c82378 100644 --- a/src/flow-monitor/test/examples-to-run.py +++ b/src/flow-monitor/test/examples-to-run.py @@ -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 diff --git a/src/internet/test/examples-to-run.py b/src/internet/test/examples-to-run.py index 9fafb8ba9..1266e93c1 100644 --- a/src/internet/test/examples-to-run.py +++ b/src/internet/test/examples-to-run.py @@ -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 diff --git a/src/lr-wpan/test/examples-to-run.py b/src/lr-wpan/test/examples-to-run.py index 0b3425959..37b397052 100644 --- a/src/lr-wpan/test/examples-to-run.py +++ b/src/lr-wpan/test/examples-to-run.py @@ -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 diff --git a/src/lte/test/examples-to-run.py b/src/lte/test/examples-to-run.py index 02378da09..64083818c 100644 --- a/src/lte/test/examples-to-run.py +++ b/src/lte/test/examples-to-run.py @@ -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; -*- diff --git a/src/mesh/test/examples-to-run.py b/src/mesh/test/examples-to-run.py index 3677c2243..c8c748908 100644 --- a/src/mesh/test/examples-to-run.py +++ b/src/mesh/test/examples-to-run.py @@ -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 diff --git a/src/mobility/test/examples-to-run.py b/src/mobility/test/examples-to-run.py index d7c34d0c4..7049d7f97 100644 --- a/src/mobility/test/examples-to-run.py +++ b/src/mobility/test/examples-to-run.py @@ -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 diff --git a/src/netanim/test/examples-to-run.py b/src/netanim/test/examples-to-run.py index 4040536bc..97acdda38 100644 --- a/src/netanim/test/examples-to-run.py +++ b/src/netanim/test/examples-to-run.py @@ -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 diff --git a/src/network/test/examples-to-run.py b/src/network/test/examples-to-run.py index a9647ae79..7240e6775 100644 --- a/src/network/test/examples-to-run.py +++ b/src/network/test/examples-to-run.py @@ -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 diff --git a/src/nix-vector-routing/test/examples-to-run.py b/src/nix-vector-routing/test/examples-to-run.py index 0501c6a8c..4887b7b57 100644 --- a/src/nix-vector-routing/test/examples-to-run.py +++ b/src/nix-vector-routing/test/examples-to-run.py @@ -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 diff --git a/src/olsr/test/examples-to-run.py b/src/olsr/test/examples-to-run.py index 1a7c068a0..8a3e05605 100644 --- a/src/olsr/test/examples-to-run.py +++ b/src/olsr/test/examples-to-run.py @@ -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 diff --git a/src/openflow/test/examples-to-run.py b/src/openflow/test/examples-to-run.py index 2e74d7294..3c1bd7d8f 100644 --- a/src/openflow/test/examples-to-run.py +++ b/src/openflow/test/examples-to-run.py @@ -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 diff --git a/src/point-to-point/test/examples-to-run.py b/src/point-to-point/test/examples-to-run.py index c2c4a0170..82b9a75b8 100644 --- a/src/point-to-point/test/examples-to-run.py +++ b/src/point-to-point/test/examples-to-run.py @@ -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 diff --git a/src/propagation/test/examples-to-run.py b/src/propagation/test/examples-to-run.py index 7eb5a7809..1d2fcd9dc 100644 --- a/src/propagation/test/examples-to-run.py +++ b/src/propagation/test/examples-to-run.py @@ -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 diff --git a/src/spectrum/test/examples-to-run.py b/src/spectrum/test/examples-to-run.py index 879354120..421091f6e 100644 --- a/src/spectrum/test/examples-to-run.py +++ b/src/spectrum/test/examples-to-run.py @@ -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 diff --git a/src/stats/test/examples-to-run.py b/src/stats/test/examples-to-run.py index da4c69777..a25366908 100644 --- a/src/stats/test/examples-to-run.py +++ b/src/stats/test/examples-to-run.py @@ -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 diff --git a/src/tap-bridge/test/examples-to-run.py b/src/tap-bridge/test/examples-to-run.py index a0443ffba..b34d80642 100644 --- a/src/tap-bridge/test/examples-to-run.py +++ b/src/tap-bridge/test/examples-to-run.py @@ -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 diff --git a/src/topology-read/test/examples-to-run.py b/src/topology-read/test/examples-to-run.py index b75799ae3..289857966 100644 --- a/src/topology-read/test/examples-to-run.py +++ b/src/topology-read/test/examples-to-run.py @@ -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 diff --git a/src/traffic-control/test/examples-to-run.py b/src/traffic-control/test/examples-to-run.py index e81bad598..95e2d021a 100644 --- a/src/traffic-control/test/examples-to-run.py +++ b/src/traffic-control/test/examples-to-run.py @@ -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 diff --git a/src/uan/test/examples-to-run.py b/src/uan/test/examples-to-run.py index 54fc07c6d..973e5b5b6 100644 --- a/src/uan/test/examples-to-run.py +++ b/src/uan/test/examples-to-run.py @@ -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 diff --git a/src/virtual-net-device/test/examples-to-run.py b/src/virtual-net-device/test/examples-to-run.py index 0bafb8e18..34948a3e2 100644 --- a/src/virtual-net-device/test/examples-to-run.py +++ b/src/virtual-net-device/test/examples-to-run.py @@ -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 diff --git a/src/wave/test/examples-to-run.py b/src/wave/test/examples-to-run.py index 68d81ee10..859df265c 100644 --- a/src/wave/test/examples-to-run.py +++ b/src/wave/test/examples-to-run.py @@ -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 diff --git a/src/wifi/test/examples-to-run.py b/src/wifi/test/examples-to-run.py index 7918d43d4..d410e9753 100644 --- a/src/wifi/test/examples-to-run.py +++ b/src/wifi/test/examples-to-run.py @@ -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 diff --git a/src/wimax/test/examples-to-run.py b/src/wimax/test/examples-to-run.py index e65797719..f576a3a27 100644 --- a/src/wimax/test/examples-to-run.py +++ b/src/wimax/test/examples-to-run.py @@ -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 diff --git a/test.py b/test.py index a21befe20..809f39417 100755 --- a/test.py +++ b/test.py @@ -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) diff --git a/utils.py b/utils.py index 5c79d28eb..1bce10681 100644 --- a/utils.py +++ b/utils.py @@ -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 diff --git a/utils/check-style.py b/utils/check-style.py index 15d0f2e30..80b6b2c8a 100755 --- a/utils/check-style.py +++ b/utils/check-style.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import os import subprocess diff --git a/utils/grid.py b/utils/grid.py index 58d7f7b66..4c073df00 100644 --- a/utils/grid.py +++ b/utils/grid.py @@ -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 diff --git a/utils/tests/TestBase.py b/utils/tests/TestBase.py index 1cacbc5b0..ce870d851 100644 --- a/utils/tests/TestBase.py +++ b/utils/tests/TestBase.py @@ -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 diff --git a/utils/tests/test-test.py b/utils/tests/test-test.py index c7f668df6..76f36fa0b 100644 --- a/utils/tests/test-test.py +++ b/utils/tests/test-test.py @@ -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 diff --git a/utils/tests/test-waf.py b/utils/tests/test-waf.py index ed8adad3c..f8345ff71 100644 --- a/utils/tests/test-waf.py +++ b/utils/tests/test-waf.py @@ -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 diff --git a/waf-tools/boost.py b/waf-tools/boost.py index d3c486906..a8b433fef 100644 --- a/waf-tools/boost.py +++ b/waf-tools/boost.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # encoding: utf-8 # # partially based on boost.py written by Gernot Vormayr diff --git a/waf-tools/clang_compilation_database.py b/waf-tools/clang_compilation_database.py index 53e637a20..8d0c42f79 100644 --- a/waf-tools/clang_compilation_database.py +++ b/waf-tools/clang_compilation_database.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # encoding: utf-8 # Christoph Koke, 2013 diff --git a/waf-tools/misc.py b/waf-tools/misc.py index 6c53dd861..dd4f0e782 100644 --- a/waf-tools/misc.py +++ b/waf-tools/misc.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # encoding: utf-8 # Thomas Nagy, 2006-2010 (ita) diff --git a/waf-tools/relocation.py b/waf-tools/relocation.py index 11f3d9cb9..2adf3b0aa 100644 --- a/waf-tools/relocation.py +++ b/waf-tools/relocation.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 # encoding: utf-8 """