Exemple #1
0
    def extract_step(self):
        """Skip extraction of .gem files, which are installed as downloaded"""

        if len(self.src) > 1:
            raise EasyBuildError(
                "Don't know how to handle Ruby gems with multiple sources.")
        else:
            src = self.src[0]
            if src['path'].endswith('.gem'):
                copy_file(src['path'], self.builddir)
                self.ext_src = src['name']
                # set final path since it can't be determined from unpacked sources (used for guessing start_dir)
                src['finalpath'] = self.builddir
            else:
                # unpack zipped gems, use specified path to gem file
                super(RubyGem, self).extract_step()

                if self.cfg['gem_file']:
                    self.ext_src = os.path.join(src['finalpath'],
                                                self.cfg['gem_file'])
                    if not os.path.exists(self.ext_src):
                        raise EasyBuildError("Gem file not found at %s",
                                             self.ext_src)
                else:
                    raise EasyBuildError(
                        "Location to gem file in unpacked sources must be specified via gem_file"
                    )
    def test_copy_file(self):
        """ Test copy_file """
        testdir = os.path.dirname(os.path.abspath(__file__))
        tmpdir = self.test_prefix
        to_copy = os.path.join(testdir, 'easyconfigs', 'test_ecs', 't', 'toy',
                               'toy-0.0.eb')
        target_path = os.path.join(tmpdir, 'toy.eb')
        ft.copy_file(to_copy, target_path)
        self.assertTrue(os.path.exists(target_path))
        self.assertTrue(ft.read_file(to_copy) == ft.read_file(target_path))

        # also test behaviour of extract_file under --dry-run
        build_options = {
            'extended_dry_run': True,
            'silent': False,
        }
        init_config(build_options=build_options)

        # remove target file, it shouldn't get copied under dry run
        os.remove(target_path)

        self.mock_stdout(True)
        ft.copy_file(to_copy, target_path)
        txt = self.get_stdout()
        self.mock_stdout(False)

        self.assertFalse(os.path.exists(target_path))
        self.assertTrue(
            re.search("^copied file .*/toy-0.0.eb to .*/toy.eb", txt))
    def install_step(self):
        """
        Install LAPACK: copy all .a files to lib dir in install directory
        """

        if self.cfg['test_only']:
            self.log.info('Only testing, so skipping make install.')
            pass

        srcdir = self.cfg['start_dir']
        destdir = os.path.join(self.installdir, 'lib')

        try:
            os.makedirs(destdir)

            # copy all .a files
            for libfile in glob.glob(os.path.join(srcdir, '*.a')):
                self.log.debug("Copying file %s to dir %s" % (libfile, destdir))
                copy_file(libfile, os.path.join(destdir, os.path.basename(libfile)))

            # symlink libraries to sensible names, if they aren't renamed already
            for (fromfile, tofile) in [('liblapack_LINUX.a', 'liblapack.a'),
                                       ('tmglib_LINUX.a', 'libtmglib.a')]:
                frompath = os.path.join(destdir, fromfile)
                topath = os.path.join(destdir, tofile)
                if os.path.isfile(frompath) and not os.path.isfile(tofile):
                    self.log.debug("Symlinking %s to %s" % (fromfile, tofile))
                    os.symlink(frompath, topath)

        except OSError, err:
            raise EasyBuildError("Copying %s to installation dir %s failed: %s", srcdir, destdir, err)
    def install_step(self):
        """
        Install binary and a wrapper that loads correct CUDA version.
        """

        src_gctf_bin = os.path.join(self.builddir, 'bin', self.gctf_bin)
        if not os.path.exists(src_gctf_bin):
            raise EasyBuildError(
                "Specified CUDA version has no corresponding Gctf binary")

        bindir = os.path.join(self.installdir, 'bin')
        mkdir(bindir)

        dst_gctf_bin = os.path.join(bindir, self.gctf_bin)
        copy_file(src_gctf_bin, dst_gctf_bin)

        exe_perms = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
        read_perms = stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH
        perms = read_perms | exe_perms

        adjust_permissions(dst_gctf_bin, perms, add=True)

        # Install a wrapper that loads CUDA before starting the binary
        wrapper = os.path.join(bindir, 'Gctf')
        txt = '\n'.join([
            '#!/bin/bash', '',
            '# Wrapper for Gctf binary that loads the required',
            '# version of CUDA',
            'module unload %s' % self.cuda_name,
            'module add %s' % self.cuda_mod_name,
            'exec %s "$@"' % dst_gctf_bin
        ])
        write_file(wrapper, txt)
        adjust_permissions(wrapper, exe_perms, add=True)
        symlink('Gctf', os.path.join(bindir, 'gctf'), use_abspath_source=False)
Exemple #5
0
    def build_step(self):
        """Custom build step for Xmipp."""

        # First build cuFFTAdvisor, XmippCore depends on this when CUDA is enabled.
        if self.use_cuda:
            cwd = change_dir(os.path.join(self.srcdir, 'cuFFTAdvisor'))
            cmd = ' '.join([
                self.cfg['prebuildopts'],
                'make',
                'all',
                self.cfg['buildopts'],
            ])
            run_cmd(cmd, log_all=True, simple=True)
            change_dir(cwd)
            xmipp_lib = os.path.join(self.srcdir, 'xmipp', 'lib')
            mkdir(xmipp_lib)
            shlib_ext = get_shared_lib_ext()
            libname = 'libcuFFTAdvisor.%s' % shlib_ext
            copy_file(
                os.path.join(self.srcdir, 'cuFFTAdvisor', 'build', libname),
                xmipp_lib)

        self.cfg.update('buildopts', '--verbose')
        for module in self.xmipp_modules:
            moddir = os.path.join(os.path.basename(self.srcdir), module)
            symlink(self.cfgfile,
                    os.path.join(self.srcdir, module, 'install', 'xmipp.conf'))
            cwd = change_dir(moddir)
            super(EB_Xmipp, self).build_step()
            change_dir(cwd)
    def install_step(self):
        """
        Install LAPACK: copy all .a files to lib dir in install directory
        """

        if self.cfg['test_only']:
            self.log.info('Only testing, so skipping make install.')
            pass

        srcdir = self.cfg['start_dir']
        destdir = os.path.join(self.installdir, 'lib')

        try:
            os.makedirs(destdir)

            # copy all .a files
            for libfile in glob.glob(os.path.join(srcdir, '*.a')):
                self.log.debug("Copying file %s to dir %s" %
                               (libfile, destdir))
                copy_file(libfile,
                          os.path.join(destdir, os.path.basename(libfile)))

            # symlink libraries to sensible names, if they aren't renamed already
            for (fromfile, tofile) in [('liblapack_LINUX.a', 'liblapack.a'),
                                       ('tmglib_LINUX.a', 'libtmglib.a')]:
                frompath = os.path.join(destdir, fromfile)
                topath = os.path.join(destdir, tofile)
                if os.path.isfile(frompath) and not os.path.isfile(tofile):
                    self.log.debug("Symlinking %s to %s" % (fromfile, tofile))
                    os.symlink(frompath, topath)

        except OSError as err:
            raise EasyBuildError(
                "Copying %s to installation dir %s failed: %s", srcdir,
                destdir, err)
Exemple #7
0
    def install_step(self):
        """Patch files to avoid use of build dir, install by copying files to install dir."""
        # patch build dir out of files, replace by install dir
        pattern = r'%s' % self.cfg['start_dir']
        if pattern[-1] == os.path.sep:
            pattern = pattern[:-1]

        installdir_bin = os.path.join(self.installdir, 'bin')

        for fil in [
                f for f in os.listdir(self.cfg['start_dir'])
                if os.path.isfile(f)
        ]:
            # only use apply_regex_substitutions() on non-binary files
            # for more details, see https://github.com/easybuilders/easybuild-easyblocks/issues/2629)
            if not is_binary(read_file(fil, mode='rb')):
                self.log.debug(
                    "Patching build dir out of %s, replacing by install bin dir)",
                    fil)
                apply_regex_substitutions(fil, [(pattern, installdir_bin)])

        # copy files to install dir
        file_tuples = [
            (self.cfg['start_dir'], 'bin', self.bin_files),
            (os.path.join(self.cfg['start_dir'], 'aux_bin'),
             os.path.join('bin', 'aux_bin'), self.aux_bin_files),
            (os.path.join(self.cfg['start_dir'], 'scripts'),
             os.path.join('bin', 'scripts'), self.script_files),
        ]
        for srcdir, dest, files in file_tuples:
            destdir = os.path.join(self.installdir, dest)
            mkdir(destdir, parents=True)
            for filename in files:
                srcfile = os.path.join(srcdir, filename)
                copy_file(srcfile, destdir)
    def install_step(self):
        """
        Install by copying files to install dir
        """
        install_files = [
            ('include/bam', self.include_files),
            ('lib', self.lib_files),
        ]

        # v1.3 and more recent supports 'make install', but this only installs (some of) the binaries...
        if LooseVersion(self.version) >= LooseVersion('1.3'):
            super(EB_SAMtools, self).install_step()

            # figure out which bin files are missing, and try copying them
            missing_bin_files = []
            for binfile in self.bin_files:
                if not os.path.exists(os.path.join(self.installdir, 'bin', os.path.basename(binfile))):
                    missing_bin_files.append(binfile)
            install_files.append(('bin', missing_bin_files))

        else:
            # copy binaries manually for older versions
            install_files.append(('bin', self.bin_files))

        self.log.debug("Installing files by copying them 'manually': %s", install_files)
        for (destdir, files) in install_files:
            for fn in files:
                dest = os.path.join(self.installdir, destdir, os.path.basename(fn))
                copy_file(os.path.join(self.cfg['start_dir'], fn), dest)

            # enable r-x permissions for group/others
            perms = stat.S_IRGRP|stat.S_IXGRP|stat.S_IROTH|stat.S_IXOTH
            adjust_permissions(self.installdir, perms, add=True, recursive=True)
