Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stop importing from deprecated easybuild.tools.py2vs3 module + stop testing with Python 2.7 and 3.5 #2916

Merged
merged 4 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 3 additions & 9 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,19 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, '3.10', '3.11']
python: [3.6, 3.7, 3.8, 3.9, '3.10', '3.11']
modules_tool: [Lmod-6.6.3, Lmod-7.8.22, Lmod-8.1.14, modules-tcl-1.147, modules-3.2.10, modules-4.1.4]
module_syntax: [Lua, Tcl]
# exclude some configuration for non-Lmod modules tool:
# - don't test with Lua module syntax (only supported in Lmod)
# - don't test with Python 3.5 and 3.7+ (only with 2.7 and 3.6), to limit test configurations
# - don't test with Python 3.7+ (only with 3.6), to limit test configurations
exclude:
- modules_tool: modules-tcl-1.147
module_syntax: Lua
- modules_tool: modules-3.2.10
module_syntax: Lua
- modules_tool: modules-4.1.4
module_syntax: Lua
- modules_tool: modules-tcl-1.147
python: 3.5
- modules_tool: modules-tcl-1.147
python: 3.7
- modules_tool: modules-tcl-1.147
Expand All @@ -36,8 +34,6 @@ jobs:
python: 3.9
- modules_tool: modules-tcl-1.147
python: '3.10'
- modules_tool: modules-3.2.10
python: 3.5
- modules_tool: modules-3.2.10
python: 3.7
- modules_tool: modules-3.2.10
Expand All @@ -46,8 +42,6 @@ jobs:
python: 3.9
- modules_tool: modules-3.2.10
python: '3.10'
- modules_tool: modules-4.1.4
python: 3.5
- modules_tool: modules-4.1.4
python: 3.7
- modules_tool: modules-4.1.4
Expand Down Expand Up @@ -86,7 +80,7 @@ jobs:
# first determine which branch of easybuild-framework repo to install
BRANCH=develop
if [ "x$GITHUB_BASE_REF" = 'xmain' ]; then BRANCH=main; fi
if [ "x$GITHUB_BASE_REF" = 'x4.x' ]; then BRANCH=4.x; fi
if [ "x$GITHUB_BASE_REF" = 'x5.0.x' ]; then BRANCH=5.0.x; fi
echo "Using easybuild-framework branch $BRANCH (\$GITHUB_BASE_REF $GITHUB_BASE_REF)"
git clone -b $BRANCH --depth 10 --single-branch https://github.com/easybuilders/easybuild-framework.git
cd easybuild-framework; git log -n 1; cd -
Expand Down
4 changes: 2 additions & 2 deletions easybuild/easyblocks/a/abaqus.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@
@author: Jens Timmerman (Ghent University)
@author: Simon Branford (University of Birmingham)
"""
from distutils.version import LooseVersion
import glob
import os
from collections import OrderedDict
from distutils.version import LooseVersion

from easybuild.easyblocks.generic.binary import Binary
from easybuild.framework.easyblock import EasyBlock
Expand All @@ -45,7 +46,6 @@
from easybuild.tools.modules import get_software_root
from easybuild.tools.run import run_cmd_qa
from easybuild.tools.systemtools import get_os_name
from easybuild.tools.py2vs3 import OrderedDict


class EB_ABAQUS(Binary):
Expand Down
2 changes: 1 addition & 1 deletion easybuild/easyblocks/a/aladin.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import shutil
import sys
import tempfile
from collections import OrderedDict

import easybuild.tools.environment as env
import easybuild.tools.toolchain as toolchain
Expand All @@ -41,7 +42,6 @@
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.filetools import apply_regex_substitutions, mkdir
from easybuild.tools.modules import get_software_root, get_software_libdir
from easybuild.tools.py2vs3 import OrderedDict
from easybuild.tools.run import run_cmd, run_cmd_qa


Expand Down
2 changes: 1 addition & 1 deletion easybuild/easyblocks/e/easybuildmeta.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
import os
import re
import sys
from collections import OrderedDict
from distutils.version import LooseVersion

from easybuild.easyblocks.generic.pythonpackage import PythonPackage, det_pip_version
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.filetools import apply_regex_substitutions, change_dir, read_file
from easybuild.tools.modules import get_software_root_env_var_name
from easybuild.tools.py2vs3 import OrderedDict
from easybuild.tools.utilities import flatten


Expand Down
5 changes: 2 additions & 3 deletions easybuild/easyblocks/generic/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
from easybuild.framework.easyconfig.easyconfig import get_easyblock_class
from easybuild.tools.build_log import EasyBuildError, print_msg
from easybuild.tools.modules import get_software_root, get_software_version
from easybuild.tools.py2vs3 import string_type


class Bundle(EasyBlock):
Expand Down Expand Up @@ -163,7 +162,7 @@ def __init__(self, *args, **kwargs):
# If per-component source URLs are provided, attach them directly to the relevant sources
if comp_cfg['source_urls']:
for source in comp_cfg['sources']:
if isinstance(source, string_type):
if isinstance(source, str):
self.cfg.update('sources', [{'filename': source, 'source_urls': comp_cfg['source_urls']}])
elif isinstance(source, dict):
# Update source_urls in the 'source' dict to use the one for the components
Expand Down Expand Up @@ -266,7 +265,7 @@ def install_step(self):

# find match entries in self.src for this component
for source in comp.cfg['sources']:
if isinstance(source, string_type):
if isinstance(source, str):
comp_src_fn = source
elif isinstance(source, dict):
if 'filename' in source:
Expand Down
7 changes: 3 additions & 4 deletions easybuild/easyblocks/generic/pythonpackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@
from easybuild.tools.config import build_option
from easybuild.tools.filetools import mkdir, remove_dir, which
from easybuild.tools.modules import get_software_root
from easybuild.tools.py2vs3 import string_type, subprocess_popen_text
from easybuild.tools.run import run_cmd
from easybuild.tools.run import run_cmd, subprocess_popen_text
from easybuild.tools.utilities import nub
from easybuild.tools.hooks import CONFIGURE_STEP, BUILD_STEP, TEST_STEP, INSTALL_STEP

Expand Down Expand Up @@ -503,7 +502,7 @@ def compose_install_command(self, prefix, extrapath=None, installopts=None):
if self._should_unpack_source():
# specify current directory
loc = '.'
elif isinstance(self.src, string_type):
elif isinstance(self.src, str):
# for extensions, self.src specifies the location of the source file
loc = self.src
else:
Expand Down Expand Up @@ -653,7 +652,7 @@ def test_step(self, return_output_ec=False):
:param return_output: return output and exit code of test command
"""

