Skip to content

Commit

Permalink
Merge pull request #3015 from boegel/5.0.x_rip_py2v3
Browse files Browse the repository at this point in the history
stop importing from easybuild.tools.py2vs3 (+ minor cleanup in init easyblocks test)
  • Loading branch information
branfosj committed Oct 11, 2023
2 parents ef8f5fa + e7f7900 commit ede2c53
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
5 changes: 2 additions & 3 deletions easybuild/easyblocks/generic/configuremake.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
from easybuild.tools.config import source_paths, build_option
from easybuild.tools.filetools import CHECKSUM_TYPE_SHA256, adjust_permissions, compute_checksum, download_file
from easybuild.tools.filetools import read_file, remove_file
from easybuild.tools.py2vs3 import string_type
from easybuild.tools.run import run_cmd

# string that indicates that a configure script was generated by Autoconf
Expand Down Expand Up @@ -340,7 +339,7 @@ def build_step(self, verbose=False, path=None):

targets = self.cfg.get('build_cmd_targets') or DEFAULT_BUILD_TARGET
# ensure strings are converted to list
targets = [targets] if isinstance(targets, string_type) else targets
targets = [targets] if isinstance(targets, str) else targets

for target in targets:
cmd = ' '.join([
Expand All @@ -366,7 +365,7 @@ def test_step(self):
runtest = self.cfg['runtest']
if runtest or test_cmd != DEFAULT_TEST_CMD:
# Make run_test a string (empty if it is e.g. a boolean)
if not isinstance(runtest, string_type):
if not isinstance(runtest, str):
runtest = ''
# Compose command filtering out empty values
cmd = ' '.join([x for x in (self.cfg['pretestopts'], test_cmd, runtest, self.cfg['testopts']) if x])
Expand Down
5 changes: 2 additions & 3 deletions easybuild/easyblocks/generic/makecp.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
from easybuild.framework.easyconfig import BUILD, MANDATORY
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.filetools import change_dir, copy_dir, copy_file, mkdir
from easybuild.tools.py2vs3 import string_type


class MakeCp(ConfigureMake):
Expand Down Expand Up @@ -78,13 +77,13 @@ def install_step(self):
for fil in files_to_copy:
if isinstance(fil, tuple):
# ([src1, src2], targetdir)
if len(fil) == 2 and isinstance(fil[0], list) and isinstance(fil[1], string_type):
if len(fil) == 2 and isinstance(fil[0], list) and isinstance(fil[1], str):
files_specs = fil[0]
target = os.path.join(self.installdir, fil[1])
else:
raise EasyBuildError("Only tuples of format '([<source files>], <target dir>)' supported.")
# 'src_file' or 'src_dir'
elif isinstance(fil, string_type):
elif isinstance(fil, str):
files_specs = [fil]
target = self.installdir
else:
Expand Down
6 changes: 0 additions & 6 deletions test/easyblocks/init_easyblocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,6 @@ def check_extra_options_format(extra_options):
re.compile(r"log\.error\("),
re.compile(r"log\.exception\("),
re.compile(r"log\.raiseException\("),
# check for use of 'basestring', which is Python 2.x only (should use string_type from tools.py2vs3 instead)
re.compile(r"[^\w]basestring([^\w]|$)"),
# check for use of '.iteritems()', which is Python 2.x only (should use .items instead)
re.compile(r"\.iteritems\(\)"),
# sys.maxint is no longer there in Python 3
re.compile(r"sys\.maxint"),
]
for regexp in regexps:
self.assertFalse(regexp.search(txt), "No match for '%s' in %s" % (regexp.pattern, easyblock))
Expand Down

0 comments on commit ede2c53

Please sign in to comment.