Exemple #9
0
    def test_step(self):
        """Custom built-in test procedure for TINKER."""
        if self.cfg['runtest']:
            # copy tests, params and built binaries to temporary directory for testing
            tmpdir = tempfile.mkdtemp()
            testdir = os.path.join(tmpdir, 'test')

            mkdir(os.path.join(tmpdir, 'bin'))
            binaries = glob.glob(
                os.path.join(self.cfg['start_dir'], 'source', '*.x'))
            for binary in binaries:
                copy_file(
                    binary,
                    os.path.join(tmpdir, 'bin',
                                 os.path.basename(binary)[:-2]))
            copy_dir(os.path.join(self.cfg['start_dir'], 'test'), testdir)
            copy_dir(os.path.join(self.cfg['start_dir'], 'params'),
                     os.path.join(tmpdir, 'params'))

            change_dir(testdir)

            # run all tests via the provided 'run' scripts
            tests = glob.glob(os.path.join(testdir, '*.run'))
            # gpcr takes too logn (~1h), ifabp fails due to input issues (?)
            tests = [
                t for t in tests
                if not (t.endswith('gpcr.run') or t.endswith('ifabp.run'))
            ]
            for test in tests:
                run_cmd(test)
Exemple #10
0
    def install_step(self):
        """Custom install procedure for Siesta: copy binaries."""
        bindir = os.path.join(self.installdir, 'bin')
        copy_dir(os.path.join(self.cfg['start_dir'], 'bin'), bindir)
        if self.cfg['with_libsiesta']:
            libd = os.path.join(self.installdir, 'lib')
            pkgconfd = os.path.join(libd, 'pkgconfig')
            incdir = os.path.join(self.installdir, "include", "Siesta")
            moddir = os.path.join(incdir, 'modules')

            # Library
            copy_file(os.path.join(self.obj_dir, 'libsiesta.a'),
                      os.path.join(libd, 'libsiesta.a'))
            # Modules
            mkdir(moddir, parents=True)
            modules = expand_glob_paths([os.path.join(self.obj_dir, '*.mod')])
            for module in modules:
                copy_file(module, os.path.join(moddir,
                                               os.path.basename(module)))
            # Pkgconf file
            mkdir(pkgconfd)
            write_file(
                os.path.join(pkgconfd, "Siesta.pc"),
                PKGCONF_TEXT.format(
                    prefix=self.installdir,
                    version=self.version,
                    libnames=" ".join(self.pkg_conf_requires),
                ))
Exemple #11
0
    def configure_step(self):
        """Configure netpbm build."""

        deps = ['libjpeg-turbo', 'LibTIFF', 'libpng', 'zlib', 'X11', 'libxml2', 'flex']

        for name in deps:
            if not get_software_root(name):
                raise EasyBuildError("%s module not loaded?", name)

        fn = "config.mk"

        copy_file("config.mk.in", fn)

        for line in fileinput.input(fn, inplace=1, backup='.orig'):

            line = re.sub(r"^BUILD_FIASCO\s*=.*", "BUILD_FIASCO = N", line)
            line = re.sub(r"^CC\s*=.*", "CC = %s" % os.getenv("CC"), line)
            line = re.sub(r"^CFLAGS_FOR_BUILD\s*=.*", "CFLAGS_FOR_BUILD = %s" % os.getenv("CFLAGS"), line)
            line = re.sub(r"^LDFLAGS_FOR_BUILD\s*=.*", "LDFLAGS_FOR_BUILD = %s" % os.getenv("LDFLAGS"), line)
            line = re.sub(r"^CFLAGS_SHLIB\s*=.*", "CFLAGS_SHLIB = -fPIC", line)
            line = re.sub(r"^TIFFLIB\s*=.*", "TIFFLIB = -ltiff", line)
            line = re.sub(r"^TIFFHDR_DIR\s*=.*", "TIFFHDR_DIR = %s/include" % get_software_root("LibTIFF"), line)
            line = re.sub(r"^JPEGLIB\s*=.*", "JPEGLIB = -ljpeg", line)
            line = re.sub(r"^JPEGHDR_DIR\s*=.*", "JPEGHDR_DIR = %s/include" % get_software_root("libjpeg-turbo"), line)
            line = re.sub(r"^PNGLIB\s*=.*", "PNGLIB = -lpng", line)
            line = re.sub(r"^PNGHDR_DIR\s*=.*", "PNGHDR_DIR = %s/include" % get_software_root("libpng"), line)
            line = re.sub(r"^ZLIB\s*=.*", "ZLIB = -lz", line)
            line = re.sub(r"^ZHDR_DIR\s*=.*", "ZHDR_DIR = %s/include" % get_software_root("zlib"), line)
            line = re.sub(r"^JASPERLIB\s*=.*", "JASPERLIB = -ljasper", line)
            line = re.sub(r"^JASPERHDR_DIR\s*=.*", "JASPERHDR_DIR = %s/include" % get_software_root("JasPer"), line)
            line = re.sub(r"^X11LIB\s*=.*", "X11LIB = -lX11", line)
            line = re.sub(r"^X11HDR_DIR\s*=.*", "X11HDR_DIR = %s/include" % get_software_root("X11"), line)
            line = re.sub(r"^OMIT_NETWORK\s*=.*", "OMIT_NETWORK = y", line)

            sys.stdout.write(line)
    def configure_step(self):
        """Configure SCOTCH build: locate the template makefile, copy it to a general Makefile.inc and patch it."""

        # pick template makefile
        comp_fam = self.toolchain.comp_family()
        if comp_fam == toolchain.INTELCOMP:  # @UndefinedVariable
            makefilename = 'Makefile.inc.x86-64_pc_linux2.icc'
        elif comp_fam == toolchain.GCC:  # @UndefinedVariable
            makefilename = 'Makefile.inc.x86-64_pc_linux2'
        else:
            raise EasyBuildError("Unknown compiler family used: %s", comp_fam)

        srcdir = os.path.join(self.cfg['start_dir'], 'src')

        # create Makefile.inc
        makefile_inc = os.path.join(srcdir, 'Makefile.inc')
        copy_file(os.path.join(srcdir, 'Make.inc', makefilename), makefile_inc)
        self.log.debug("Successfully copied Makefile.inc to src dir: %s",
                       makefile_inc)

        # the default behaviour of these makefiles is still wrong
        # e.g., compiler settings, and we need -lpthread
        regex_subs = [
            (r"^CCS\s*=.*$", "CCS\t= $(CC)"),
            (r"^CCP\s*=.*$", "CCP\t= $(MPICC)"),
            (r"^CCD\s*=.*$", "CCD\t= $(MPICC)"),
            # append -lpthread to LDFLAGS
            (r"^LDFLAGS\s*=(?P<ldflags>.*$)", "LDFLAGS\t=\g<ldflags> -lpthread"
             ),
        ]
        apply_regex_substitutions(makefile_inc, regex_subs)

        # change to src dir for building
        change_dir(srcdir)
    def configure_step(self):
        """Configure SCOTCH build: locate the template makefile, copy it to a general Makefile.inc and patch it."""

        # pick template makefile
        comp_fam = self.toolchain.comp_family()
        if comp_fam == toolchain.INTELCOMP:  # @UndefinedVariable
            makefilename = 'Makefile.inc.x86-64_pc_linux2.icc'
        elif comp_fam == toolchain.GCC:  # @UndefinedVariable
            makefilename = 'Makefile.inc.x86-64_pc_linux2'
        else:
            raise EasyBuildError("Unknown compiler family used: %s", comp_fam)

        srcdir = os.path.join(self.cfg['start_dir'], 'src')

        # create Makefile.inc
        makefile_inc = os.path.join(srcdir, 'Makefile.inc')
        copy_file(os.path.join(srcdir, 'Make.inc', makefilename), makefile_inc)
        self.log.debug("Successfully copied Makefile.inc to src dir: %s", makefile_inc)

        # the default behaviour of these makefiles is still wrong
        # e.g., compiler settings, and we need -lpthread
        regex_subs = [
            (r"^CCS\s*=.*$", "CCS\t= $(CC)"),
            (r"^CCP\s*=.*$", "CCP\t= $(MPICC)"),
            (r"^CCD\s*=.*$", "CCD\t= $(MPICC)"),
            # append -lpthread to LDFLAGS
            (r"^LDFLAGS\s*=(?P<ldflags>.*$)", "LDFLAGS\t=\g<ldflags> -lpthread"),
        ]
        apply_regex_substitutions(makefile_inc, regex_subs)

        # change to src dir for building
        change_dir(srcdir)
Exemple #14
0
    def install_step(self):
        """Patch files to avoid use of build dir, install by copying files to install dir."""
        # patch build dir out of files, replace by install dir
        pattern = r'%s' % self.cfg['start_dir']
        if pattern[-1] == os.path.sep:
            pattern = pattern[:-1]

        installdir_bin = os.path.join(self.installdir, 'bin')

        for fil in [
                f for f in os.listdir(self.cfg['start_dir'])
                if os.path.isfile(f)
        ]:
            self.log.debug(
                "Patching build dir out of %s, replacing by install bin dir)",
                fil)
            apply_regex_substitutions(fil, [(pattern, installdir_bin)])

        # copy files to install dir
        file_tuples = [
            (self.cfg['start_dir'], 'bin', self.bin_files),
            (os.path.join(self.cfg['start_dir'], 'aux_bin'),
             os.path.join('bin', 'aux_bin'), self.aux_bin_files),
            (os.path.join(self.cfg['start_dir'], 'scripts'),
             os.path.join('bin', 'scripts'), self.script_files),
        ]
        for srcdir, dest, files in file_tuples:
            destdir = os.path.join(self.installdir, dest)
            mkdir(destdir, parents=True)
            for filename in files:
                srcfile = os.path.join(srcdir, filename)
                copy_file(srcfile, destdir)