if isinstance(self.cfg['runtest'], string_type):
if isinstance(self.cfg['runtest'], str):
self.testcmd = self.cfg['runtest']

if self.cfg['runtest'] and self.testcmd is not None:
Expand Down
3 changes: 1 addition & 2 deletions easybuild/easyblocks/m/matlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
from easybuild.framework.easyconfig import CUSTOM
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.filetools import adjust_permissions, change_dir, copy_file, read_file, write_file
from easybuild.tools.py2vs3 import string_type
from easybuild.tools.run import run_cmd


Expand Down Expand Up @@ -160,7 +159,7 @@ def install_step(self):
keys = self.cfg['key']
if keys is None:
keys = os.getenv('EB_MATLAB_KEY', '00000-00000-00000-00000-00000-00000-00000-00000-00000-00000')
if isinstance(keys, string_type):
if isinstance(keys, str):
keys = keys.split(',')

# Compile the installation key regex outside of the loop
Expand Down
5 changes: 2 additions & 3 deletions easybuild/easyblocks/m/mcr.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
from easybuild.framework.easyconfig import CUSTOM
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.filetools import adjust_permissions, read_file, write_file
from easybuild.tools.py2vs3 import string_type
from easybuild.tools.run import run_cmd


Expand Down Expand Up @@ -116,7 +115,7 @@ def install_step(self):
def sanity_check_step(self):
"""Custom sanity check for MCR."""
self.set_subdir()
if not isinstance(self.subdir, string_type):
if not isinstance(self.subdir, str):
raise EasyBuildError("Could not identify which subdirectory to pick: %s" % self.subdir)

