How to use the easybuild.tools.filetools.run_cmd function in easybuild

To help you get started, we’ve selected a few easybuild examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github easybuilders / easybuild-framework / easybuild / easyblocks / _generic_ / binary.py View on Github external
def install_step(self):
        """Copy all files in build directory to the install directory"""
        # can't use shutil.copytree because that doesn't allow the target directory to exist already
        run_cmd("cp -a %s/* %s" % (self.cfg['start_dir'], self.installdir))
github easybuilders / easybuild-framework / easybuild / easyblocks / p / python_minus_meep.py View on Github external
def make(self):
        """Build python-meep using available scripts."""

        # determine make script arguments
        meepinc = os.path.join(get_software_version('Meep'), 'include')
        meeplib = os.path.join(get_software_version('Meep'), 'lib')
        numpyinc = os.path.join(get_software_root('Python'), self.pylibdir, 'numpy', 'core', 'include')

        # determine suffix for make script
        suff = ''
        if self.toolkit().opts['usempi']:
            suff = '-mpi'

        # run make script
        cmd = "./make%s -I%s,%s -L%s" % (suff, meepinc, numpyinc, meeplib)
        run_cmd(cmd, log_all=True, simple=True)
github easybuilders / easybuild-framework / easybuild / easyblocks / b / blacs.py View on Github external
}

        # determine interface and transcomm settings
        comm = ''
        interface = 'UNKNOWN'
        try:
            cwd = os.getcwd()
            os.chdir('INSTALL')

            # need to build
            cmd = "make"
            cmd += " CC='%(mpicc)s' F77='%(mpif77)s -I$(MPIINCdir)'  MPIdir=%(base)s" \
                   " MPILIB='%(mpilib)s' BTOPdir=%(builddir)s INTERFACE=NONE" % opts

            # determine interface using xintface
            run_cmd("%s xintface" % cmd, log_all=True, simple=True)

            interface = det_interface(self.log, "./EXE")

            # try and determine transcomm using xtc_CsameF77 and xtc_UseMpich
            if not comm:

                run_cmd("%s xtc_CsameF77" % cmd, log_all=True, simple=True)
                (out, _) = run_cmd("mpirun -np 2 ./EXE/xtc_CsameF77", log_all=True, simple=False)

                # get rid of first two lines, that inform about how to use this tool
                out = '\n'.join(out.split('\n')[2:])

                notregexp = re.compile("_NOT_")

                if not notregexp.search(out):
                    # if it doesn't say '_NOT_', set it
github easybuilders / easybuild-framework / easybuild / easyblocks / p / pythonpackage.py View on Github external
def build_step(self):
        """Build Python package using setup.py"""

        cmd = "python setup.py build"
        run_cmd(cmd, log_all=True, simple=True)
github easybuilders / easybuild-framework / easybuild / easyblocks / m / mrbayes.py View on Github external
# set generic make options
        self.cfg.update('makeopts', 'CC="%s" OPTFLAGS="%s"' % (os.getenv('MPICC'), os.getenv('CFLAGS')))

        if LooseVersion(self.version) >= LooseVersion("3.2"):

            # set correct start_dir dir, and change into it
            self.cfg['start_dir'] = os.path.join(self.cfg['start_dir'],'src')
            try:
                os.chdir(self.cfg['start_dir'])
            except OSError, err:
                self.log.error("Failed to change to correct source dir %s: %s" % (self.cfg['start_dir'], err))

            # run autoconf to generate configure script
            cmd = "autoconf"
            run_cmd(cmd)

            # set config opts
            beagle = get_software_root('BEAGLE')
            if beagle:
                self.cfg.update('configopts', '--with-beagle=%s' % beagle)
            else:
                self.log.error("BEAGLE module not loaded?")

            if self.toolchain.opts['usempi']:
                self.cfg.update('configopts', '--enable-mpi')

            # configure
            super(EB_MrBayes, self).configure_step()
        else:

            # no configure script prior to v3.2