Exemple #15
0
    def configure_step(self):
        """
        Configure CBLAS build by copying Makefile.LINUX to Makefile.in, and setting make options
        """
        copy_file('Makefile.LINUX', 'Makefile.in')

        if not self.cfg['buildopts']:
            self.cfg.update('buildopts', 'all')

        self.cfg.update('buildopts', 'CC="%s"' % os.getenv('CC'))
        self.cfg.update('buildopts', 'FC="%s"' % os.getenv('F77'))
        self.cfg.update('buildopts',
                        'CFLAGS="%s -DADD_"' % os.getenv('CFLAGS'))
        self.cfg.update('buildopts',
                        'FFLAGS="%s -DADD_"' % os.getenv('FFLAGS'))

        blas_lib_dir = os.getenv('BLAS_LIB_DIR')
        blas_libs = []
        for blas_lib in os.getenv('BLAS_STATIC_LIBS').split(','):
            blas_lib = os.path.join(blas_lib_dir, blas_lib)
            if os.path.exists(blas_lib):
                blas_libs.append(blas_lib)

        if get_software_root("imkl"):
            extra_blas_libs = [
                '-lmkl_intel_thread', '-lmkl_lapack95_lp64',
                '-lmkl_intel_lp64', '-lmkl_core'
            ]
            blas_libs += extra_blas_libs

        self.cfg.update(
            'buildopts',
            'BLLIB="%s %s"' % (' '.join(blas_libs), os.getenv('LIBS', '')))
Exemple #16
0
    def test_long_module_path(self):
        """Test dealing with a (very) long module path."""

        # create a really long modules install path
        tmpdir = tempfile.mkdtemp()
        long_mod_path = tmpdir
        subdir = 'foo'
        # Lmod v5.1.5 doesn't support module paths longer than 256 characters, so stay just under that magic limit
        while (len(os.path.abspath(long_mod_path)) + len(subdir)) < 240:
            long_mod_path = os.path.join(long_mod_path, subdir)

        # copy one of the test modules there
        gcc_mod_dir = os.path.join(long_mod_path, 'GCC')
        os.makedirs(gcc_mod_dir)
        gcc_mod_path = os.path.join(os.path.dirname(__file__), 'modules',
                                    'GCC', '4.6.3')
        copy_file(gcc_mod_path, gcc_mod_dir)

        # try and use long modules path
        self.init_testmods(test_modules_paths=[long_mod_path])
        ms = self.modtool.available()

        self.assertEqual(ms, ['GCC/4.6.3'])

        shutil.rmtree(tmpdir)
    def test_step(self):
        """Custom built-in test procedure for TINKER."""
        if self.cfg['runtest']:
            # copy tests, params and built binaries to temporary directory for testing
            tmpdir = tempfile.mkdtemp()
            testdir = os.path.join(tmpdir, 'test')

            mkdir(os.path.join(tmpdir, 'bin'))
            binaries = glob.glob(os.path.join(self.cfg['start_dir'], 'source', '*.x'))
            for binary in binaries:
                copy_file(binary, os.path.join(tmpdir, 'bin', os.path.basename(binary)[:-2]))
            copy_dir(os.path.join(self.cfg['start_dir'], 'test'), testdir)
            copy_dir(os.path.join(self.cfg['start_dir'], 'params'), os.path.join(tmpdir, 'params'))

            change_dir(testdir)

            # run all tests via the provided 'run' scripts
            tests = glob.glob(os.path.join(testdir, '*.run'))

            # gpcr takes too long (~1h)
            skip_tests = ['gpcr']
            if (LooseVersion(self.version) < LooseVersion('8.7.2')):
                # ifabp fails due to input issues (?)
                skip_tests.append('ifabp')
            if (LooseVersion(self.version) >= LooseVersion('8.7.2')):
                # salt and dialinine takes too long
                skip_tests.extend(['salt', 'dialanine'])

            tests = [t for t in tests if not any([t.endswith('%s.run' % x) for x in skip_tests])]

            for test in tests:
                run_cmd(test)
    def install_step(self):
        """
        Install by copying files to install dir
        """
        install_files = [
            ('include/bam', self.include_files),
            ('lib', self.lib_files),
        ]

        # v1.3 and more recent supports 'make install', but this only installs (some of) the binaries...
        if LooseVersion(self.version) >= LooseVersion('1.3'):
            super(EB_SAMtools, self).install_step()

            # figure out which bin files are missing, and try copying them
            missing_bin_files = []
            for binfile in self.bin_files:
                if not os.path.exists(os.path.join(self.installdir, 'bin', os.path.basename(binfile))):
                    missing_bin_files.append(binfile)
            install_files.append(('bin', missing_bin_files))

        else:
            # copy binaries manually for older versions
            install_files.append(('bin', self.bin_files))

        self.log.debug("Installing files by copying them 'manually': %s", install_files)
        for (destdir, files) in install_files:
            for fn in files:
                dest = os.path.join(self.installdir, destdir, os.path.basename(fn))
                copy_file(os.path.join(self.cfg['start_dir'], fn), dest)

            # enable r-x permissions for group/others
            perms = stat.S_IRGRP|stat.S_IXGRP|stat.S_IROTH|stat.S_IXOTH
            adjust_permissions(self.installdir, perms, add=True, recursive=True)
    def test_copy_file(self):
        """ Test copy_file """
        testdir = os.path.dirname(os.path.abspath(__file__))
        tmpdir = self.test_prefix
        to_copy = os.path.join(testdir, 'easyconfigs', 'test_ecs', 't', 'toy', 'toy-0.0.eb')
        target_path = os.path.join(tmpdir, 'toy.eb')
        ft.copy_file(to_copy, target_path)
        self.assertTrue(os.path.exists(target_path))
        self.assertTrue(ft.read_file(to_copy) == ft.read_file(target_path))

        # also test behaviour of extract_file under --dry-run
        build_options = {
            'extended_dry_run': True,
            'silent': False,
        }
        init_config(build_options=build_options)

        # remove target file, it shouldn't get copied under dry run
        os.remove(target_path)

        self.mock_stdout(True)
        ft.copy_file(to_copy, target_path)
        txt = self.get_stdout()
        self.mock_stdout(False)

        self.assertFalse(os.path.exists(target_path))
        self.assertTrue(re.search("^copied file .*/toy-0.0.eb to .*/toy.eb", txt))
Exemple #20
0
    def configure_step(self):
        """Configure COMSOL installation: create license file."""

        # The tar file comes from the DVD and has 0444 as permission at the top dir.
        adjust_permissions(self.start_dir, stat.S_IWUSR)

        default_lic_env_var = 'LMCOMSOL_LICENSE_FILE'
        lic_specs, self.license_env_var = find_flexlm_license(
            custom_env_vars=[default_lic_env_var],
            lic_specs=[self.cfg['license_file']])

        if lic_specs:
            if self.license_env_var is None:
                self.log.info(
                    "Using COMSOL license specifications from 'license_file': %s",
                    lic_specs)
                self.license_env_var = default_lic_env_var
            else:
                self.log.info(
                    "Using COMSOL license specifications from $%s: %s",
                    self.license_env_var, lic_specs)

            self.license_file = os.pathsep.join(lic_specs)
            env.setvar(self.license_env_var, self.license_file)
        else:
            msg = "No viable license specifications found; "
            msg += "specify 'license_file', or define $%s" % default_lic_env_var
            raise EasyBuildError(msg)

        copy_file(os.path.join(self.start_dir, 'setupconfig.ini'),
                  self.configfile)
        config = read_file(self.configfile)

        config_vars = {
            'agree': '1',
            'desktopshortcuts': '0',
            'fileassoc': '0',
            'firewall': '0',
            'installdir': self.installdir,
            'license': self.license_file,
            'licmanager': '0',
            'linuxlauncher': '0',
            'showgui': '0',
            'startmenushortcuts': '0',
            'symlinks': '0',
        }

        matlab_root = get_software_root("MATLAB")
        if matlab_root:
            config_vars.update({'matlabdir': matlab_root})

        for key, val in config_vars.items():
            regex = re.compile(r"^%s\s*=.*" % key, re.M)
            config = regex.sub("%s=%s" % (key, val), config)

        write_file(self.configfile, config)

        self.log.debug('configuration file written to %s:\n %s',
                       self.configfile, config)
Exemple #21
0
    def install_step(self):
        """Install built CP2K
        - copy from exe to bin
        - copy data dir (if exists)
        - copy tests
        """

        # copy executables
        exedir = os.path.join(self.cfg['start_dir'], 'exe', self.typearch)
        targetdir = os.path.join(self.installdir, 'bin')
        copy_dir(exedir, targetdir)

        # copy libraries and include files, not sure what is strictly required so we take everything
        if self.cfg['library']:
            libdir = os.path.join(self.cfg['start_dir'], 'lib', self.typearch, self.cfg['type'])
            targetdir = os.path.join(self.installdir, 'lib')
            copy_dir(libdir, targetdir)
            # Also need to populate the include directory
            targetdir = os.path.join(self.installdir, 'include')
            libcp2k_header = os.path.join(self.cfg['start_dir'], 'src', 'start', 'libcp2k.h')
            target_header = os.path.join(targetdir, os.path.basename(libcp2k_header))
            copy_file(libcp2k_header, target_header)
            # include all .mod files for fortran users (don't know the exact list so take everything)
            mod_path = os.path.join(self.cfg['start_dir'], 'obj', self.typearch, self.cfg['type'])
            for mod_file in glob.glob(os.path.join(mod_path, '*.mod')):
                target_mod = os.path.join(targetdir, os.path.basename(mod_file))
                copy_file(mod_file, target_mod)

        # copy data dir
        datadir = os.path.join(self.cfg['start_dir'], 'data')
        targetdir = os.path.join(self.installdir, 'data')
        if os.path.exists(targetdir):
            self.log.info("Won't copy data dir. Destination directory %s already exists" % targetdir)
        elif os.path.exists(datadir):
            copy_dir(datadir, targetdir)
        else:
            self.log.info("Won't copy data dir. Source directory %s does not exist" % datadir)

        # copy tests
        srctests = os.path.join(self.cfg['start_dir'], 'tests')
        targetdir = os.path.join(self.installdir, 'tests')
        if os.path.exists(targetdir):
            self.log.info("Won't copy tests. Destination directory %s already exists" % targetdir)
        else:
            copy_dir(srctests, targetdir)

        # copy regression test results
        if self.cfg['runtest']:
            try:
                testdir = os.path.dirname(os.path.normpath(self.cfg['start_dir']))
                for d in os.listdir(testdir):
                    if d.startswith('TEST-%s-%s' % (self.typearch, self.cfg['type'])):
                        path = os.path.join(testdir, d)
                        target = os.path.join(self.installdir, d)
                        copy_dir(path, target)
                        self.log.info("Regression test results dir %s copied to %s" % (d, self.installdir))
                        break
            except (OSError, IOError) as err:
                raise EasyBuildError("Failed to copy regression test results dir: %s", err)