custom_paths = {
Expand All @@ -140,7 +139,7 @@ def make_module_extra(self):
self.set_subdir()
# if no subdir was selected, set it to NOTFOUND
# this is done to enable the use of --module-only without having an actual MCR installation
if not isinstance(self.subdir, string_type):
if not isinstance(self.subdir, str):
self.subdir = 'NOTFOUND'

xapplresdir = os.path.join(self.installdir, self.subdir, 'X11', 'app-defaults')
Expand Down
3 changes: 1 addition & 2 deletions easybuild/easyblocks/o/openssl_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
from easybuild.framework.easyconfig import CUSTOM
from easybuild.tools.build_log import EasyBuildError, print_warning
from easybuild.tools.filetools import change_dir, expand_glob_paths, mkdir, read_file, symlink, which, write_file
from easybuild.tools.py2vs3 import string_type
from easybuild.tools.run import run_cmd
from easybuild.tools.systemtools import DARWIN, LINUX, get_os_type, get_shared_lib_ext, find_library_path

Expand Down Expand Up @@ -84,7 +83,7 @@ def __init__(self, *args, **kwargs):

if not min_openssl_version:
min_openssl_version = self.version
elif not isinstance(min_openssl_version, string_type):
elif not isinstance(min_openssl_version, str):
min_openssl_version = str(min_openssl_version)

# Minimum OpenSSL version can only increase depth of wrapper version
Expand Down
5 changes: 2 additions & 3 deletions easybuild/easyblocks/o/orca.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
from easybuild.framework.easyconfig import CUSTOM
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.filetools import write_file
from easybuild.tools.py2vs3 import string_type
from easybuild.tools.systemtools import X86_64, get_cpu_architecture


Expand Down Expand Up @@ -112,15 +111,15 @@ def sanity_check_step(self):
if isinstance(spec, tuple):
file_pattern = spec[0]
dest_dir = spec[1]
elif isinstance(spec, string_type):
elif isinstance(spec, str):
file_pattern = spec
dest_dir = ''
else:
raise EasyBuildError(
"Found neither string nor tuple as file to copy: '%s' (type %s)", spec, type(spec)
)

if isinstance(file_pattern, string_type):
if isinstance(file_pattern, str):
file_pattern = [file_pattern]

source_files = []
Expand Down
3 changes: 1 addition & 2 deletions easybuild/easyblocks/p/perl.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
from easybuild.tools.filetools import adjust_permissions
from easybuild.tools.environment import setvar, unset_env_vars
from easybuild.tools.modules import get_software_root
from easybuild.tools.py2vs3 import string_type
from easybuild.tools.run import run_cmd

# perldoc -lm seems to be the safest way to test if a module is available, based on exit code
Expand Down Expand Up @@ -124,7 +123,7 @@ def test_step(self):
# allow escaping with runtest = False
if self.cfg['runtest'] is None or self.cfg['runtest']:
parallel = self.cfg['parallel']
if isinstance(self.cfg['runtest'], string_type):
if isinstance(self.cfg['runtest'], str):
cmd = "make %s" % self.cfg['runtest']
elif parallel and LooseVersion(self.version) >= LooseVersion('5.30.0'):
# run tests in parallel, see https://perldoc.perl.org/perlhack#Parallel-tests;
Expand Down
3 changes: 1 addition & 2 deletions easybuild/easyblocks/p/petsc.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
from easybuild.tools.modules import get_software_root, get_software_version
from easybuild.tools.run import run_cmd
from easybuild.tools.systemtools import get_shared_lib_ext
from easybuild.tools.py2vs3 import string_type

NO_MPI_CXX_EXT_FLAGS = '-DOMPI_SKIP_MPICXX -DMPICH_SKIP_MPICXX'

Expand Down Expand Up @@ -218,7 +217,7 @@ def configure_step(self):

deps = [dep['name'] for dep in self.cfg.dependencies() if not dep['name'] in depfilter]
for dep in deps:
if isinstance(dep, string_type):
if isinstance(dep, str):
dep = (dep, dep)
deproot = get_software_root(dep[0])
if deproot:
Expand Down
2 changes: 1 addition & 1 deletion easybuild/easyblocks/s/scipion.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
@author: Kenneth Hoste (Ghent University)
@author: Ake Sandgren (HPC2N, Umea University)
"""
import configparser
import os

from distutils.version import LooseVersion
from easybuild.framework.extensioneasyblock import ExtensionEasyBlock
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.filetools import copy, mkdir, symlink
from easybuild.tools.modules import get_software_root, get_software_version
from easybuild.tools.py2vs3 import configparser
from easybuild.tools.run import run_cmd


Expand Down
2 changes: 1 addition & 1 deletion easybuild/easyblocks/t/trilinos.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import re

from distutils.version import LooseVersion
from string import ascii_letters

import easybuild.tools.toolchain as toolchain
from easybuild.easyblocks.generic.cmakemake import CMakeMake
Expand All @@ -40,7 +41,6 @@
from easybuild.tools.config import build_path
from easybuild.tools.filetools import mkdir, remove_dir, symlink
from easybuild.tools.modules import get_software_root
from easybuild.tools.py2vs3 import ascii_letters
from easybuild.tools.systemtools import get_shared_lib_ext


Expand Down
3 changes: 1 addition & 2 deletions easybuild/easyblocks/u/ucx_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
from easybuild.easyblocks.generic.configuremake import ConfigureMake
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.modules import get_software_root
from easybuild.tools.py2vs3 import subprocess_popen_text
from easybuild.tools.run import run_cmd
from easybuild.tools.run import run_cmd, subprocess_popen_text
from easybuild.tools.systemtools import get_shared_lib_ext


Expand Down
2 changes: 1 addition & 1 deletion test/easyblocks/easyblock_specific.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import sys
import tempfile
import textwrap
from io import StringIO
from unittest import TestLoader, TextTestRunner
from test.easyblocks.module import cleanup

Expand All @@ -49,7 +50,6 @@
from easybuild.tools.filetools import adjust_permissions, remove_dir, write_file
from easybuild.tools.modules import modules_tool
from easybuild.tools.options import set_tmpdir
from easybuild.tools.py2vs3 import StringIO


class EasyBlockSpecificTest(TestCase):
Expand Down