From 4d1db9d738fa8d67c5de6f50b8b3359f9369c76c Mon Sep 17 00:00:00 2001 From: Jerome Kieffer Date: Wed, 30 Sep 2020 11:56:17 +0200 Subject: [PATCH] use Python3 for all developer tools --- bootstrap.py | 9 ++++----- run_tests.py | 16 +++++----------- version.py | 5 ++--- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/bootstrap.py b/bootstrap.py index 46b4731517..ff2b586e5b 100755 --- a/bootstrap.py +++ b/bootstrap.py @@ -1,5 +1,5 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 +# coding: utf8 """ Bootstrap helps you to test scripts without installing them by patching your PYTHONPATH on the fly @@ -10,8 +10,7 @@ __authors__ = ["Frédéric-Emmanuel Picca", "Jérôme Kieffer"] __contact__ = "jerome.kieffer@esrf.eu" __license__ = "MIT" -__date__ = "26/07/2018" - +__date__ = "30/09/2020" import argparse import distutils.util @@ -21,7 +20,6 @@ import sys import tempfile - logging.basicConfig() logger = logging.getLogger("bootstrap") @@ -69,6 +67,7 @@ def _get_available_scripts(path): if sys.version_info[0] >= 3: # Python3 + def execfile(fullpath, globals=None, locals=None): "Python3 implementation for execfile" with open(fullpath) as f: diff --git a/run_tests.py b/run_tests.py index 6007344313..5d3155add2 100755 --- a/run_tests.py +++ b/run_tests.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python -# coding: utf-8 +#!/usr/bin/env python3 +# coding: utf8 # /*########################################################################## # -# Copyright (c) 2015-2018 European Synchrotron Radiation Facility +# Copyright (c) 2015-2020 European Synchrotron Radiation Facility # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -32,7 +32,7 @@ """ __authors__ = ["Jérôme Kieffer", "Thomas Vincent"] -__date__ = "02/03/2018" +__date__ = "30/09/2020" __license__ = "MIT" import distutils.util @@ -87,7 +87,6 @@ def createBasicHandler(): logger.info("Python %s %s", sys.version, tuple.__itemsize__ * 8) - try: import resource except ImportError: @@ -98,6 +97,7 @@ def createBasicHandler(): import importlib importer = importlib.import_module except ImportError: + def importer(name): module = __import__(name) # returns the leaf module, instead of the root module @@ -107,7 +107,6 @@ def importer(name): module = getattr(module, subname) return module - try: import numpy except Exception as error: @@ -350,11 +349,9 @@ def get_test_options(project_module): PROJECT_VERSION = getattr(project_module, 'version', '') PROJECT_PATH = project_module.__path__[0] - test_options = get_test_options(project_module) """Contains extra configuration for the tests.""" - epilog = """Environment variables: WITH_QT_TEST=False to disable graphical tests SILX_OPENCL=False to disable OpenCL tests @@ -393,7 +390,6 @@ def get_test_options(project_module): options = parser.parse_args() sys.argv = [sys.argv[0]] - test_verbosity = 1 use_buffer = True if options.verbose == 1: @@ -467,7 +463,6 @@ def get_test_options(project_module): else: logger.warning("No test options available.") - if not options.test_name: # Do not use test loader to avoid cryptic exception # when an error occur during import @@ -487,7 +482,6 @@ def get_test_options(project_module): else: exit_status = 1 - if options.coverage: cov.stop() cov.save() diff --git a/version.py b/version.py index 5e7b08ac2f..9695ad96f4 100644 --- a/version.py +++ b/version.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # coding: utf-8 # /*########################################################################## # @@ -53,7 +53,7 @@ __authors__ = ["Jérôme Kieffer"] __license__ = "MIT" __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" -__date__ = "28/02/2018" +__date__ = "30/09/2020" __status__ = "production" __docformat__ = 'restructuredtext' __all__ = ["date", "version_info", "strictversion", "hexversion", "debianversion", @@ -115,6 +115,5 @@ def calc_hexversion(major=0, minor=0, micro=0, releaselevel="dev", serial=0): hexversion = calc_hexversion(*version_info) - if __name__ == "__main__": print(version)