Exemple #22
0
    def install_step(self):
        """Install built CP2K
        - copy from exe to bin
        - copy data dir (if exists)
        - copy tests
        """

        # copy executables
        exedir = os.path.join(self.cfg['start_dir'], 'exe', self.typearch)
        targetdir = os.path.join(self.installdir, 'bin')
        copy_dir(exedir, targetdir)

        # copy libraries and include files, not sure what is strictly required so we take everything
        if self.cfg['library']:
            libdir = os.path.join(self.cfg['start_dir'], 'lib', self.typearch, self.cfg['type'])
            targetdir = os.path.join(self.installdir, 'lib')
            copy_dir(libdir, targetdir)
            # Also need to populate the include directory
            targetdir = os.path.join(self.installdir, 'include')
            libcp2k_header = os.path.join(self.cfg['start_dir'], 'src', 'start', 'libcp2k.h')
            target_header = os.path.join(targetdir, os.path.basename(libcp2k_header))
            copy_file(libcp2k_header, target_header)
            # include all .mod files for fortran users (don't know the exact list so take everything)
            mod_path = os.path.join(self.cfg['start_dir'], 'obj', self.typearch, self.cfg['type'])
            for mod_file in glob.glob(os.path.join(mod_path, '*.mod')):
                target_mod = os.path.join(targetdir, os.path.basename(mod_file))
                copy_file(mod_file, target_mod)

        # copy data dir
        datadir = os.path.join(self.cfg['start_dir'], 'data')
        targetdir = os.path.join(self.installdir, 'data')
        if os.path.exists(targetdir):
            self.log.info("Won't copy data dir. Destination directory %s already exists" % targetdir)
        elif os.path.exists(datadir):
            copy_dir(datadir, targetdir)
        else:
            self.log.info("Won't copy data dir. Source directory %s does not exist" % datadir)

        # copy tests
        srctests = os.path.join(self.cfg['start_dir'], 'tests')
        targetdir = os.path.join(self.installdir, 'tests')
        if os.path.exists(targetdir):
            self.log.info("Won't copy tests. Destination directory %s already exists" % targetdir)
        else:
            copy_dir(srctests, targetdir)

        # copy regression test results
        if self.cfg['runtest']:
            try:
                testdir = os.path.dirname(os.path.normpath(self.cfg['start_dir']))
                for d in os.listdir(testdir):
                    if d.startswith('TEST-%s-%s' % (self.typearch, self.cfg['type'])):
                        path = os.path.join(testdir, d)
                        target = os.path.join(self.installdir, d)
                        copy_dir(path, target)
                        self.log.info("Regression test results dir %s copied to %s" % (d, self.installdir))
                        break
            except (OSError, IOError) as err:
                raise EasyBuildError("Failed to copy regression test results dir: %s", err)
Exemple #23
0
 def copy_binaries(path):
     full_dir = os.path.join(self.cfg['start_dir'], path)
     self.log.info("Looking for binaries in %s" % full_dir)
     for filename in os.listdir(full_dir):
         full_path = os.path.join(full_dir, filename)
         if os.path.isfile(full_path):
             if filename.endswith('.x'):
                 copy_file(full_path, bindir)
Exemple #24
0
    def install_step(self):
        """Install Gurobi and license file."""
        # make sure license file is available
        if self.cfg['license_file'] is None or not os.path.exists(self.cfg['license_file']):
            raise EasyBuildError("No existing license file specified: %s", self.cfg['license_file'])

        super(EB_Gurobi, self).install_step()

        copy_file(self.cfg['license_file'], os.path.join(self.installdir, 'gurobi.lic'))
Exemple #25
0
    def configure_step(self):
        """Configure MATLAB installation: create license file."""

        licfile = self.cfg['license_file']
        if licfile is None:
            licserv = self.cfg['license_server']
            if licserv is None:
                licserv = os.getenv('EB_MATLAB_LICENSE_SERVER',
                                    'license.example.com')
            licport = self.cfg['license_server_port']
            if licport is None:
                licport = os.getenv('EB_MATLAB_LICENSE_SERVER_PORT', '00000')
            # create license file
            lictxt = '\n'.join([
                "SERVER %s 000000000000 %s" % (licserv, licport),
                "USE_SERVER",
            ])

            licfile = os.path.join(self.builddir, 'matlab.lic')
            write_file(licfile, lictxt)

        try:
            copy_file(
                os.path.join(self.cfg['start_dir'], 'installer_input.txt'),
                self.configfile)
            adjust_permissions(self.configfile, stat.S_IWUSR)

            # read file in binary mode to avoid UTF-8 encoding issues when using Python 3,
            # due to non-UTF-8 characters...
            config = read_file(self.configfile, mode='rb')

            # use raw byte strings (must be 'br', not 'rb'),
            # required when using Python 3 because file was read in binary mode
            regdest = re.compile(br"^# destinationFolder=.*", re.M)
            regagree = re.compile(br"^# agreeToLicense=.*", re.M)
            regmode = re.compile(br"^# mode=.*", re.M)
            reglicpath = re.compile(br"^# licensePath=.*", re.M)

            # must use byte-strings here when using Python 3, see above
            config = regdest.sub(
                b"destinationFolder=%s" % self.installdir.encode('utf-8'),
                config)
            config = regagree.sub(b"agreeToLicense=Yes", config)
            config = regmode.sub(b"mode=silent", config)
            config = reglicpath.sub(
                b"licensePath=%s" % licfile.encode('utf-8'), config)

            write_file(self.configfile, config)

        except IOError as err:
            raise EasyBuildError(
                "Failed to create installation config file %s: %s",
                self.configfile, err)

        self.log.debug('configuration file written to %s:\n %s',
                       self.configfile, config)
    def install_step(self):
        """Install by copying bniaries to install dir."""

        bindir = os.path.join(self.installdir, 'bin')
        mkdir(bindir)

        src = os.path.join(self.cfg['start_dir'], 'mb')
        dst = os.path.join(bindir, 'mb')
        copy_file(src, dst)
        self.log.info("Successfully copied %s to %s", src, dst)
Exemple #27
0
    def install_step(self):
        """Install by copying bniaries to install dir."""

        bindir = os.path.join(self.installdir, 'bin')
        mkdir(bindir)

        src = os.path.join(self.cfg['start_dir'], 'mb')
        dst = os.path.join(bindir, 'mb')
        copy_file(src, dst)
        self.log.info("Successfully copied %s to %s", src, dst)
    def configure_step(self):
        """
        Configure LAPACK for build: copy build_step.inc and set make options
        """

        # copy build_step.inc file from examples
        if self.toolchain.comp_family() == toolchain.GCC:  # @UndefinedVariable
            makeinc = 'gfortran'
        elif self.toolchain.comp_family(
        ) == toolchain.INTELCOMP:  # @UndefinedVariable
            makeinc = 'ifort'
        else:
            raise EasyBuildError(
                "Don't know which build_step.inc file to pick, unknown compiler being used..."
            )

        src = os.path.join(self.cfg['start_dir'], 'INSTALL',
                           'make.inc.%s' % makeinc)
        dest = os.path.join(self.cfg['start_dir'], 'make.inc')

        if os.path.exists(dest):
            raise EasyBuildError("Destination file %s exists", dest)
        else:
            copy_file(src, dest)

        # set optimization flags
        fpic = ''
        if self.toolchain.options['pic']:
            fpic = '-fPIC'
        self.cfg.update('buildopts',
                        'OPTS="$FFLAGS -m64" NOOPT="%s -m64 -O0"' % fpic)

        # prematurely exit configure when we're only testing
        if self.cfg['test_only']:
            self.log.info('Only testing, so skipping rest of configure.')
            return

        # supply blas lib (or not)
        if self.cfg['supply_blas']:

            blaslib = self.get_blaslib()

            self.log.debug("Providing '%s' as BLAS lib" % blaslib)
            self.cfg.update('buildopts', 'BLASLIB="%s"' % blaslib)

        else:
            self.log.debug("Not providing a BLAS lib to LAPACK.")
            self.cfg.update('buildopts', 'BLASLIB=""')

        # only build library if we're not supplying a BLAS library (otherwise testing fails)
        if not self.cfg['supply_blas']:
            self.log.info(
                'No BLAS library provided, so only building LAPACK library (no testing).'
            )
            self.cfg.update('buildopts', 'lib')
Exemple #29
0
 def update_config_guess(self, path):
     """Update any config.guess found in specified directory"""
     for config_guess_dir in (root for root, _, files in os.walk(path) if 'config.guess' in files):
         config_guess = os.path.join(config_guess_dir, 'config.guess')
         if not check_config_guess(config_guess):
             updated_config_guess = obtain_config_guess()
             if updated_config_guess:
                 self.log.debug("Replacing outdated %s with more recent %s", config_guess, updated_config_guess)
                 copy_file(updated_config_guess, config_guess)
             else:
                 raise EasyBuildError("Failed to obtain updated config.guess")
