Skip to content
Snippets Groups Projects
Commit 28402178 authored by Alexandre Strube's avatar Alexandre Strube
Browse files

autopep8

parent ab0bc57b
Branches
Tags
No related merge requests found
...@@ -45,32 +45,25 @@ class EB_Bazel(EasyBlock): ...@@ -45,32 +45,25 @@ class EB_Bazel(EasyBlock):
binutils_root = get_software_root('binutils') binutils_root = get_software_root('binutils')
gcc_root = get_software_root('GCCcore') or get_software_root('GCC') gcc_root = get_software_root('GCCcore') or get_software_root('GCC')
gcc_ver = get_software_version( gcc_ver = get_software_version('GCCcore') or get_software_version('GCC')
'GCCcore') or get_software_version('GCC')
# only patch Bazel scripts if binutils & GCC installation prefix could be determined # only patch Bazel scripts if binutils & GCC installation prefix could be determined
if binutils_root and gcc_root: if binutils_root and gcc_root:
res = glob.glob(os.path.join(gcc_root, 'lib', res = glob.glob(os.path.join(gcc_root, 'lib', 'gcc', '*', gcc_ver, 'include'))
'gcc', '*', gcc_ver, 'include'))
if res and len(res) == 1: if res and len(res) == 1:
gcc_lib_inc = res[0] gcc_lib_inc = res[0]
else: else:
raise EasyBuildError( raise EasyBuildError("Failed to pinpoint location of GCC include files: %s", res)
"Failed to pinpoint location of GCC include files: %s", res)
gcc_lib_inc_bis = os.path.join( gcc_lib_inc_bis = os.path.join(os.path.dirname(gcc_lib_inc), 'include-fixed')
os.path.dirname(gcc_lib_inc), 'include-fixed')
if not os.path.exists(gcc_lib_inc_bis): if not os.path.exists(gcc_lib_inc_bis):
self.log.info( self.log.info("Derived directory %s does not exist, falling back to %s", gcc_lib_inc_bis, gcc_lib_inc)
"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_lib_inc_bis = gcc_lib_inc
gcc_cplusplus_inc = os.path.join( gcc_cplusplus_inc = os.path.join(gcc_root, 'include', 'c++', gcc_ver)
gcc_root, 'include', 'c++', gcc_ver)
if not os.path.exists(gcc_cplusplus_inc): if not os.path.exists(gcc_cplusplus_inc):
raise EasyBuildError( raise EasyBuildError("Derived directory %s does not exist", gcc_cplusplus_inc)
"Derived directory %s does not exist", gcc_cplusplus_inc)
# replace hardcoded paths in CROSSTOOL # replace hardcoded paths in CROSSTOOL
...@@ -78,24 +71,18 @@ class EB_Bazel(EasyBlock): ...@@ -78,24 +71,18 @@ class EB_Bazel(EasyBlock):
if LooseVersion(self.version) < LooseVersion('0.24.0'): if LooseVersion(self.version) < LooseVersion('0.24.0'):
regex_subs = [ regex_subs = [
(r'-B/usr/bin', '-B%s' % os.path.join(binutils_root, 'bin')), (r'-B/usr/bin', '-B%s' % os.path.join(binutils_root, 'bin')),
(r'(cxx_builtin_include_directory:.*)/usr/lib/gcc', (r'(cxx_builtin_include_directory:.*)/usr/lib/gcc', r'\1%s' % gcc_lib_inc),
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/local/include', (r'(cxx_builtin_include_directory:.*)/usr/include', r'\1%s' % gcc_cplusplus_inc),
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']: for tool in ['ar', 'cpp', 'dwp', 'gcc', 'ld']:
path = which(tool) path = which(tool)
if path: if path:
regex_subs.append( regex_subs.append((os.path.join('/usr', 'bin', tool), path))
(os.path.join('/usr', 'bin', tool), path))
else: else:
raise EasyBuildError( raise EasyBuildError("Failed to determine path to '%s'", tool)
"Failed to determine path to '%s'", tool)
apply_regex_substitutions(os.path.join( apply_regex_substitutions(os.path.join('tools', 'cpp', 'CROSSTOOL'), regex_subs)
'tools', 'cpp', 'CROSSTOOL'), regex_subs)
# replace hardcoded paths in (unix_)cc_configure.bzl # replace hardcoded paths in (unix_)cc_configure.bzl
regex_subs = [ regex_subs = [
...@@ -107,8 +94,7 @@ class EB_Bazel(EasyBlock): ...@@ -107,8 +94,7 @@ class EB_Bazel(EasyBlock):
if os.path.exists(filepath): if os.path.exists(filepath):
apply_regex_substitutions(filepath, regex_subs) apply_regex_substitutions(filepath, regex_subs)
else: else:
self.log.info( self.log.info("Not patching Bazel build scripts, installation prefix for binutils/GCC not found")
"Not patching Bazel build scripts, installation prefix for binutils/GCC not found")
# enable building in parallel # enable building in parallel
bazel_args = '--jobs=%d' % self.cfg['parallel'] bazel_args = '--jobs=%d' % self.cfg['parallel']
...@@ -128,8 +114,7 @@ class EB_Bazel(EasyBlock): ...@@ -128,8 +114,7 @@ class EB_Bazel(EasyBlock):
def install_step(self): def install_step(self):
"""Custom install procedure for Bazel.""" """Custom install procedure for Bazel."""
copy_file(os.path.join('output', 'bazel'), copy_file(os.path.join('output', 'bazel'), os.path.join(self.installdir, 'bin', 'bazel'))
os.path.join(self.installdir, 'bin', 'bazel'))
def sanity_check_step(self): def sanity_check_step(self):
"""Custom sanity check for Bazel.""" """Custom sanity check for Bazel."""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment