def test_get_argument_from_module_line(): simple_lines = [ 'prepend-path LD_LIBRARY_PATH /lib/path', 'prepend-path LD_LIBRARY_PATH /lib/path', "prepend_path('PATH' , '/lib/path')", 'prepend_path( "PATH" , "/lib/path" )', 'prepend_path("PATH",' + "'/lib/path')" ] complex_lines = [ 'prepend-path LD_LIBRARY_PATH /lib/path:/pkg/path', 'prepend-path LD_LIBRARY_PATH /lib/path:/pkg/path', "prepend_path('PATH' , '/lib/path:/pkg/path')", 'prepend_path( "PATH" , "/lib/path:/pkg/path" )', 'prepend_path("PATH",' + "'/lib/path:/pkg/path')" ] bad_lines = [ 'prepend_path(PATH,/lib/path)', 'prepend-path (LD_LIBRARY_PATH) /lib/path' ] assert all( get_path_args_from_module_line(l) == ['/lib/path'] for l in simple_lines) assert all( get_path_args_from_module_line(l) == ['/lib/path', '/pkg/path'] for l in complex_lines) for bl in bad_lines: with pytest.raises(ValueError): get_path_args_from_module_line(bl)
def external_prefix(self): mpich_module = module("show", self.modname).splitlines() for line in mpich_module: if "CRAY_MPICH_DIR" in line: return get_path_args_from_module_line(line)[0] # Fixes an issue on Archer2 cray-mpich/8.0.16 where there is # no CRAY_MPICH_DIR variable in the module file. for line in mpich_module: if "CRAY_LD_LIBRARY_PATH" in line: libdir = get_path_args_from_module_line(line)[0] return os.path.dirname(os.path.normpath(libdir))
def external_prefix(self): libsci_module = module("show", self.modname).splitlines() for line in libsci_module: if "CRAY_LIBSCI_PREFIX_DIR" in line: return get_path_args_from_module_line(line)[0]
def external_prefix(self): mpich_module = module("show", self.modname).splitlines() for line in mpich_module: if "CRAY_MPICH_DIR" in line: return get_path_args_from_module_line(line)[0]