Exemple #30
0
    def extract_step(self):
        """Unpack the source"""
        if LooseVersion(self.version) < LooseVersion('1.7'):

            copy_file(self.src[0]['path'], self.builddir)
            adjust_permissions(os.path.join(self.builddir, self.src[0]['name']), stat.S_IXUSR, add=True)

            change_dir(self.builddir)
            run_cmd(os.path.join(self.builddir, self.src[0]['name']), log_all=True, simple=True, inp='')
        else:
            PackedBinary.extract_step(self)
    def add_patch(self, patch, name):
        """
        Add patch file to repository

        :param patch: location of patch file
        :param name: software name
        :return: location of archived patch
        """
        full_path = os.path.join(self.wc, self.subdir, name, os.path.basename(patch))
        copy_file(patch, full_path)
        return full_path
    def add_patch(self, patch, name):
        """
        Add patch file to repository

        :param patch: location of patch file
        :param name: software name
        :return: location of archived patch
        """
        full_path = os.path.join(self.wc, self.subdir, name, os.path.basename(patch))
        copy_file(patch, full_path)
        return full_path
    def install_step(self):
        """Install Gurobi and license file."""
        # make sure license file is available
        if self.cfg['license_file'] is None or not os.path.exists(self.cfg['license_file']):
            raise EasyBuildError("No existing license file specified: %s", self.cfg['license_file'])

        super(EB_Gurobi, self).install_step()

        copy_file(self.cfg['license_file'], os.path.join(self.installdir, 'gurobi.lic'))

        if get_software_root('Python'):
            run_cmd("python setup.py install --prefix=%s" % self.installdir)
    def install_step(self):
        """Install Gurobi and license file."""
        # make sure license file is available
        if self.cfg['license_file'] is None or not os.path.exists(
                self.cfg['license_file']):
            raise EasyBuildError("No existing license file specified: %s",
                                 self.cfg['license_file'])

        super(EB_Gurobi, self).install_step()

        copy_file(self.cfg['license_file'],
                  os.path.join(self.installdir, 'gurobi.lic'))
Exemple #35
0
    def install_step(self):
        """
        Install CBLAS: copy libraries to install path.
        """
        srcdir = os.path.join(self.cfg['start_dir'], 'lib')
        targetdir = os.path.join(self.installdir, 'lib')

        copy_file(os.path.join(srcdir, 'cblas_LINUX.a'), os.path.join(targetdir, 'libcblas.a'))
        srclib = os.path.join(srcdir, 'libcblas.so')
        if os.path.exists(srclib):
            for solib in glob.glob(os.path.join(srcdir, 'libcblas.so*')):
                copy_file(solib, os.path.join(targetdir, os.path.basename(solib)))
    def install_step(self):
        """Install Gurobi and license file."""
        # make sure license file is available
        if self.cfg['license_file'] is None or not os.path.exists(self.cfg['license_file']):
            raise EasyBuildError("No existing license file specified: %s", self.cfg['license_file'])

        super(EB_Gurobi, self).install_step()

        copy_file(self.cfg['license_file'], os.path.join(self.installdir, 'gurobi.lic'))

        if get_software_root('Python'):
            run_cmd("python setup.py install --prefix=%s" % self.installdir)
    def configure_step(self):
        """Configure ScaLAPACK build by copying SLmake.inc.example to SLmake.inc and checking dependencies."""

        src = os.path.join(self.cfg['start_dir'], 'SLmake.inc.example')
        dest = os.path.join(self.cfg['start_dir'], 'SLmake.inc')

        if os.path.exists(dest):
            raise EasyBuildError("Destination file %s exists", dest)
        else:
            copy_file(src, dest)

        self.loosever = LooseVersion(self.version)
    def install_step(self):
        """
        Install CBLAS: copy libraries to install path.
        """
        srcdir = os.path.join(self.cfg["start_dir"], "lib")
        targetdir = os.path.join(self.installdir, "lib")

        copy_file(os.path.join(srcdir, "cblas_LINUX.a"), os.path.join(targetdir, "libcblas.a"))
        srclib = os.path.join(srcdir, "libcblas.so")
        if os.path.exists(srclib):
            for solib in glob.glob(os.path.join(srcdir, "libcblas.so*")):
                copy_file(solib, os.path.join(targetdir, os.path.basename(solib)))
    def configure_step(self):
        """Configure ScaLAPACK build by copying SLmake.inc.example to SLmake.inc and checking dependencies."""

        src = os.path.join(self.cfg['start_dir'], 'SLmake.inc.example')
        dest = os.path.join(self.cfg['start_dir'], 'SLmake.inc')

        if os.path.exists(dest):
            raise EasyBuildError("Destination file %s exists", dest)
        else:
            copy_file(src, dest)

        self.loosever = LooseVersion(self.version)
    def configure_step(self):
        """Configure COMSOL installation: create license file."""

        # The tar file comes from the DVD and has 0444 as permission at the top dir.
        adjust_permissions(self.start_dir, stat.S_IWUSR)

        default_lic_env_var = 'LMCOMSOL_LICENSE_FILE'
        lic_specs, self.license_env_var = find_flexlm_license(custom_env_vars=[default_lic_env_var],
                                                              lic_specs=[self.cfg['license_file']])

        if lic_specs:
            if self.license_env_var is None:
                self.log.info("Using COMSOL license specifications from 'license_file': %s", lic_specs)
                self.license_env_var = default_lic_env_var
            else:
                self.log.info("Using COMSOL license specifications from $%s: %s", self.license_env_var, lic_specs)

            self.license_file = os.pathsep.join(lic_specs)
            env.setvar(self.license_env_var, self.license_file)
        else:
            msg = "No viable license specifications found; "
            msg += "specify 'license_file', or define $%s" % default_lic_env_var
            raise EasyBuildError(msg)

        copy_file(os.path.join(self.start_dir, 'setupconfig.ini'), self.configfile)
        config = read_file(self.configfile)

        config_vars = {
            'agree': '1',
            'desktopshortcuts': '0',
            'fileassoc': '0',
            'firewall': '0',
            'installdir': self.installdir,
            'license': self.license_file,
            'licmanager': '0',
            'linuxlauncher': '0',
            'showgui': '0',
            'startmenushortcuts': '0',
            'symlinks': '0',
        }

        matlab_root = get_software_root("MATLAB")
        if matlab_root:
            config_vars.update({'matlabdir': matlab_root})

        for key, val in config_vars.items():
            regex = re.compile(r"^%s\s*=.*" % key, re.M)
            config = regex.sub("%s=%s" % (key, val), config)

        write_file(self.configfile, config)

        self.log.debug('configuration file written to %s:\n %s', self.configfile, config)
Exemple #41
0
    def install_step(self):
        """Custom build step for VMD."""

        # Install must also be done in 'src' subdir
        change_dir(os.path.join(self.vmddir, 'src'))
        super(EB_VMD, self).install_step()

        if LooseVersion(self.version) >= LooseVersion("1.9.3"):
            surf_bin = os.path.join(self.surf_dir, 'surf')
            copy_file(surf_bin, os.path.join(self.installdir, 'lib', 'surf_LINUXAMD64'))
            if self.have_stride:
                stride_bin = os.path.join(self.stride_dir, 'stride')
                copy_file(stride_bin, os.path.join(self.installdir, 'lib', 'stride_LINUXAMD64'))
    def install_step(self):
        """
        Install binary and a wrapper that loads correct CUDA version.
        """

        # for versions < 1.4.0 and at least for version 1.4.2 the binary is directly in the builddir
        # for versions 1.4.0 and 1.4.4 the binary is in a subdirectory {self.name}_{self.version}
        if (LooseVersion(self.version) >= LooseVersion("1.4")):
            pattern1 = os.path.join(self.builddir, '%s*' % self.motioncor2_bin)
            pattern2 = os.path.join(self.builddir,
                                    '%s_%s' % (self.name, self.version),
                                    '%s*' % self.motioncor2_bin)
            matches = glob.glob(pattern1) + glob.glob(pattern2)

            if len(matches) == 1:
                src_mc2_bin = matches[0]
            else:
                raise EasyBuildError(
                    "Found multiple, or no, matching MotionCor2 binary named %s*"
                    % self.motioncor2_bin)
        else:
            src_mc2_bin = os.path.join(self.builddir, self.motioncor2_bin)
        if not os.path.exists(src_mc2_bin):
            raise EasyBuildError(
                "Specified CUDA version has no corresponding MotionCor2 binary named %s"
                % self.motioncor2_bin)

        bindir = os.path.join(self.installdir, 'bin')
        mkdir(bindir)

        dst_mc2_bin = os.path.join(bindir, self.motioncor2_bin)
        copy_file(src_mc2_bin, dst_mc2_bin)

        exe_perms = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
        read_perms = stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH
        perms = read_perms | exe_perms

        adjust_permissions(dst_mc2_bin, perms, add=True)

        # Install a wrapper that loads CUDA before starting the binary
        wrapper = os.path.join(bindir, 'motioncor2')
        txt = '\n'.join([
            '#!/bin/bash', '',
            '# Wrapper for MotionCor2 binary that loads the required',
            '# version of CUDA',
            'module unload %s' % self.cuda_name,
            'module add %s' % self.cuda_mod_name,
            'exec %s "$@"' % dst_mc2_bin
        ])
        write_file(wrapper, txt)
        adjust_permissions(wrapper, exe_perms, add=True)
Exemple #43
0
    def install_step(self):
        """
        Install CBLAS: copy libraries to install path.
        """
        srcdir = os.path.join(self.cfg['start_dir'], 'lib')
        targetdir = os.path.join(self.installdir, 'lib')

        copy_file(os.path.join(srcdir, 'cblas_LINUX.a'),
                  os.path.join(targetdir, 'libcblas.a'))
        srclib = os.path.join(srcdir, 'libcblas.so')
        if os.path.exists(srclib):
            for solib in glob.glob(os.path.join(srcdir, 'libcblas.so*')):
                copy_file(solib,
                          os.path.join(targetdir, os.path.basename(solib)))
