Exemple #1
0
def _gnur_install_test(forwarded_args, pkgs, gnur_libinstall,
                       gnur_install_tmp):
    '''
    Install/test with GNU R  exactly those packages that installed correctly with FastR.
    N.B. That means that regardless of how the packages were specified to pkgtest
    we always use a --pkg-filelist' arg to GNU R
    '''
    gnur_packages = join(get_fastr_repo_dir(), 'gnur.packages')
    with open(gnur_packages, 'w') as f:
        for pkg in pkgs:
            f.write(pkg)
            f.write('\n')
    env = os.environ.copy()
    env["TMPDIR"] = gnur_install_tmp
    env['R_LIBS_USER'] = gnur_libinstall
    env["TZDIR"] = "/usr/share/zoneinfo/"

    # forward any explicit args to pkgtest
    args = [_installpkgs_script()]
    args += forwarded_args
    args += ['--pkg-filelist', gnur_packages]
    args += ['--run-tests']
    args += ['--ignore-blacklist']
    args += ['--testdir', get_opts().gnur_testdir]
    log_step('BEGIN', 'install/test', 'GnuR')

    _ensure_R_on_PATH(env, os.path.dirname(get_gnur_rscript()))
    cmd_line = [get_gnur_rscript()] + args
    logging.debug("Running GnuR with cmd line: " + str(cmd_line))
    pkgtest_run(cmd_line, env=env)

    log_step('END', 'install/test', 'GnuR')
Exemple #2
0
def commit_fastr_builtins():
    '''
    There are some FastR builtins which we also want to use in GnuR (i.e. 'install.fastr.packages').
    This function deparses these functions and writes them into a file which is then loaded by GnuR.
    '''
    dest_file = join(_packages_test_project_dir(), 'r', 'fastr.functions.rdx')
    cmd_line = [
        get_fastr_rscript(), "--silent", "-e",
        '{ fastrRepoPath <- NULL; save(fastrRepoPath, install.fastr.packages, file="%s") }'
        % dest_file
    ]
    logging.debug("Generating fastr.functions.R: " + str(cmd_line))
    return pkgtest_run(cmd_line)
Exemple #3
0
def _installpkgs(args, **kwargs):
    '''
    Runs the R script that does package/installation and testing.
    '''
    if kwargs.has_key('env'):
        env = kwargs['env']
    else:
        env = os.environ.copy()
        kwargs['env'] = env

    out = kwargs.get('out', None)
    err = kwargs.get('err', None)

    if "FASTR_WORKING_DIR" in os.environ:
        env["TMPDIR"] = os.environ["FASTR_WORKING_DIR"]

    _ensure_R_on_PATH(env, os.path.dirname(get_fastr_rscript()))
    cmd_line = [get_fastr_rscript(), _installpkgs_script()] + args
    logging.debug("Running FastR with cmd line: " + str(cmd_line))
    return pkgtest_run(cmd_line, out=out, err=err, env=env)