diff --git a/.travis.yml b/.travis.yml index 070c89ada..beed57551 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,7 +37,6 @@ python: - '3.5' - '3.4' - '3.3' - - '2.7' git: depth: 1000 before_install: @@ -81,7 +80,7 @@ deploy: skip_cleanup: true on: branch: master - python: 2.7 + python: 3.6 after_success: env: diff --git a/pyclient/pymtt.py b/pyclient/pymtt.py index 3e9492151..3c18f9f8f 100755 --- a/pyclient/pymtt.py +++ b/pyclient/pymtt.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2015-2018 Intel, Inc. All rights reserved. # Copyright (c) 2018 Cisco Systems, Inc. All rights reserved. @@ -9,9 +9,7 @@ # $HEADER$ # -from __future__ import print_function -from future import standard_library -standard_library.install_aliases() + import os import sys import configparser diff --git a/pylib/Stages/BIOS/BIOSMTTStage.py b/pylib/Stages/BIOS/BIOSMTTStage.py index 65ad73866..ff5ee9482 100644 --- a/pylib/Stages/BIOS/BIOSMTTStage.py +++ b/pylib/Stages/BIOS/BIOSMTTStage.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2015-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + from yapsy.IPlugin import IPlugin ## @addtogroup Stages diff --git a/pylib/Stages/Firmware/FirmwareMTTStage.py b/pylib/Stages/Firmware/FirmwareMTTStage.py index 10871ec85..576f39e4c 100644 --- a/pylib/Stages/Firmware/FirmwareMTTStage.py +++ b/pylib/Stages/Firmware/FirmwareMTTStage.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2015-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + from yapsy.IPlugin import IPlugin ## @addtogroup Stages diff --git a/pylib/Stages/Firmware/FooFlash.py b/pylib/Stages/Firmware/FooFlash.py index 68da27743..3a3ed4345 100644 --- a/pylib/Stages/Firmware/FooFlash.py +++ b/pylib/Stages/Firmware/FooFlash.py @@ -9,7 +9,7 @@ # -from __future__ import print_function + from FirmwareMTTStage import * ## @addtogroup Stages diff --git a/pylib/Stages/LauncherDefaults/LauncherDefaultsMTTStage.py b/pylib/Stages/LauncherDefaults/LauncherDefaultsMTTStage.py index 8e1bd8540..960d5606a 100644 --- a/pylib/Stages/LauncherDefaults/LauncherDefaultsMTTStage.py +++ b/pylib/Stages/LauncherDefaults/LauncherDefaultsMTTStage.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2015-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + from yapsy.IPlugin import IPlugin ## @addtogroup Stages diff --git a/pylib/Stages/MTTDefaults/DefaultMTTDefaults.py b/pylib/Stages/MTTDefaults/DefaultMTTDefaults.py index 826e48690..25481de48 100644 --- a/pylib/Stages/MTTDefaults/DefaultMTTDefaults.py +++ b/pylib/Stages/MTTDefaults/DefaultMTTDefaults.py @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + import os from MTTDefaultsMTTStage import * @@ -110,7 +110,7 @@ def execute(self, log, keyvals, testDef): # we need to record the results into our options so # subsequent sections can capture them - keys = cmds.keys() + keys = list(cmds.keys()) for key in keys: self.options[key] = (cmds[key], self.options[key][1]) return diff --git a/pylib/Stages/MTTDefaults/MTTDefaultsMTTStage.py b/pylib/Stages/MTTDefaults/MTTDefaultsMTTStage.py index be9a49463..07bb46522 100644 --- a/pylib/Stages/MTTDefaults/MTTDefaultsMTTStage.py +++ b/pylib/Stages/MTTDefaults/MTTDefaultsMTTStage.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2015-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + from yapsy.IPlugin import IPlugin ## @addtogroup Stages diff --git a/pylib/Stages/MiddlewareBuild/MiddlewareBuildMTTStage.py b/pylib/Stages/MiddlewareBuild/MiddlewareBuildMTTStage.py index 77ba3c727..67fa5d724 100644 --- a/pylib/Stages/MiddlewareBuild/MiddlewareBuildMTTStage.py +++ b/pylib/Stages/MiddlewareBuild/MiddlewareBuildMTTStage.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2015-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + from yapsy.IPlugin import IPlugin ## @addtogroup Stages diff --git a/pylib/Stages/MiddlewareGet/MiddlewareGetMTTStage.py b/pylib/Stages/MiddlewareGet/MiddlewareGetMTTStage.py index 6d11318ec..d58655bf8 100644 --- a/pylib/Stages/MiddlewareGet/MiddlewareGetMTTStage.py +++ b/pylib/Stages/MiddlewareGet/MiddlewareGetMTTStage.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2015-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + from yapsy.IPlugin import IPlugin ## @addtogroup Stages diff --git a/pylib/Stages/Profile/CheckProfile.py b/pylib/Stages/Profile/CheckProfile.py index 6471320b2..c525f5806 100644 --- a/pylib/Stages/Profile/CheckProfile.py +++ b/pylib/Stages/Profile/CheckProfile.py @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + import os from ProfileMTTStage import * from ast import literal_eval @@ -77,7 +77,7 @@ def execute(self, log, keyvals, testDef): testDef.parseOptions(log, self.options, keyvals, cmds) keys = list(cmds.keys()) - opts = self.options.keys() + opts = list(self.options.keys()) for key in keys: # diskSpace diff --git a/pylib/Stages/Profile/DefaultProfile.py b/pylib/Stages/Profile/DefaultProfile.py index 579ff2dfe..0b96738da 100644 --- a/pylib/Stages/Profile/DefaultProfile.py +++ b/pylib/Stages/Profile/DefaultProfile.py @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + import os from ProfileMTTStage import * diff --git a/pylib/Stages/Profile/ProfileMTTStage.py b/pylib/Stages/Profile/ProfileMTTStage.py index fda4010b3..8397537df 100644 --- a/pylib/Stages/Profile/ProfileMTTStage.py +++ b/pylib/Stages/Profile/ProfileMTTStage.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2016-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + from yapsy.IPlugin import IPlugin ## @addtogroup Stages diff --git a/pylib/Stages/Provisioning/ProvisionMTTStage.py b/pylib/Stages/Provisioning/ProvisionMTTStage.py index feee5f2c7..3b6f683d4 100644 --- a/pylib/Stages/Provisioning/ProvisionMTTStage.py +++ b/pylib/Stages/Provisioning/ProvisionMTTStage.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2015-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + from yapsy.IPlugin import IPlugin ## @addtogroup Stages diff --git a/pylib/Stages/Provisioning/WWulf3.py b/pylib/Stages/Provisioning/WWulf3.py index bc3725fae..64f0d14dd 100644 --- a/pylib/Stages/Provisioning/WWulf3.py +++ b/pylib/Stages/Provisioning/WWulf3.py @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + from ProvisionMTTStage import * import shlex diff --git a/pylib/Stages/Reporter/IUDatabase.py b/pylib/Stages/Reporter/IUDatabase.py index 30002d2d3..a1ec4309b 100644 --- a/pylib/Stages/Reporter/IUDatabase.py +++ b/pylib/Stages/Reporter/IUDatabase.py @@ -9,7 +9,7 @@ # $HEADER$ # -from __future__ import print_function + import os import pwd import requests @@ -379,7 +379,7 @@ def _submit_test_run(self, logger, lg, metadata, s, url, testDef, httpauth=None) for lgentry in logger.getLog(None): if 'environ' in lgentry: environment.update(lgentry['environ']) - data['environment'] = "\n".join([str(k) + "=" + str(v) for k,v in environment.items()]) + data['environment'] = "\n".join([str(k) + "=" + str(v) for k,v in list(environment.items())]) # BIOS table @@ -585,7 +585,7 @@ def _submit_test_build(self, logger, lg, metadata, s, url, httpauth=None): for lgentry in logger.getLog(None): if 'environ' in lgentry: environment.update(lgentry['environ']) - data['environment'] = "\n".join([str(k) + "=" + str(v) for k,v in environment.items()]) + data['environment'] = "\n".join([str(k) + "=" + str(v) for k,v in list(environment.items())]) try: if options['merge_stdout_stderr']: @@ -784,7 +784,7 @@ def _submit_install(self, logger, lg, metadata, s, url, httpauth=None): for lgentry in logger.getLog(None): if 'environ' in lgentry: environment.update(lgentry['environ']) - data['environment'] = "\n".join([str(k) + "=" + str(v) for k,v in environment.items()]) + data['environment'] = "\n".join([str(k) + "=" + str(v) for k,v in list(environment.items())]) try: if options is not None and options['merge_stdout_stderr']: diff --git a/pylib/Stages/Reporter/JunitXML.py b/pylib/Stages/Reporter/JunitXML.py index 2448db398..8e7043510 100644 --- a/pylib/Stages/Reporter/JunitXML.py +++ b/pylib/Stages/Reporter/JunitXML.py @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + import os import sys import re diff --git a/pylib/Stages/Reporter/ReporterMTTStage.py b/pylib/Stages/Reporter/ReporterMTTStage.py index 380671606..61521ea89 100644 --- a/pylib/Stages/Reporter/ReporterMTTStage.py +++ b/pylib/Stages/Reporter/ReporterMTTStage.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2015-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + from yapsy.IPlugin import IPlugin ## @addtogroup Stages diff --git a/pylib/Stages/Reporter/TextFile.py b/pylib/Stages/Reporter/TextFile.py index 0a1ae788b..6103c8b9d 100644 --- a/pylib/Stages/Reporter/TextFile.py +++ b/pylib/Stages/Reporter/TextFile.py @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + import os import sys from ReporterMTTStage import * diff --git a/pylib/Stages/TestBuild/DefaultTestBuild.py b/pylib/Stages/TestBuild/DefaultTestBuild.py index 30cef43a8..15831528c 100644 --- a/pylib/Stages/TestBuild/DefaultTestBuild.py +++ b/pylib/Stages/TestBuild/DefaultTestBuild.py @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + import os from TestBuildMTTStage import * diff --git a/pylib/Stages/TestBuild/TestBuildMTTStage.py b/pylib/Stages/TestBuild/TestBuildMTTStage.py index c5bb8575a..de66fde2e 100644 --- a/pylib/Stages/TestBuild/TestBuildMTTStage.py +++ b/pylib/Stages/TestBuild/TestBuildMTTStage.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2015-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + from yapsy.IPlugin import IPlugin ## @addtogroup Stages diff --git a/pylib/Stages/TestGet/TestGetMTTStage.py b/pylib/Stages/TestGet/TestGetMTTStage.py index 8a56bf673..8143aca78 100644 --- a/pylib/Stages/TestGet/TestGetMTTStage.py +++ b/pylib/Stages/TestGet/TestGetMTTStage.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2015-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + from yapsy.IPlugin import IPlugin ## @addtogroup Stages diff --git a/pylib/Stages/TestRun/PMIxUnit.py b/pylib/Stages/TestRun/PMIxUnit.py index 63b75524d..8b07a85b5 100644 --- a/pylib/Stages/TestRun/PMIxUnit.py +++ b/pylib/Stages/TestRun/PMIxUnit.py @@ -10,7 +10,7 @@ # $HEADER$ # -from __future__ import print_function + import os from TestRunMTTStage import * import shlex @@ -81,7 +81,7 @@ def execute(self, log, keyvals, testDef): # look for all keyvals starting with "test" as these # delineate the tests we are to run - keys = keyvals.keys() + keys = list(keyvals.keys()) tests = [] mykeyvals = {} for k in keys: diff --git a/pylib/Stages/TestRun/TestRunMTTStage.py b/pylib/Stages/TestRun/TestRunMTTStage.py index 98ce6abf6..814931bb4 100644 --- a/pylib/Stages/TestRun/TestRunMTTStage.py +++ b/pylib/Stages/TestRun/TestRunMTTStage.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2015-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + from yapsy.IPlugin import IPlugin ## @addtogroup Stages diff --git a/pylib/System/LoadClasses.py b/pylib/System/LoadClasses.py index 2cc4da0a4..e66f9a87d 100644 --- a/pylib/System/LoadClasses.py +++ b/pylib/System/LoadClasses.py @@ -1,4 +1,4 @@ -from __future__ import print_function + from builtins import object #!/usr/bin/env python # diff --git a/pylib/System/TestDef.py b/pylib/System/TestDef.py index 139f47d45..314aea479 100644 --- a/pylib/System/TestDef.py +++ b/pylib/System/TestDef.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2015-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ @@ -8,9 +8,7 @@ # $HEADER$ # -from __future__ import print_function -from future import standard_library -standard_library.install_aliases() + from builtins import range from builtins import object import os @@ -114,7 +112,7 @@ def __convert_value(self, opt, inval): return 0, False else: return 0, True - elif is_py2 and type(inval) is unicode: + elif is_py2 and type(inval) is str: if inval.lower() in ['true', '1', 't', 'y', 'yes']: return 0, True else: @@ -216,7 +214,7 @@ def parseOptions(self, log, options, keyvals, target): # been overridden - anything set by this input # stage will override the default if self.defaults is not None: - keys = self.defaults.options.keys() + keys = list(self.defaults.options.keys()) for key in keys: if key not in target: target[key] = self.defaults.options[key][0] @@ -530,7 +528,7 @@ def fill_log_interpolation(self, basestr, sublog): if isinstance(sublog, str): self.config.set("LOG", basestr, sublog.replace("$","$$")) elif isinstance(sublog, dict): - for k,v in sublog.items(): + for k,v in list(sublog.items()): self.fill_log_interpolation("%s.%s" % (basestr, k), v) elif isinstance(sublog, list): if sum([((isinstance(t, list) or isinstance(t, tuple)) and len(t) == 2) for t in sublog]) == len(sublog): @@ -589,7 +587,7 @@ def fill_env_hidden_section(self): self.config.add_section('ENV') except configparser.DuplicateSectionError: pass - for k,v in os.environ.items(): + for k,v in list(os.environ.items()): self.config.set('ENV', k, v.replace("$","$$")) def fill_log_hidden_section(self): @@ -613,7 +611,7 @@ def check_for_nondefined_env_variables(self): all_file_contents.append(file_contents) if "${ENV:" in file_contents: required_env.extend([s.split("}")[0] for s in file_contents.split("${ENV:")[1:]]) - env_not_found = set([e for e in required_env if e not in os.environ.keys()]) + env_not_found = set([e for e in required_env if e not in list(os.environ.keys())]) lines_with_env_not_found = [] for file_contents in all_file_contents: lines_with_env_not_found.extend(["%s: %s"%(",".join([e for e in env_not_found if "${ENV:%s}"%e in l]),l) \ diff --git a/pylib/System/test_TestDef.py b/pylib/System/test_TestDef.py index 12587af90..e1dec05c4 100644 --- a/pylib/System/test_TestDef.py +++ b/pylib/System/test_TestDef.py @@ -28,7 +28,7 @@ def test_expandWildCardsAtEnd(): print("--->to skip:", sections) expsections = td.expandWildCards(sections) assert 'Reporter:IUDatabase' in expsections - print("--->expanded:", expsections) + print("--->expanded:", expsections) def test_expandWildCardsAtBeginning(): td = setup() @@ -39,7 +39,7 @@ def test_expandWildCardsAtBeginning(): print("--->to skip:", sections) expsections = td.expandWildCards(sections) assert 'Reporter:IUDatabase' in expsections - print("--->expanded:", expsections) + print("--->expanded:", expsections) def test_expandWildCardsInMiddle(): td = setup() @@ -50,7 +50,7 @@ def test_expandWildCardsInMiddle(): print("--->to skip:", sections) expsections = td.expandWildCards(sections) assert 'Reporter:IUDatabase' in expsections - print("--->expanded:", expsections) + print("--->expanded:", expsections) def test_expandWildCardsInBigList(): td = setup() @@ -63,7 +63,7 @@ def test_expandWildCardsInBigList(): print("--->to skip:", sections) expsections = td.expandWildCards(sections) assert 'Reporter:IUDatabase' in expsections - print("--->expanded:", expsections) + print("--->expanded:", expsections) def test_expandWildCardsAtEndMultiple(): td = setup() @@ -76,7 +76,7 @@ def test_expandWildCardsAtEndMultiple(): print("--->to skip:", sections) expsections = td.expandWildCards(sections) assert 'Reporter:IUDatabase' in expsections and 'Reporter:TextFile' in expsections and 'Reporter:JSONFile' in expsections - print("--->expanded:", expsections) + print("--->expanded:", expsections) def test_expandWildCardsAtBeginningMultiple(): td = setup() @@ -89,7 +89,7 @@ def test_expandWildCardsAtBeginningMultiple(): print("--->to skip:", sections) expsections = td.expandWildCards(sections) assert 'Reporter:XMLFile' in expsections and 'Reporter:TextFile' in expsections and 'Reporter:JSONFile' in expsections - print("--->expanded:", expsections) + print("--->expanded:", expsections) def test_expandWildCardsInMiddleMultiple(): td = setup() @@ -102,7 +102,7 @@ def test_expandWildCardsInMiddleMultiple(): print("--->to skip:", sections) expsections = td.expandWildCards(sections) assert 'Reporter:XMLFile' in expsections and 'Reporter:TextFile' in expsections and 'Reporter:JSONFile' in expsections - print("--->expanded:", expsections) + print("--->expanded:", expsections) def test_expandWildCardsMultipleStars(): td = setup() @@ -115,7 +115,7 @@ def test_expandWildCardsMultipleStars(): print("--->to skip:", sections) expsections = td.expandWildCards(sections) assert 'Reporter:XMLFile' in expsections and 'Reporter:TextFile' in expsections and 'Reporter:JSONFile' in expsections - print("--->expanded:", expsections) + print("--->expanded:", expsections) def test_expandWildCardsStarsAtBeginning(): td = setup() @@ -127,8 +127,8 @@ def test_expandWildCardsStarsAtBeginning(): sections = ['*Reporter:TextFile'] print("--->to skip:", sections) expsections = td.expandWildCards(sections) - assert 'Reporter:TextFile' in expsections - print("--->expanded:", expsections) + assert 'Reporter:TextFile' in expsections + print("--->expanded:", expsections) def test_expandWildCardsStarsAtEnd(): td = setup() @@ -140,8 +140,8 @@ def test_expandWildCardsStarsAtEnd(): sections = ['Reporter:TextFile*'] print("--->to skip:", sections) expsections = td.expandWildCards(sections) - assert 'Reporter:TextFile' in expsections - print("--->expanded:", expsections) + assert 'Reporter:TextFile' in expsections + print("--->expanded:", expsections) # this fails #def test_expandWildCardsMultipleStarsInARow(): @@ -164,7 +164,7 @@ def test_expandWildCardsMultipleStarsInARow(): print("--->to skip:", sections) expsections = td.expandWildCards(sections) assert 'Reporter:TextFile' in expsections - print("--->expanded:", expsections) + print("--->expanded:", expsections) def test_expandWildCardsMultipleStarsInARowNoGaps(): td = setup() @@ -175,5 +175,5 @@ def test_expandWildCardsMultipleStarsInARowNoGaps(): print("--->to skip:", sections) expsections = td.expandWildCards(sections) assert 'Reporter:TextFile' in expsections - print("--->expanded:", expsections) + print("--->expanded:", expsections) diff --git a/pylib/Tools/Build/Autotools.py b/pylib/Tools/Build/Autotools.py index c3815ab20..dc206d684 100644 --- a/pylib/Tools/Build/Autotools.py +++ b/pylib/Tools/Build/Autotools.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2015-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + import os import re import string diff --git a/pylib/Tools/Build/BuildMTTTool.py b/pylib/Tools/Build/BuildMTTTool.py index 7e7ed89a7..054df6c40 100644 --- a/pylib/Tools/Build/BuildMTTTool.py +++ b/pylib/Tools/Build/BuildMTTTool.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2015-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + from yapsy.IPlugin import IPlugin ## @addtogroup Tools diff --git a/pylib/Tools/Build/Hostfile.py b/pylib/Tools/Build/Hostfile.py index ea0584491..2a10231cf 100644 --- a/pylib/Tools/Build/Hostfile.py +++ b/pylib/Tools/Build/Hostfile.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2015-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + import os import re from BuildMTTTool import * diff --git a/pylib/Tools/Build/Shell.py b/pylib/Tools/Build/Shell.py index cabe8f99e..38f5b5199 100644 --- a/pylib/Tools/Build/Shell.py +++ b/pylib/Tools/Build/Shell.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2015-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + import os import re import shlex diff --git a/pylib/Tools/CNC/CNCMTTTool.py b/pylib/Tools/CNC/CNCMTTTool.py index 1deb999bf..3ba712d62 100755 --- a/pylib/Tools/CNC/CNCMTTTool.py +++ b/pylib/Tools/CNC/CNCMTTTool.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2015-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + from yapsy.IPlugin import IPlugin ## @addtogroup Tools diff --git a/pylib/Tools/CNC/IPMITool.py b/pylib/Tools/CNC/IPMITool.py index 4a2a71c2a..346a5d67b 100644 --- a/pylib/Tools/CNC/IPMITool.py +++ b/pylib/Tools/CNC/IPMITool.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2016-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ @@ -11,7 +11,7 @@ import os import sys try: - from Queue import * + from queue import * except: from queue import * import threading @@ -185,7 +185,7 @@ def print_name(self): def print_options(self, testDef, prefix): lines = testDef.printOptions(self.options) for line in lines: - print(prefix + line) + print((prefix + line)) return def execute(self, log, keyvals, testDef): diff --git a/pylib/Tools/Executor/ExecutorMTTTool.py b/pylib/Tools/Executor/ExecutorMTTTool.py index 51c34ed72..5e294255a 100644 --- a/pylib/Tools/Executor/ExecutorMTTTool.py +++ b/pylib/Tools/Executor/ExecutorMTTTool.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2015-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + from yapsy.IPlugin import IPlugin ## @addtogroup Tools diff --git a/pylib/Tools/Executor/combinatorial.py b/pylib/Tools/Executor/combinatorial.py index 7904347fd..e6a36d1ce 100644 --- a/pylib/Tools/Executor/combinatorial.py +++ b/pylib/Tools/Executor/combinatorial.py @@ -8,9 +8,7 @@ # $HEADER$ # -from __future__ import print_function -from future import standard_library -standard_library.install_aliases() + import os import sys import configparser diff --git a/pylib/Tools/Executor/sequential.py b/pylib/Tools/Executor/sequential.py index 5f30afa66..a48f3595e 100755 --- a/pylib/Tools/Executor/sequential.py +++ b/pylib/Tools/Executor/sequential.py @@ -8,9 +8,7 @@ # $HEADER$ # -from __future__ import print_function -from future import standard_library -standard_library.install_aliases() + import os import sys import traceback @@ -23,10 +21,6 @@ from ExecutorMTTTool import * -try: - basestring -except: - basestring = str # Theory of Operation # @@ -291,9 +285,9 @@ def execute_sections(self, testDef): # Make sure stdout and stderr are properly formatted - if 'stdout' in stageLog and isinstance(stageLog['stdout'], basestring): + if 'stdout' in stageLog and isinstance(stageLog['stdout'], str): stageLog['stdout'] = stageLog['stdout'].split("\n") - if 'stderr' in stageLog and isinstance(stageLog['stderr'], basestring): + if 'stderr' in stageLog and isinstance(stageLog['stderr'], str): stageLog['stderr'] = stageLog['stderr'].split("\n") # Log results for section @@ -309,7 +303,7 @@ def execute_sections(self, testDef): except KeyError: pass sys.exit(1) - + # Set flag if any stage failed so that a return code can be passed back up if stageLog['status'] != 0: self.status = 1 @@ -390,7 +384,7 @@ def execute(self, testDef): testDef.watchdog.start(handler=self.durationTimeoutHandler, timeout=testDef.options['loop']) testDef.looping = True - + # Start harasser if testDef.options["harass_trigger_scripts"] is not None: diff --git a/pylib/Tools/Fetch/AlreadyInstalled.py b/pylib/Tools/Fetch/AlreadyInstalled.py index 6c6b28f9a..63258be83 100644 --- a/pylib/Tools/Fetch/AlreadyInstalled.py +++ b/pylib/Tools/Fetch/AlreadyInstalled.py @@ -9,7 +9,7 @@ # -from __future__ import print_function + from FetchMTTTool import * from distutils.spawn import find_executable diff --git a/pylib/Tools/Fetch/FetchMTTTool.py b/pylib/Tools/Fetch/FetchMTTTool.py index 193d69659..a3bbeb7f8 100644 --- a/pylib/Tools/Fetch/FetchMTTTool.py +++ b/pylib/Tools/Fetch/FetchMTTTool.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2015-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + from yapsy.IPlugin import IPlugin ## @addtogroup Tools diff --git a/pylib/Tools/Fetch/FetchRPM.py b/pylib/Tools/Fetch/FetchRPM.py index 3c3f4a99e..0e8e0bc45 100644 --- a/pylib/Tools/Fetch/FetchRPM.py +++ b/pylib/Tools/Fetch/FetchRPM.py @@ -10,9 +10,7 @@ # $HEADER$ # -from __future__ import print_function -from future import standard_library -standard_library.install_aliases() + import os from urllib.parse import urlparse from FetchMTTTool import * diff --git a/pylib/Tools/Fetch/FetchTarball.py b/pylib/Tools/Fetch/FetchTarball.py index 99e17109f..ac6808509 100644 --- a/pylib/Tools/Fetch/FetchTarball.py +++ b/pylib/Tools/Fetch/FetchTarball.py @@ -10,9 +10,7 @@ # $HEADER$ # -from __future__ import print_function -from future import standard_library -standard_library.install_aliases() + import os from urllib.parse import urlparse from FetchMTTTool import * diff --git a/pylib/Tools/Fetch/Git.py b/pylib/Tools/Fetch/Git.py index 614b49e45..a674e148c 100644 --- a/pylib/Tools/Fetch/Git.py +++ b/pylib/Tools/Fetch/Git.py @@ -10,9 +10,7 @@ # $HEADER$ # -from __future__ import print_function -from future import standard_library -standard_library.install_aliases() + import os, shutil from urllib.parse import urlparse from FetchMTTTool import * diff --git a/pylib/Tools/Fetch/OMPI_Snapshot.py b/pylib/Tools/Fetch/OMPI_Snapshot.py index 79af6bed8..3cfdc0373 100644 --- a/pylib/Tools/Fetch/OMPI_Snapshot.py +++ b/pylib/Tools/Fetch/OMPI_Snapshot.py @@ -10,9 +10,7 @@ # $HEADER$ # -from __future__ import print_function -from future import standard_library -standard_library.install_aliases() + import os from urllib.parse import urlparse from FetchMTTTool import * diff --git a/pylib/Tools/Fetch/Pip.py b/pylib/Tools/Fetch/Pip.py index 573cdd34f..4a35b3850 100644 --- a/pylib/Tools/Fetch/Pip.py +++ b/pylib/Tools/Fetch/Pip.py @@ -10,9 +10,7 @@ # $HEADER$ # -from __future__ import print_function -from future import standard_library -standard_library.install_aliases() + import os from urllib.parse import urlparse from FetchMTTTool import * diff --git a/pylib/Tools/Harasser/Harasser.py b/pylib/Tools/Harasser/Harasser.py index 6ac5209f4..f473ec3af 100644 --- a/pylib/Tools/Harasser/Harasser.py +++ b/pylib/Tools/Harasser/Harasser.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2015-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + import os import re from HarasserMTTTool import * @@ -62,7 +62,7 @@ def deactivate(self): self.activated = False if self.execution_counter > 0: self.testDef.logger.verbose_print("Harasser plugin stopped while harassers were running. Cleaning up harassers...") - self.stop(self.running_harassers.keys(), self.testDef) + self.stop(list(self.running_harassers.keys()), self.testDef) self.testDef.logger.verbose_print("Harassers were cleaned up.") return @@ -112,13 +112,13 @@ def start(self, testDef): (trigger_script if k == 'trigger_scripts' else (\ stop_script if k == 'stop_scripts' \ else v[0])) \ - for k,v in self.options.items()} + for k,v in list(self.options.items())} cmdargs = trigger_script.split() process = multiprocessing.Process(name='p'+str(self.execution_counter), \ target=self.parallel_execute, \ - args=({k:v[0] for k,v in self.options.items()},cmdargs,testDef)) + args=({k:v[0] for k,v in list(self.options.items())},cmdargs,testDef)) process.start() self.running_harassers[self.execution_counter] = (process, ops, datetime.datetime.now()) @@ -150,7 +150,7 @@ def stop(self, exec_ids, testDef): return_info = [] for process,ops,starttime in process_info: cmdargs = ops['stop_script'].split() - results = testDef.execmd.execute({k:v[0] for k,v in self.options.items()}, cmdargs, testDef) + results = testDef.execmd.execute({k:v[0] for k,v in list(self.options.items())}, cmdargs, testDef) return_info.append((results['status'],results['stdout'],results['stderr'],datetime.datetime.now()-starttime)) for (process,ops,starttime),(results['status'],results['stdout'],results['stderr'],results['elapsed_secs']) in zip(process_info,return_info): diff --git a/pylib/Tools/Harasser/HarasserMTTTool.py b/pylib/Tools/Harasser/HarasserMTTTool.py index 32c7fc3ed..8d97a5a70 100644 --- a/pylib/Tools/Harasser/HarasserMTTTool.py +++ b/pylib/Tools/Harasser/HarasserMTTTool.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2015-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + from yapsy.IPlugin import IPlugin ## @addtogroup Tools diff --git a/pylib/Tools/Launcher/ALPS.py b/pylib/Tools/Launcher/ALPS.py index 4c66e71b3..8fc04922f 100644 --- a/pylib/Tools/Launcher/ALPS.py +++ b/pylib/Tools/Launcher/ALPS.py @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + import os from LauncherMTTTool import * import shlex diff --git a/pylib/Tools/Launcher/LauncherMTTTool.py b/pylib/Tools/Launcher/LauncherMTTTool.py index 599f8591a..23626ca2f 100644 --- a/pylib/Tools/Launcher/LauncherMTTTool.py +++ b/pylib/Tools/Launcher/LauncherMTTTool.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2015-2019 Intel, Inc. All rights reserved. # Copyright (c) 2019 Triad National Security, LLC. All rights @@ -10,7 +10,7 @@ # $HEADER$ # -from __future__ import print_function + from yapsy.IPlugin import IPlugin import os diff --git a/pylib/Tools/Launcher/OpenMPI.py b/pylib/Tools/Launcher/OpenMPI.py index bec8ec627..a125336ea 100644 --- a/pylib/Tools/Launcher/OpenMPI.py +++ b/pylib/Tools/Launcher/OpenMPI.py @@ -10,7 +10,7 @@ # $HEADER$ # -from __future__ import print_function + import os from LauncherMTTTool import * import shlex diff --git a/pylib/Tools/Launcher/PRRTE.py b/pylib/Tools/Launcher/PRRTE.py index 5c84becfd..78819708b 100644 --- a/pylib/Tools/Launcher/PRRTE.py +++ b/pylib/Tools/Launcher/PRRTE.py @@ -10,7 +10,7 @@ # $HEADER$ # -from __future__ import print_function + import os, time from LauncherMTTTool import * import shlex diff --git a/pylib/Tools/Launcher/SLURM.py b/pylib/Tools/Launcher/SLURM.py index c86329dbd..bdef7a583 100644 --- a/pylib/Tools/Launcher/SLURM.py +++ b/pylib/Tools/Launcher/SLURM.py @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + import os from LauncherMTTTool import * import shlex diff --git a/pylib/Tools/Version/MTTVersionPlugin.py b/pylib/Tools/Version/MTTVersionPlugin.py index deee3ab5a..7e53f3220 100644 --- a/pylib/Tools/Version/MTTVersionPlugin.py +++ b/pylib/Tools/Version/MTTVersionPlugin.py @@ -9,7 +9,7 @@ # -from __future__ import print_function + from VersionMTTTool import * # Major and minor version number of the MTT diff --git a/pylib/Tools/Version/VersionMTTTool.py b/pylib/Tools/Version/VersionMTTTool.py index 2f122e410..58f176675 100644 --- a/pylib/Tools/Version/VersionMTTTool.py +++ b/pylib/Tools/Version/VersionMTTTool.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2015-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ diff --git a/pylib/Utilities/BaseMTTUtility.py b/pylib/Utilities/BaseMTTUtility.py index 41bd05a84..c1f9aa255 100644 --- a/pylib/Utilities/BaseMTTUtility.py +++ b/pylib/Utilities/BaseMTTUtility.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2015-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + from yapsy.IPlugin import IPlugin class BaseMTTUtility(IPlugin): diff --git a/pylib/Utilities/Compilers.py b/pylib/Utilities/Compilers.py index d4d37df1f..8fb9d7e5c 100644 --- a/pylib/Utilities/Compilers.py +++ b/pylib/Utilities/Compilers.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2016-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + import os from BaseMTTUtility import * diff --git a/pylib/Utilities/Copy.py b/pylib/Utilities/Copy.py index d794342c8..cdabfe72d 100644 --- a/pylib/Utilities/Copy.py +++ b/pylib/Utilities/Copy.py @@ -1,4 +1,4 @@ -from __future__ import print_function + from builtins import str #!/usr/bin/env python # @@ -17,6 +17,7 @@ from BaseMTTUtility import * from sys import version_info +import imp if version_info[0] == 3: if version_info[1] <= 3: from imp import reload @@ -83,7 +84,7 @@ def execute(self, log, keyvals, testDef): for src in cmds['src'].split(','): src = src.strip() # Clear the cache so that distutils.dir_util doesn't assume the same directory structure from last time things were copied - reload(distutils.dir_util) + imp.reload(distutils.dir_util) if os.path.isdir(src): # Distutils copy tree copies the contents of the directory into the target dir # Modify that to copy the directory diff --git a/pylib/Utilities/Copytree.py b/pylib/Utilities/Copytree.py index 1ab54ecc7..c16c50d66 100644 --- a/pylib/Utilities/Copytree.py +++ b/pylib/Utilities/Copytree.py @@ -1,4 +1,4 @@ -from __future__ import print_function + from builtins import str #!/usr/bin/env python # @@ -16,6 +16,7 @@ from BaseMTTUtility import * from sys import version_info +import imp if version_info[0] == 3: if version_info[1] <= 3: from imp import reload @@ -83,7 +84,7 @@ def execute(self, log, keyvals, testDef): os.mkdir(dst) for srcpath in cmds['src'].split(','): srcpath = srcpath.strip() - reload(distutils.dir_util) + imp.reload(distutils.dir_util) if cmds['preserve_directory'] != "0": subdst = os.path.join(dst,os.path.basename(srcpath)) while os.path.exists(subdst): diff --git a/pylib/Utilities/Environ.py b/pylib/Utilities/Environ.py index a246566db..d579e7137 100644 --- a/pylib/Utilities/Environ.py +++ b/pylib/Utilities/Environ.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2015-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + import shutil import os from BaseMTTUtility import * @@ -36,7 +36,7 @@ def execute(self, log, keyvals, testDef): testDef.logger.verbose_print("Environ Execute") # Set any provided key values - kvkeys = keyvals.keys() + kvkeys = list(keyvals.keys()) for kvkey in kvkeys: os.environ[kvkey] = keyvals[kvkey] log['status'] = 0 diff --git a/pylib/Utilities/ExecuteCmd.py b/pylib/Utilities/ExecuteCmd.py index da3dcc587..e115fb291 100644 --- a/pylib/Utilities/ExecuteCmd.py +++ b/pylib/Utilities/ExecuteCmd.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2015-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ @@ -8,7 +8,7 @@ # $HEADER$ # -from __future__ import print_function + from builtins import str import sys import select diff --git a/pylib/Utilities/Logger.py b/pylib/Utilities/Logger.py index db58eda72..9463ac7e3 100644 --- a/pylib/Utilities/Logger.py +++ b/pylib/Utilities/Logger.py @@ -1,4 +1,4 @@ -from __future__ import print_function + from builtins import str #!/usr/bin/env python # @@ -112,7 +112,7 @@ def open(self, testDef): return def get_dict_contents(self, dic): - return self.get_tuplelist_contents(dic.items()) + return self.get_tuplelist_contents(list(dic.items())) def get_tuplelist_contents(self, tuplelist): if not tuplelist: @@ -128,7 +128,7 @@ def log_to_elk(self, result, logtype): result = {k:(str(v) if isinstance(v, datetime.datetime) or isinstance(v, datetime.date) else v) - for k,v in result.items()} + for k,v in list(result.items())} result['execid'] = self.elk_id result['cycleid'] = self.elk_cycleid result['caseid'] = self.elk_caseid @@ -153,7 +153,7 @@ def log_to_elk(self, result, logtype): if 'profile' in result: # convert profile, list of lists into a dictionary - result['profile'] = { k:' '.join(v) for k,v in result['profile'].items() } + result['profile'] = { k:' '.join(v) for k,v in list(result['profile'].items()) } #self.verbose_print('Logging to elk_head={}/{}.elog: {}'.format(self.elk_head, self.elk_id, result)) if self.elk_log is None: diff --git a/pylib/Utilities/MPIVersion.py b/pylib/Utilities/MPIVersion.py index 6f4234d55..dc4e5c512 100644 --- a/pylib/Utilities/MPIVersion.py +++ b/pylib/Utilities/MPIVersion.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2016-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ diff --git a/pylib/Utilities/ModuleCmd.py b/pylib/Utilities/ModuleCmd.py index 8641aec1b..ee9860e1b 100644 --- a/pylib/Utilities/ModuleCmd.py +++ b/pylib/Utilities/ModuleCmd.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (c) 2015-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ @@ -8,9 +8,7 @@ # $HEADER$ # -from __future__ import print_function -from future import standard_library -standard_library.install_aliases() + import sys import select import os diff --git a/pylib/Utilities/Watchdog.py b/pylib/Utilities/Watchdog.py index 928175904..5fcc7b8b1 100644 --- a/pylib/Utilities/Watchdog.py +++ b/pylib/Utilities/Watchdog.py @@ -1,4 +1,4 @@ -from __future__ import print_function + from builtins import str #!/usr/bin/env python # @@ -107,7 +107,7 @@ def defaultHandler(self): def convert_to_timeout(self, timeout): if isinstance(timeout, int): return datetime.timedelta(0, timeout) - if isinstance(timeout, basestring): + if isinstance(timeout, str): timeparts = timeout.split(":") secs = 0 days = 0