Exemple #44
0
    def install_step(self):
        """Custom install procedure for Nim."""

        run_cmd("./koch geninstall")
        run_cmd("sh install.sh %s" % self.installdir)

        # install.sh copies stuff into <prefix>/nim, so move it
        nim_dir = os.path.join(self.installdir, 'nim')
        for entry in os.listdir(nim_dir):
            move_file(os.path.join(nim_dir, entry), os.path.join(self.installdir, entry))

        # also copy nimble/nimgrep/nimsuggest tools
        for tool in ['nimble', 'nimgrep', 'nimsuggest']:
            copy_file(os.path.join('bin', tool), os.path.join(self.installdir, 'bin', tool))
    def extract_step(self):
        """Copy all source files to the build directory"""

        if self.cfg.get('extract_sources', False):
            super(Binary, self).extract_step()
        else:
            # required for correctly guessing start directory
            self.src[0]['finalpath'] = self.builddir

            # copy source to build dir
            for source in self.src:
                dst = os.path.join(self.builddir, source['name'])
                copy_file(source['path'], dst)
                adjust_permissions(dst, stat.S_IRWXU, add=True)
    def install_step(self):
        """Install by copying files/directories."""
        bindir = os.path.join(self.installdir, 'bin')
        binfiles = ['snphylo.sh', 'snphylo.cfg', 'snphylo.template']

        predir = ''
        if LooseVersion(self.version) >= LooseVersion('20160204'):
            predir = 'SNPhylo'

        mkdir(bindir, parents=True)
        for binfile in binfiles:
            copy_file(os.path.join(self.builddir, predir, binfile), bindir)

        copy_dir(os.path.join(self.builddir, predir, 'scripts'), os.path.join(self.installdir, 'scripts'))
    def configure_step(self):
        """
        Configure LAPACK for build: copy build_step.inc and set make options
        """

        # copy build_step.inc file from examples
        if self.toolchain.comp_family() == toolchain.GCC:  #@UndefinedVariable
            makeinc = 'gfortran'
        elif self.toolchain.comp_family() == toolchain.INTELCOMP:  #@UndefinedVariable
            makeinc = 'ifort'
        else:
            raise EasyBuildError("Don't know which build_step.inc file to pick, unknown compiler being used...")

        src = os.path.join(self.cfg['start_dir'], 'INSTALL', 'make.inc.%s' % makeinc)
        dest = os.path.join(self.cfg['start_dir'], 'make.inc')

        if os.path.exists(dest):
            raise EasyBuildError("Destination file %s exists", dest)
        else:
            copy_file(src, dest)

        # set optimization flags
        fpic = ''
        if self.toolchain.options['pic']:
            fpic = '-fPIC'
        self.cfg.update('buildopts', 'OPTS="$FFLAGS -m64" NOOPT="%s -m64 -O0"' % fpic)

        # prematurely exit configure when we're only testing
        if self.cfg['test_only']:
            self.log.info('Only testing, so skipping rest of configure.')
            return

        # supply blas lib (or not)
        if self.cfg['supply_blas']:

            blaslib = self.get_blaslib()

            self.log.debug("Providing '%s' as BLAS lib" % blaslib)
            self.cfg.update('buildopts', 'BLASLIB="%s"' % blaslib)

        else:
            self.log.debug("Not providing a BLAS lib to LAPACK.")
            self.cfg.update('buildopts', 'BLASLIB=""')

        # only build library if we're not supplying a BLAS library (otherwise testing fails)
        if not self.cfg['supply_blas']:
            self.log.info('No BLAS library provided, so only building LAPACK library (no testing).')
            self.cfg.update('buildopts', 'lib')
    def configure_step(self):
        """Copy the makefile to the source directory and use MPIF90 to do a parrallel build"""

        self.cfg.update('buildopts', 'LD="$MPIF90 -o" FC="$MPIF90 -c" par')

        if self.with_plumed:
            source_dir = 'srcmod'
            self.cfg.update('buildopts', 'LDFLAGS="${LDFLAGS} -lplumed -ldl"')
        else:
            source_dir = 'source'

        copy_file(os.path.join('build', 'MakePAR'), os.path.join(source_dir, 'Makefile'))
        try:
            os.chdir(source_dir)
        except OSError as err:
            raise EasyBuildError("Failed to change to %s: %s", source_dir, err)
    def install_step(self):
        """Install by copying files to install dir."""

        # include files and libraries
        path_info = [
            ('SRC', 'include', '.h'), # include files
            ('', 'lib', '.a'), # libraries
        ]
        for (srcdir, destdir, ext) in path_info:

            src = os.path.join(self.cfg['start_dir'], srcdir)
            dest = os.path.join(self.installdir, destdir)

            for lib in glob.glob(os.path.join(src, '*%s' % ext)):
                copy_file(lib, os.path.join(dest, os.path.basename(lib)))
                self.log.debug("Copied %s to %s" % (lib, dest))
    def install_step(self):
        """
        Install by copying files to install dir
        """
        if LooseVersion(self.version) >= LooseVersion('3.3.4'):
            CMakeMake.install_step(self)
        else:
            mkdir(os.path.join(self.installdir, 'include'), parents=True)
            for subdir in ['Eigen', 'unsupported']:
                srcdir = os.path.join(self.cfg['start_dir'], subdir)
                destdir = os.path.join(self.installdir, os.path.join('include', subdir))
                copy_dir(srcdir, destdir, ignore=shutil.ignore_patterns('CMakeLists.txt'))

            if LooseVersion(self.version) >= LooseVersion('3.0'):
                srcfile = os.path.join(self.cfg['start_dir'], 'signature_of_eigen3_matrix_library')
                destfile = os.path.join(self.installdir, 'include/signature_of_eigen3_matrix_library')
                copy_file(srcfile, destfile)
    def build_step(self):
        """Run multiple times for different sources"""

        # BCALM is a git submodule of BWISE but we use it as a dependency because
        # it also has submodules and it's from a different developer
        bcalm = get_software_root('BCALM')
        if not bcalm:
            raise EasyBuildError("BWISE needs BCALM to work")

        makefiles_fixes = [
            (r'^CC=.*$', 'CC=$(CXX)'),
            (r'^CFLAGS=.*$', 'CFLAGS:=$(CFLAGS)'),
            (r'^LDFLAGS=.*$', 'LDFLAGS:=$(LDFLAGS) -fopenmp')
        ]

        def find_build_subdir(pattern):
            """Changes to the sub directory that matches the given pattern"""
            subdir = glob.glob(os.path.join(self.builddir, pattern))
            if subdir:
                change_dir(subdir[0])
                apply_regex_substitutions('makefile', makefiles_fixes)
                super(EB_BWISE, self).build_step()
                return subdir[0]
            else:
                raise EasyBuildError("Could not find a subdirectory matching the pattern %s", pattern)

        # BWISE has 3 independant parts, we build them one by one
        # first BWISE itself
        subdir = find_build_subdir(os.path.join('BWISE-*', 'src'))
        apply_regex_substitutions(os.path.join(subdir, '..', 'Bwise.py'),
                                  [(r'^BWISE_MAIN = .*$', 'BWISE_MAIN = os.environ[\'EBROOTBWISE\']')])

        # Onwards to BGREAT
        subdir = find_build_subdir('BGREAT2-*')
        copy_file(os.path.join(subdir, 'bgreat'), self.cfg['start_dir'])

        # Finally, BTRIM
        subdir = find_build_subdir('BTRIM-*')
        copy_file(os.path.join(subdir, 'btrim'), self.cfg['start_dir'])

        binaries = ['sequencesToNumbers', 'numbersFilter', 'path_counter', 'maximal_sr', 'simulator',
                    'path_to_kmer', 'K2000/*.py', 'K2000/*.sh']
        self.cfg['files_to_copy'] = [(['bgreat', 'btrim', 'Bwise.py'] + ['src/%s' % x for x in binaries], 'bin'),
                                     'data']
    def configure_step(self):
        """
        Configure CBLAS build by copying Makefile.LINUX to Makefile.in, and setting make options
        """
        copy_file("Makefile.LINUX", "Makefile.in")

        if not self.cfg["buildopts"]:
            self.cfg.update("buildopts", "all")

        self.cfg.update("buildopts", 'CC="%s"' % os.getenv("CC"))
        self.cfg.update("buildopts", 'FC="%s"' % os.getenv("F77"))
        self.cfg.update("buildopts", 'CFLAGS="%s -DADD_"' % os.getenv("CFLAGS"))
        self.cfg.update("buildopts", 'FFLAGS="%s -DADD_"' % os.getenv("FFLAGS"))
        blas_lib_dir = os.getenv("BLAS_LIB_DIR")
        blas_libs = []
        for blas_lib in os.getenv("BLAS_STATIC_LIBS").split(","):
            blas_lib = os.path.join(blas_lib_dir, blas_lib)
            if os.path.exists(blas_lib):
                blas_libs.append(blas_lib)
        self.cfg.update("buildopts", 'BLLIB="%s %s"' % (" ".join(blas_libs), os.getenv("LIBS", "")))
