def patch_step(self): """Patch Boost source code before building.""" super(boostcray, self).patch_step() # TIME_UTC is also defined in recent glibc versions, so we need to rename it for old Boost versions (<= 1.47) glibc_version = get_glibc_version() old_glibc = glibc_version is not UNKNOWN and LooseVersion(glibc_version) > LooseVersion("2.15") if old_glibc and LooseVersion(self.version) <= LooseVersion("1.47.0"): self.log.info("Patching because the glibc version is too new") files_to_patch = ["boost/thread/xtime.hpp"] + glob.glob("libs/interprocess/test/*.hpp") files_to_patch += glob.glob("libs/spirit/classic/test/*.cpp") + glob.glob("libs/spirit/classic/test/*.inl") for patchfile in files_to_patch: try: for line in fileinput.input("%s" % patchfile, inplace=1, backup='.orig'): line = re.sub(r"TIME_UTC", r"TIME_UTC_", line) sys.stdout.write(line) except IOError, err: raise EasyBuildError("Failed to patch %s: %s", patchfile, err)
def test_glibc_version_darwin(self): """Test getting glibc version (mocked for Darwin).""" st.get_os_type = lambda: st.DARWIN self.assertEqual(get_glibc_version(), UNKNOWN)
def test_glibc_version_linux(self): """Test getting glibc version (mocked for Linux).""" st.get_os_type = lambda: st.LINUX st.run_cmd = mocked_run_cmd self.assertEqual(get_glibc_version(), '2.12')
def test_glibc_version_native(self): """Test getting glibc version.""" glibc_version = get_glibc_version() self.assertTrue(isinstance(glibc_version, basestring) or glibc_version == UNKNOWN)
def test_glibc_version_linux_musl_libc(self): """Test getting glibc version (mocked for Linux).""" st.get_os_type = lambda: st.LINUX st.get_tool_version = lambda _: "musl libc (x86_64); Version 1.1.18; Dynamic Program Loader" self.assertEqual(get_glibc_version(), UNKNOWN)