From 284021780427311c17c7d7e7f71cafdc45cad10f Mon Sep 17 00:00:00 2001 From: Alexandre Strube <a.strube@fz-juelich.de> Date: Thu, 4 Mar 2021 17:30:21 +0100 Subject: [PATCH] autopep8 --- Custom_EasyBlocks/bazel.py | 45 +++++++++++++------------------------- 1 file changed, 15 insertions(+), 30 deletions(-) diff --git a/Custom_EasyBlocks/bazel.py b/Custom_EasyBlocks/bazel.py index 94c5d87b9..b0ad778f4 100644 --- a/Custom_EasyBlocks/bazel.py +++ b/Custom_EasyBlocks/bazel.py @@ -45,32 +45,25 @@ class EB_Bazel(EasyBlock): binutils_root = get_software_root('binutils') gcc_root = get_software_root('GCCcore') or get_software_root('GCC') - gcc_ver = get_software_version( - 'GCCcore') or get_software_version('GCC') + gcc_ver = get_software_version('GCCcore') or get_software_version('GCC') # only patch Bazel scripts if binutils & GCC installation prefix could be determined if binutils_root and gcc_root: - res = glob.glob(os.path.join(gcc_root, 'lib', - 'gcc', '*', gcc_ver, 'include')) + res = glob.glob(os.path.join(gcc_root, 'lib', 'gcc', '*', gcc_ver, 'include')) if res and len(res) == 1: gcc_lib_inc = res[0] else: - raise EasyBuildError( - "Failed to pinpoint location of GCC include files: %s", res) + raise EasyBuildError("Failed to pinpoint location of GCC include files: %s", res) - gcc_lib_inc_bis = os.path.join( - os.path.dirname(gcc_lib_inc), 'include-fixed') + gcc_lib_inc_bis = os.path.join(os.path.dirname(gcc_lib_inc), 'include-fixed') if not os.path.exists(gcc_lib_inc_bis): - self.log.info( - "Derived directory %s does not exist, falling back to %s", gcc_lib_inc_bis, gcc_lib_inc) + self.log.info("Derived directory %s does not exist, falling back to %s", gcc_lib_inc_bis, gcc_lib_inc) gcc_lib_inc_bis = gcc_lib_inc - gcc_cplusplus_inc = os.path.join( - gcc_root, 'include', 'c++', gcc_ver) + gcc_cplusplus_inc = os.path.join(gcc_root, 'include', 'c++', gcc_ver) if not os.path.exists(gcc_cplusplus_inc): - raise EasyBuildError( - "Derived directory %s does not exist", gcc_cplusplus_inc) + raise EasyBuildError("Derived directory %s does not exist", gcc_cplusplus_inc) # replace hardcoded paths in CROSSTOOL @@ -78,24 +71,18 @@ class EB_Bazel(EasyBlock): if LooseVersion(self.version) < LooseVersion('0.24.0'): regex_subs = [ (r'-B/usr/bin', '-B%s' % os.path.join(binutils_root, 'bin')), - (r'(cxx_builtin_include_directory:.*)/usr/lib/gcc', - r'\1%s' % gcc_lib_inc), - (r'(cxx_builtin_include_directory:.*)/usr/local/include', - r'\1%s' % gcc_lib_inc_bis), - (r'(cxx_builtin_include_directory:.*)/usr/include', - r'\1%s' % gcc_cplusplus_inc), + (r'(cxx_builtin_include_directory:.*)/usr/lib/gcc', r'\1%s' % gcc_lib_inc), + (r'(cxx_builtin_include_directory:.*)/usr/local/include', r'\1%s' % gcc_lib_inc_bis), + (r'(cxx_builtin_include_directory:.*)/usr/include', r'\1%s' % gcc_cplusplus_inc), ] for tool in ['ar', 'cpp', 'dwp', 'gcc', 'ld']: path = which(tool) if path: - regex_subs.append( - (os.path.join('/usr', 'bin', tool), path)) + regex_subs.append((os.path.join('/usr', 'bin', tool), path)) else: - raise EasyBuildError( - "Failed to determine path to '%s'", tool) + raise EasyBuildError("Failed to determine path to '%s'", tool) - apply_regex_substitutions(os.path.join( - 'tools', 'cpp', 'CROSSTOOL'), regex_subs) + apply_regex_substitutions(os.path.join('tools', 'cpp', 'CROSSTOOL'), regex_subs) # replace hardcoded paths in (unix_)cc_configure.bzl regex_subs = [ @@ -107,8 +94,7 @@ class EB_Bazel(EasyBlock): if os.path.exists(filepath): apply_regex_substitutions(filepath, regex_subs) else: - self.log.info( - "Not patching Bazel build scripts, installation prefix for binutils/GCC not found") + self.log.info("Not patching Bazel build scripts, installation prefix for binutils/GCC not found") # enable building in parallel bazel_args = '--jobs=%d' % self.cfg['parallel'] @@ -128,8 +114,7 @@ class EB_Bazel(EasyBlock): def install_step(self): """Custom install procedure for Bazel.""" - copy_file(os.path.join('output', 'bazel'), - os.path.join(self.installdir, 'bin', 'bazel')) + copy_file(os.path.join('output', 'bazel'), os.path.join(self.installdir, 'bin', 'bazel')) def sanity_check_step(self): """Custom sanity check for Bazel.""" -- GitLab