Exemple #53
0
    def configure_step(self):
        """
        Configure CBLAS build by copying Makefile.LINUX to Makefile.in, and setting make options
        """
        copy_file('Makefile.LINUX', 'Makefile.in')

        if not self.cfg['buildopts']:
            self.cfg.update('buildopts', 'all')

        self.cfg.update('buildopts', 'CC="%s"' % os.getenv('CC'))
        self.cfg.update('buildopts', 'FC="%s"' % os.getenv('F77'))
        self.cfg.update('buildopts', 'CFLAGS="%s -DADD_"' % os.getenv('CFLAGS'))
        self.cfg.update('buildopts', 'FFLAGS="%s -DADD_"' % os.getenv('FFLAGS'))
        blas_lib_dir = os.getenv('BLAS_LIB_DIR')
        blas_libs = []
        for blas_lib in os.getenv('BLAS_STATIC_LIBS').split(','):
            blas_lib = os.path.join(blas_lib_dir, blas_lib)
            if os.path.exists(blas_lib):
                blas_libs.append(blas_lib)
        self.cfg.update('buildopts', 'BLLIB="%s %s"' % (' '.join(blas_libs), os.getenv('LIBS', '')))
    def install_step(self):
        """Custom install step for Quantum ESPRESSO."""

        # extract build targets as list
        targets = self.cfg['buildopts'].split()

        # Copy all binaries
        bindir = os.path.join(self.installdir, 'bin')
        copy_dir(os.path.join(self.cfg['start_dir'], 'bin'), bindir)

        # Pick up files not installed in bin
        upftools = []
        if 'upf' in targets or 'all' in targets:
            upftools = ["casino2upf.x", "cpmd2upf.x", "fhi2upf.x", "fpmd2upf.x", "ncpp2upf.x",
                        "oldcp2upf.x", "read_upf_tofile.x", "rrkj2upf.x", "uspp2upf.x", "vdb2upf.x",
                        "virtual.x"]
            if LooseVersion(self.version) > LooseVersion("5"):
                upftools.extend(["interpolate.x", "upf2casino.x"])
            if LooseVersion(self.version) >= LooseVersion("6.3"):
                upftools.extend(["fix_upf.x"])
        upf_bins = [os.path.join('upftools', x) for x in upftools]
        for upf_bin in upf_bins:
            copy_file(os.path.join(self.cfg['start_dir'], upf_bin), bindir)

        wanttools = []
        if 'want' in targets:
            wanttools = ["blc2wan.x", "conductor.x", "current.x", "disentangle.x",
                         "dos.x", "gcube2plt.x", "kgrid.x", "midpoint.x", "plot.x", "sumpdos",
                         "wannier.x", "wfk2etsf.x"]
            if LooseVersion(self.version) > LooseVersion("5"):
                wanttools.extend(["cmplx_bands.x", "decay.x", "sax2qexml.x", "sum_sgm.x"])
        want_bins = [os.path.join('WANT', 'bin', x) for x in wanttools]
        for want_bin in want_bins:
            copy_file(os.path.join(self.cfg['start_dir'], want_bin), bindir)

        w90tools = []
        if 'w90' in targets:
            if LooseVersion(self.version) >= LooseVersion("5.4"):
                w90tools = ["postw90.x"]
                if LooseVersion(self.version) < LooseVersion("6.1"):
                    w90tools = ["w90chk2chk.x"]
        w90_bins = [os.path.join('W90', x) for x in w90tools]
        for w90_bin in w90_bins:
            copy_file(os.path.join(self.cfg['start_dir'], w90_bin), bindir)

        yambo_bins = []
        if 'yambo' in targets:
            yambo_bins = ["a2y", "p2y", "yambo", "ypp"]
        yambo_bins = [os.path.join('YAMBO', 'bin', x) for x in yambo_bins]
        for yambo_bin in yambo_bins:
            copy_file(os.path.join(self.cfg['start_dir'], yambo_bin), bindir)
    def install_step(self):
        """Install Allinea using install script."""

        if self.cfg['install_cmd'] is None:
            self.cfg['install_cmd'] = "./textinstall.sh --accept-licence %s" % self.installdir

        super(EB_Allinea, self).install_step()

        # copy license file
        lic_path = os.path.join(self.installdir, 'licences')
        try:
            shutil.copy2(self.cfg['license_file'], lic_path)
        except OSError as err:
            raise EasyBuildError("Failed to copy license file to %s: %s", lic_path, err)

        # copy templates
        templ_path = os.path.join(self.installdir, 'templates')
        for templ in self.cfg['templates']:
            path = self.obtain_file(templ, extension='qtf')
            if path:
                self.log.debug('Template file %s found' % path)
            else:
                raise EasyBuildError('No template file named %s found', templ)

            try:
                # use shutil.copy (not copy2) so that permissions of copied file match with rest of installation
                shutil.copy(path, templ_path)
            except OSError as err:
                raise EasyBuildError("Failed to copy template %s to %s: %s", templ, templ_path, err)

        # copy system.config if requested
        sysconf_path = os.path.join(self.installdir, 'system.config')
        if self.cfg['sysconfig'] is not None:
            path = self.obtain_file(self.cfg['sysconfig'], extension=False)
            if path:
                self.log.debug('system.config file %s found' % path)
            else:
                raise EasyBuildError('No system.config file named %s found', sysconfig)

            copy_file(path, sysconf_path)
            adjust_permissions(sysconf_path, stat.S_IRUSR|stat.S_IRGRP|stat.S_IROTH, recursive=False, relative=False)
    def test_step(self):
        """Custom built-in test procedure for TINKER."""
        if self.cfg['runtest']:
            # copy tests, params and built binaries to temporary directory for testing
            tmpdir = tempfile.mkdtemp()
            testdir = os.path.join(tmpdir, 'test')

            mkdir(os.path.join(tmpdir, 'bin'))
            binaries = glob.glob(os.path.join(self.cfg['start_dir'], 'source', '*.x'))
            for binary in binaries:
                copy_file(binary, os.path.join(tmpdir, 'bin', os.path.basename(binary)[:-2]))
            copy_dir(os.path.join(self.cfg['start_dir'], 'test'), testdir)
            copy_dir(os.path.join(self.cfg['start_dir'], 'params'), os.path.join(tmpdir, 'params'))

            change_dir(testdir)

            # run all tests via the provided 'run' scripts
            tests = glob.glob(os.path.join(testdir, '*.run'))
            # gpcr takes too logn (~1h), ifabp fails due to input issues (?)
            tests = [t for t in tests if not (t.endswith('gpcr.run') or t.endswith('ifabp.run'))]
            for test in tests:
                run_cmd(test)