github fgeorgatos / easybuild.experimental / users / georgets / my_easyblocks / easybuild / easyblocks / namd.py View on Github external
def configure_step(self):
        cmd = "./config " + self.cfg["namd_arch"]  
        cmd += " --charm-arch " + self.cfg["namd_charm_opts"]
        if len(self.cfg["cuda_prefix"]) > 0 :
                cmd += " --with-cuda --cuda-prefix " + self.cfg["cuda_prefix"]

        # FFTW, TCL
        for dep in ["FFTW", "Tcl"]:
            deproot = get_software_root(dep)
            if deproot:
                self.cfg.update('configopts', '--%s-prefix %s' % (dep.lower(), deproot))
        ## cmd += " --tcl-prefix $EBROOTTCL --fftw-prefix $EBROOTFFTW" ##
        cmd += " --tcl-prefix /home/users/fgeorgatos/.local/easybuild/software/Tcl/8.5.12 --fftw-prefix /home/users/fgeorgatos/.local/easybuild/software/FFTW/2.1.5-GCC-4.6.3"

        run_cmd(cmd, path = self.src[0]['finalpath'])
github fgeorgatos / easybuild.experimental / users / georgets / my_easyblocks / easybuild / easyblocks / namd.py View on Github external
def patch_step(self):
        run_cmd("tar xf charm-6.4.0.tar") ###### FIXME ######
        cmd = "./build charm++ " + self.cfg["charm_opts"] 
        cmd += " -j" + str(self.cfg['parallel'])
        cmd += " --with-production"
        run_cmd(cmd, path = "charm-6.4.0")
github easybuilders / easybuild-framework / easybuild / easyblocks / p / python.py View on Github external
elif comp_fam == toolchain.GCC:
            cmdprefix = ""
            ldflags = os.getenv('LDFLAGS')
            if ldflags:
                # LDFLAGS should not be set when building numpy/scipy, because it overwrites whatever numpy/scipy sets
                # see http://projects.scipy.org/numpy/ticket/182
                # don't unset it with os.environ.pop('LDFLAGS'), doesn't work in Python 2.4 (see http://bugs.python.org/issue1287)
                cmdprefix = "unset LDFLAGS && "
                self.log.debug("LDFLAGS was %s, will be cleared before numpy build with '%s'" % (ldflags, cmdprefix))

            cmd = "%s python setup.py build --fcompiler=gnu95" % cmdprefix

        else:
            self.log.error("Unknown family of compilers being used?")

        run_cmd(cmd, log_all=True, simple=True)
github easybuilders / easybuild-framework / easybuild / easyblocks / h / hpl.py View on Github external
basedir = self.cfg['start_dir']
        if subdir:
            makeincfile = os.path.join(basedir, subdir, 'Make.UNKNOWN')
            setupdir = os.path.join(basedir, subdir, 'setup')
        else:
            makeincfile = os.path.join(basedir, 'Make.UNKNOWN')
            setupdir = os.path.join(basedir, 'setup')

        try:
            os.chdir(setupdir)
        except OSError, err:
            self.log.exception("Failed to change to to dir %s: %s" % (setupdir, err))

        cmd = "/bin/bash make_generic"

        run_cmd(cmd, log_all=True, simple=True, log_output=True)

        try:
            os.symlink(os.path.join(setupdir, 'Make.UNKNOWN'), os.path.join(makeincfile))
        except OSError, err:
            self.log.exception("Failed to symlink Make.UNKNOWN from %s to %s: %s" % (setupdir, makeincfile, err))

        # go back
        os.chdir(self.cfg['start_dir'])
github easybuilders / easybuild-framework / easybuild / easyblocks / c / cp2k.py View on Github external
except IOError, err:
                self.log.error("Can't modify/write Makefile in %s: %s" % (makefiles, err))

        # update make options with MAKE
        self.cfg.update('makeopts', 'MAKE="make -j %s" all' % self.cfg['parallel'])

        # update make options with ARCH and VERSION
        self.cfg.update('makeopts', 'ARCH=%s VERSION=%s' % (self.typearch, self.cfg['type']))

        cmd = "make %s" % self.cfg['makeopts']

        # clean first
        run_cmd(cmd + " clean", log_all=True, simple=True, log_output=True)

        #build_and_install
        run_cmd(cmd, log_all=True, simple=True, log_output=True)