Exemple #57
0
    def test_long_module_path(self):
        """Test dealing with a (very) long module path."""

        # create a really long modules install path
        tmpdir = tempfile.mkdtemp()
        long_mod_path = tmpdir
        subdir = 'foo'
        # Lmod v5.1.5 doesn't support module paths longer than 256 characters, so stay just under that magic limit
        while (len(os.path.abspath(long_mod_path)) + len(subdir)) < 240:
            long_mod_path = os.path.join(long_mod_path, subdir)

        # copy one of the test modules there
        gcc_mod_dir = os.path.join(long_mod_path, 'GCC')
        os.makedirs(gcc_mod_dir)
        gcc_mod_path = os.path.join(os.path.dirname(__file__), 'modules', 'GCC', '4.6.3')
        copy_file(gcc_mod_path, gcc_mod_dir)

        # try and use long modules path
        self.init_testmods(test_modules_paths=[long_mod_path])
        ms = self.modtool.available()

        self.assertEqual(ms, ['GCC/4.6.3'])

        shutil.rmtree(tmpdir)
    def install_step(self):
        """Install using 'make install', also install libiberty if desired."""
        super(EB_binutils, self).install_step()

        # only install libiberty files if if they're not there yet;
        # libiberty.a is installed by default for old binutils versions
        if self.cfg['install_libiberty']:
            if not os.path.exists(os.path.join(self.installdir, 'include', 'libiberty.h')):
                copy_file(os.path.join(self.cfg['start_dir'], 'include', 'libiberty.h'),
                          os.path.join(self.installdir, 'include', 'libiberty.h'))

            if not glob.glob(os.path.join(self.installdir, 'lib*', 'libiberty.a')):
                copy_file(os.path.join(self.cfg['start_dir'], 'libiberty', 'libiberty.a'),
                          os.path.join(self.installdir, 'lib', 'libiberty.a'))

            if not os.path.exists(os.path.join(self.installdir, 'info', 'libiberty.texi')):
                copy_file(os.path.join(self.cfg['start_dir'], 'libiberty', 'libiberty.texi'),
                          os.path.join(self.installdir, 'info', 'libiberty.texi'))
    def configure_step(self):
        """
        Custom configure and build procedure for Siesta.
        - There are two main builds to do, siesta and transiesta
        - In addition there are multiple support tools to build
        """

        start_dir = self.cfg['start_dir']
        obj_dir = os.path.join(start_dir, 'Obj')
        arch_make = os.path.join(obj_dir, 'arch.make')
        bindir = os.path.join(start_dir, 'bin')

        par = ''
        if LooseVersion(self.version) >= LooseVersion('4.1'):
            par = '-j %s' % self.cfg['parallel']

        # enable OpenMP support if desired
        env_var_suff = ''
        if self.toolchain.options.get('openmp', None):
            env_var_suff = '_MT'

        scalapack = os.environ['LIBSCALAPACK' + env_var_suff]
        blacs = os.environ['LIBSCALAPACK' + env_var_suff]
        lapack = os.environ['LIBLAPACK' + env_var_suff]
        blas = os.environ['LIBBLAS' + env_var_suff]
        if get_software_root('imkl') or get_software_root('FFTW'):
            fftw = os.environ['LIBFFT' + env_var_suff]
        else:
            fftw = None

        regex_newlines = []
        regex_subs = [
            ('dc_lapack.a', ''),
            (r'^NETCDF_INTERFACE\s*=.*$', ''),
            ('libsiestaBLAS.a', ''),
            ('libsiestaLAPACK.a', ''),
            # Needed here to allow 4.1-b1 to be built with openmp
            (r"^(LDFLAGS\s*=).*$", r"\1 %s %s" % (os.environ['FCFLAGS'], os.environ['LDFLAGS'])),
        ]

        netcdff_loc = get_software_root('netCDF-Fortran')
        if netcdff_loc:
            # Needed for gfortran at least
            regex_newlines.append((r"^(ARFLAGS_EXTRA\s*=.*)$", r"\1\nNETCDF_INCFLAGS = -I%s/include" % netcdff_loc))

        if fftw:
            fft_inc, fft_lib = os.environ['FFT_INC_DIR'], os.environ['FFT_LIB_DIR']
            fppflags = r"\1\nFFTW_INCFLAGS = -I%s\nFFTW_LIBS = -L%s %s" % (fft_inc, fft_lib, fftw)
            regex_newlines.append((r'(FPPFLAGS\s*=.*)$', fppflags))

        # Make a temp installdir during the build of the various parts
        mkdir(bindir)

        # change to actual build dir
        change_dir(obj_dir)

        # Populate start_dir with makefiles
        run_cmd(os.path.join(start_dir, 'Src', 'obj_setup.sh'), log_all=True, simple=True, log_output=True)

        if LooseVersion(self.version) < LooseVersion('4.1-b2'):
            # MPI?
            if self.toolchain.options.get('usempi', None):
                self.cfg.update('configopts', '--enable-mpi')

            # BLAS and LAPACK
            self.cfg.update('configopts', '--with-blas="%s"' % blas)
            self.cfg.update('configopts', '--with-lapack="%s"' % lapack)

            # ScaLAPACK (and BLACS)
            self.cfg.update('configopts', '--with-scalapack="%s"' % scalapack)
            self.cfg.update('configopts', '--with-blacs="%s"' % blacs)

            # NetCDF-Fortran
            if netcdff_loc:
                self.cfg.update('configopts', '--with-netcdf=-lnetcdff')

            # Configure is run in obj_dir, configure script is in ../Src
            super(EB_Siesta, self).configure_step(cmd_prefix='../Src/')

            if LooseVersion(self.version) > LooseVersion('4.0'):
                regex_subs_Makefile = [
                    (r'CFLAGS\)-c', r'CFLAGS) -c'),
                ]
                apply_regex_substitutions('Makefile', regex_subs_Makefile)

        else: # there's no configure on newer versions

            if self.toolchain.comp_family() in [toolchain.INTELCOMP]:
                copy_file(os.path.join(obj_dir, 'intel.make'), arch_make)
            elif self.toolchain.comp_family() in [toolchain.GCC]:
                copy_file(os.path.join(obj_dir, 'gfortran.make'), arch_make)
            else:
                raise EasyBuildError("There is currently no support for compiler: %s", self.toolchain.comp_family())

            if self.toolchain.options.get('usempi', None):
                regex_subs.extend([
                    (r"^(CC\s*=\s*).*$", r"\1%s" % os.environ['MPICC']),
                    (r"^(FC\s*=\s*).*$", r"\1%s" % os.environ['MPIF90']),
                    (r"^(FPPFLAGS\s*=.*)$", r"\1 -DMPI"),
                ])
                regex_newlines.append((r"^(FPPFLAGS\s*=.*)$", r"\1\nMPI_INTERFACE = libmpi_f90.a\nMPI_INCLUDE = ."))
                complibs = scalapack
            else:
                complibs = lapack

            regex_subs.extend([
                (r"^(LIBS\s*=\s).*$", r"\1 %s" % complibs),
                # Needed for a couple of the utils
                (r"^(FFLAGS\s*=\s*).*$", r"\1 -fPIC %s" % os.environ['FCFLAGS']),
            ])
            regex_newlines.append((r"^(COMP_LIBS\s*=.*)$", r"\1\nWXML = libwxml.a"))

            if netcdff_loc:
                regex_subs.extend([
                    (r"^(LIBS\s*=.*)$", r"\1 $(NETCDF_LIBS)"),
                    (r"^(FPPFLAGS\s*=.*)$", r"\1 -DCDF"),
                ])
                regex_newlines.append((r"^(COMP_LIBS\s*=.*)$", r"\1\nNETCDF_LIBS = -lnetcdff"))

        apply_regex_substitutions(arch_make, regex_subs)

        # individually apply substitutions that add lines
        for regex_nl in regex_newlines:
            apply_regex_substitutions(arch_make, [regex_nl])

        run_cmd('make %s' % par, log_all=True, simple=True, log_output=True)

        # Put binary in temporary install dir
        copy_file(os.path.join(obj_dir, 'siesta'), bindir)

        if self.cfg['with_utils']:
            # Make the utils
            change_dir(os.path.join(start_dir, 'Util'))

            # clean_all.sh might be missing executable bit...
            adjust_permissions('./clean_all.sh', stat.S_IXUSR, recursive=False, relative=True)
            run_cmd('./clean_all.sh', log_all=True, simple=True, log_output=True)

            if LooseVersion(self.version) >= LooseVersion('4.1'):
                regex_subs_TS = [
                    (r"^default:.*$", r""),
                    (r"^EXE\s*=.*$", r""),
                    (r"^(include\s*..ARCH_MAKE.*)$", r"EXE=tshs2tshs\ndefault: $(EXE)\n\1"),
                    (r"^(INCFLAGS.*)$", r"\1 -I%s" % obj_dir),
                ]

                makefile = os.path.join(start_dir, 'Util', 'TS', 'tshs2tshs', 'Makefile')
                apply_regex_substitutions(makefile, regex_subs_TS)

            # SUFFIX rules in wrong place
            regex_subs_suffix = [
                (r'^(\.SUFFIXES:.*)$', r''),
                (r'^(include\s*\$\(ARCH_MAKE\).*)$', r'\1\n.SUFFIXES:\n.SUFFIXES: .c .f .F .o .a .f90 .F90'),
            ]
            makefile = os.path.join(start_dir, 'Util', 'Sockets', 'Makefile')
            apply_regex_substitutions(makefile, regex_subs_suffix)
            makefile = os.path.join(start_dir, 'Util', 'SiestaSubroutine', 'SimpleTest', 'Src', 'Makefile')
            apply_regex_substitutions(makefile, regex_subs_suffix)

            regex_subs_UtilLDFLAGS = [
                (r'(\$\(FC\)\s*-o\s)', r'$(FC) %s %s -o ' % (os.environ['FCFLAGS'], os.environ['LDFLAGS'])),
            ]
            makefile = os.path.join(start_dir, 'Util', 'Optimizer', 'Makefile')
            apply_regex_substitutions(makefile, regex_subs_UtilLDFLAGS)
            makefile = os.path.join(start_dir, 'Util', 'JobList', 'Src', 'Makefile')
            apply_regex_substitutions(makefile, regex_subs_UtilLDFLAGS)

            run_cmd('./build_all.sh', log_all=True, simple=True, log_output=True)

            # Now move all the built utils to the temp installdir
            expected_utils = [
                'Bands/eigfat2plot',
                'CMLComp/ccViz',
                'Contrib/APostnikov/eig2bxsf', 'Contrib/APostnikov/rho2xsf',
                'Contrib/APostnikov/vib2xsf', 'Contrib/APostnikov/fmpdos',
                'Contrib/APostnikov/xv2xsf', 'Contrib/APostnikov/md2axsf',
                'COOP/mprop', 'COOP/fat',
                'Denchar/Src/denchar',
                'DensityMatrix/dm2cdf', 'DensityMatrix/cdf2dm',
                'Eig2DOS/Eig2DOS',
                'Gen-basis/ioncat', 'Gen-basis/gen-basis',
                'Grid/cdf2grid', 'Grid/cdf_laplacian', 'Grid/cdf2xsf',
                'Grid/grid2cube',
                'Grid/grid_rotate', 'Grid/g2c_ng', 'Grid/grid2cdf', 'Grid/grid2val',
                'Helpers/get_chem_labels',
                'HSX/hs2hsx', 'HSX/hsx2hs',
                'JobList/Src/getResults', 'JobList/Src/countJobs',
                'JobList/Src/runJobs', 'JobList/Src/horizontal',
                'Macroave/Src/macroave',
                'ON/lwf2cdf',
                'Optimizer/simplex', 'Optimizer/swarm',
                'pdosxml/pdosxml',
                'Projections/orbmol_proj',
                'SiestaSubroutine/FmixMD/Src/driver',
                'SiestaSubroutine/FmixMD/Src/para',
                'SiestaSubroutine/FmixMD/Src/simple',
                'STM/simple-stm/plstm', 'STM/ol-stm/Src/stm',
                'VCA/mixps', 'VCA/fractional',
                'Vibra/Src/vibra', 'Vibra/Src/fcbuild',
                'WFS/info_wfsx', 'WFS/wfsx2wfs',
                'WFS/readwfx', 'WFS/wfsnc2wfsx', 'WFS/readwf', 'WFS/wfs2wfsx',
            ]

            if LooseVersion(self.version) <= LooseVersion('4.0'):
                expected_utils.extend([
                    'Bands/new.gnubands',
                    'TBTrans/tbtrans',
                ])

            if LooseVersion(self.version) >= LooseVersion('4.0'):
                expected_utils.extend([
                    'SiestaSubroutine/ProtoNEB/Src/protoNEB',
                    'SiestaSubroutine/SimpleTest/Src/simple_pipes_parallel',
                    'SiestaSubroutine/SimpleTest/Src/simple_pipes_serial',
                    'Sockets/f2fmaster', 'Sockets/f2fslave',
                ])

            if LooseVersion(self.version) >= LooseVersion('4.1'):
                expected_utils.extend([
                    'Bands/gnubands',
                    'Grimme/fdf2grimme',
                    'SpPivot/pvtsp',
                    'TS/ts2ts/ts2ts', 'TS/tshs2tshs/tshs2tshs', 'TS/TBtrans/tbtrans',
                ])

            for util in expected_utils:
                copy_file(os.path.join(start_dir, 'Util', util), bindir)

        if self.cfg['with_transiesta']:
            # Build transiesta
            change_dir(obj_dir)

            run_cmd('make clean', log_all=True, simple=True, log_output=True)
            run_cmd('make %s transiesta' % par, log_all=True, simple=True, log_output=True)

            copy_file(os.path.join(obj_dir, 'transiesta'), bindir)