Beispiel #1
0
def get():
    regexp_val = os.environ.get('CHPL_REGEXP')
    if not regexp_val:
        chpl_home = utils.get_chpl_home()
        uniq_cfg_path = chpl_3p_re2_configs.get_uniq_cfg_path()
        regexp_subdir = os.path.join(chpl_home, 'third-party', 're2', 'install',
                                     uniq_cfg_path)
        regexp_header = os.path.join(regexp_subdir, 'include', 're2', 're2.h')
        if os.path.exists(regexp_header):
            regexp_val = 're2'
        else:
            regexp_val = 'none'
    return regexp_val
Beispiel #2
0
def get():
    regexp_val = os.environ.get('CHPL_REGEXP')
    if not regexp_val:
        chpl_home = utils.get_chpl_home()
        uniq_cfg_path = chpl_3p_re2_configs.get_uniq_cfg_path()
        regexp_subdir = os.path.join(chpl_home, 'third-party', 're2',
                                     'install', uniq_cfg_path)
        regexp_header = os.path.join(regexp_subdir, 'include', 're2', 're2.h')
        if os.path.exists(regexp_header):
            regexp_val = 're2'
        else:
            regexp_val = 'none'
    return regexp_val
def get():
    llvm_val = os.environ.get("CHPL_LLVM")
    if not llvm_val:
        host_platform = chpl_platform.get("host")
        host_compiler = chpl_compiler.get("host")
        chpl_home = utils.get_chpl_home()
        llvm_target_dir = "{0}-{1}".format(host_platform, host_compiler)
        llvm_subdir = os.path.join(chpl_home, "third-party", "llvm", "install", llvm_target_dir)
        llvm_header = os.path.join(llvm_subdir, "include", "llvm", "PassSupport.h")
        if os.path.exists(llvm_header):
            llvm_val = "llvm"
        else:
            llvm_val = "none"
    return llvm_val
Beispiel #4
0
def default_get_link_args(pkg, ucp='', libs=[]):
    if ucp == '':
        ucp = default_uniq_cfg_path()
    if libs == []:
        libs = ['lib' + pkg + '.la']
    all_args = []
    for lib_arg in libs:
        if lib_arg.endswith('.la'):
            all_args.extend(
                handle_la(
                    os.path.join(utils.get_chpl_home(), 'third-party', pkg,
                                 'install', ucp, 'lib', lib_arg)))
        else:
            all_args.append(lib_arg)
    return all_args
Beispiel #5
0
def get():
    regexp_val = os.environ.get('CHPL_REGEXP')
    if not regexp_val:
        target_platform = chpl_platform.get('target')
        target_compiler = chpl_compiler.get('target')
        chpl_home = utils.get_chpl_home()
        regexp_target_dir = '{0}-{1}'.format(target_platform, target_compiler)
        regexp_subdir = os.path.join(chpl_home, 'third-party', 're2', 'install',
                                     regexp_target_dir)
        regexp_header = os.path.join(regexp_subdir, 'include', 're2', 're2.h')
        if os.path.exists(regexp_header):
            regexp_val = 're2'
        else:
            regexp_val = 'none'
    return regexp_val
Beispiel #6
0
def get():
    llvm_val = os.environ.get('CHPL_LLVM')
    if not llvm_val:
        host_platform = chpl_platform.get('host')
        host_compiler = chpl_compiler.get('host')
        chpl_home = utils.get_chpl_home()
        llvm_target_dir = '{0}-{1}'.format(host_platform, host_compiler)
        llvm_subdir = os.path.join(chpl_home, 'third-party', 'llvm', 'install',
                                   llvm_target_dir)
        llvm_header = os.path.join(llvm_subdir, 'include', 'llvm',
                                   'PassSupport.h')
        if os.path.exists(llvm_header):
            llvm_val = 'llvm'
        else:
            llvm_val = 'none'
    return llvm_val
Beispiel #7
0
def get():
    regexp_val = os.environ.get('CHPL_REGEXP')
    if not regexp_val:
        target_platform = chpl_platform.get('target')
        target_compiler = chpl_compiler.get('target')
        target_arch = chpl_arch.get('target', map_to_compiler=True, get_lcd=True)
        chpl_home = utils.get_chpl_home()
        regexp_target_dir = '{0}-{1}-{2}'.format(target_platform, target_compiler, target_arch)
        regexp_subdir = os.path.join(chpl_home, 'third-party', 're2', 'install',
                                     regexp_target_dir)
        regexp_header = os.path.join(regexp_subdir, 'include', 're2', 're2.h')
        if os.path.exists(regexp_header):
            regexp_val = 're2'
        else:
            regexp_val = 'none'
    return regexp_val
def get():
    gmp_val = os.environ.get("CHPL_GMP")
    if not gmp_val:
        target_platform = chpl_platform.get("target")

        # Detect if gmp has been built for this configuration.
        chpl_home = utils.get_chpl_home()
        uniq_cfg_path = chpl_3p_gmp_configs.get_uniq_cfg_path()
        gmp_subdir = os.path.join(chpl_home, "third-party", "gmp", "install", uniq_cfg_path)

        if os.path.exists(os.path.join(gmp_subdir, "include", "gmp.h")):
            gmp_val = "gmp"
        elif target_platform.startswith("cray-x"):
            gmp_val = "system"
        else:
            gmp_val = "none"
    return gmp_val
Beispiel #9
0
def get():
    gmp_val = os.environ.get('CHPL_GMP')
    if not gmp_val:
        target_platform = chpl_platform.get('target')

        # Detect if gmp has been built for this configuration.
        chpl_home = utils.get_chpl_home()
        uniq_cfg_path = chpl_3p_gmp_configs.get_uniq_cfg_path()
        gmp_subdir = os.path.join(chpl_home, 'third-party', 'gmp',
                                  'install', uniq_cfg_path)

        if os.path.exists(os.path.join(gmp_subdir, 'include', 'gmp.h')):
            gmp_val = 'gmp'
        elif target_platform.startswith('cray-x'):
            gmp_val = 'system'
        else:
            gmp_val = 'none'
    return gmp_val
Beispiel #10
0
def default_get_link_args(pkg, ucp='', libs=[]):
    if ucp == '':
        ucp = default_uniq_cfg_path()
    if libs == []:
        libs = [ 'lib' + pkg + '.la' ]
    all_args = []
    for lib_arg in libs:
        if lib_arg.endswith('.la'):
            all_args.extend(handle_la(os.path.join(utils.get_chpl_home(),
                                                   'third-party',
                                                   pkg,
                                                   'install',
                                                   ucp,
                                                   'lib',
                                                   lib_arg)))
        else:
            all_args.append(lib_arg)
    return all_args
Beispiel #11
0
def get():
    gmp_val = os.environ.get('CHPL_GMP')
    if not gmp_val:
        target_platform = chpl_platform.get('target')

        # Detect if gmp has been built for this configuration.
        chpl_home = utils.get_chpl_home()
        uniq_cfg_path = chpl_3p_gmp_configs.get_uniq_cfg_path()
        gmp_subdir = os.path.join(chpl_home, 'third-party', 'gmp',
                                  'install', uniq_cfg_path)

        if os.path.exists(os.path.join(gmp_subdir, 'include', 'gmp.h')):
            gmp_val = 'gmp'
        elif target_platform.startswith('cray-x'):
            gmp_val = 'system'
        else:
            gmp_val = 'none'
    return gmp_val
Beispiel #12
0
def get():
    gmp_val = os.environ.get('CHPL_GMP')
    if not gmp_val:
        target_platform = chpl_platform.get('target')
        target_compiler = chpl_compiler.get('target')

        if target_platform.startswith('cray-x'):
            gmp_val = 'system'
        else:
            chpl_home = utils.get_chpl_home()
            gmp_target_dir = '{0}-{1}'.format(target_platform, target_compiler)
            gmp_subdir = os.path.join(chpl_home, 'third-party', 'gmp',
                                      'install', gmp_target_dir)
            if os.path.exists(os.path.join(gmp_subdir, 'include', 'gmp.h')):
                gmp_val = 'gmp'
            else:
                gmp_val = 'none'
    return gmp_val
Beispiel #13
0
def handle_la(la_path):
    args = []
    if os.path.isfile(la_path):
        with open(la_path) as f:
            for line in f.readlines():
                if 'old_library=' in line:
                    lib_name = line.split('\'')[1]
                    p = re.compile(r'^lib([^/]+)\.a$')
                    args.append(p.sub(r'-l\1', lib_name))
                elif 'dependency_libs=' in line:
                    for tok in line.split('\'')[1].split():
                        # paths reflect built env; replace with $CHPL_HOME
                        pat = re.compile(r'^((-L\s*)?).*(/third-party/)')
                        repl = r'\1' + utils.get_chpl_home() + r'\3'
                        tok = pat.sub(repl, tok)
                        if tok.endswith('.la'):
                            args.extend(handle_la(tok))
                        else:
                            args.append(tok)
    return args
Beispiel #14
0
def get():
    gmp_val = os.environ.get('CHPL_GMP')
    if not gmp_val:
        target_platform = chpl_platform.get('target')
        target_compiler = chpl_compiler.get('target')
        target_arch = chpl_arch.get('target', map_to_compiler=True, get_lcd=True)

        # Detect if gmp has been built for this configuration.
        chpl_home = utils.get_chpl_home()
        gmp_target_dir = '{0}-{1}-{2}'.format(target_platform, target_compiler, target_arch)
        gmp_subdir = os.path.join(chpl_home, 'third-party', 'gmp',
                                  'install', gmp_target_dir)

        if os.path.exists(os.path.join(gmp_subdir, 'include', 'gmp.h')):
            gmp_val = 'gmp'
        elif target_platform.startswith('cray-x'):
            gmp_val = 'system'
        else:
            gmp_val = 'none'
    return gmp_val
def activate_venv():

    custom_venv_dir_var = 'CHPL_TEST_VENV_DIR'
    custom_venv_dir = os.getenv(custom_venv_dir_var, '').strip()

    # user asserts that system already has the required dependencies installed:
    if custom_venv_dir == 'none':
        print('[Skipping virtualenv activation because {0}={1}. test-venv '
              'requirements must be available.]'.format(custom_venv_dir_var,
              custom_venv_dir))

    else:
        venv_dir = None

        # using custom venv, does not check that our test requirements are met
        if custom_venv_dir:
            venv_dir = custom_venv_dir
            print('[Using custom  virtualenv because {0}={1}. test-venv '
                  'requirements must be available]'.format(custom_venv_dir_var,
                  custom_venv_dir))

        # check Chapel test-venv for successful installation sentinel
        else:
            chpl_home = os.path.join(utils.get_chpl_home(), '')
            third_party = os.path.join(chpl_home, 'third-party')
            target_platform = chpl_platform.get('target')

            venv_dir = os.path.join(third_party, 'chpl-venv', 'install',
                                    target_platform, 'chpl-virtualenv')
            sentinel_file = os.path.join(venv_dir, 'chpl-test-reqs')
            if not os.path.isfile(sentinel_file):
                error('Chapel test virtualenv is not available, run `{0} '
                      'test-venv` from {1}'.format(chpl_make.get(), chpl_home))

        activation_file = os.path.join(venv_dir, 'bin', 'activate_this.py')
        if not os.path.isfile(activation_file):
            error('Activation file {0} is missing'.format(activation_file))

        # actually activate
        execfile(activation_file, dict(__file__=activation_file))
Beispiel #16
0
def handle_la(la_path):
    args = []
    if os.path.isfile(la_path):
        with open(la_path) as f:
            for line in f.readlines():
                if 'old_library=' in line:
                    lib_name = line.split('\'')[1]
                    p = re.compile(r'^lib([^/]+)\.a$')
                    args.append(p.sub(r'-l\1', lib_name))
                elif 'inherited_linker_flags=' in line:
                    for tok in line.split('\'')[1].split():
                        args.append(tok)
                elif 'dependency_libs=' in line:
                    for tok in line.split('\'')[1].split():
                        # paths reflect built env; replace with $CHPL_HOME
                        pat = re.compile(r'^((-L\s*)?).*(/third-party/)')
                        repl = r'\1' + utils.get_chpl_home() + r'\3'
                        tok = pat.sub(repl, tok)
                        if tok.endswith('.la'):
                            args.extend(handle_la(tok))
                        else:
                            args.append(tok)
    return args
Beispiel #17
0
def get():
    gmp_val = os.environ.get('CHPL_GMP')
    if not gmp_val:
        target_platform = chpl_platform.get('target')
        target_compiler = chpl_compiler.get('target')
        target_arch = chpl_arch.get('target',
                                    map_to_compiler=True,
                                    get_lcd=True)

        # Detect if gmp has been built for this configuration.
        chpl_home = utils.get_chpl_home()
        gmp_target_dir = '{0}-{1}-{2}'.format(target_platform, target_compiler,
                                              target_arch)
        gmp_subdir = os.path.join(chpl_home, 'third-party', 'gmp', 'install',
                                  gmp_target_dir)

        if os.path.exists(os.path.join(gmp_subdir, 'include', 'gmp.h')):
            gmp_val = 'gmp'
        elif target_platform.startswith('cray-x'):
            gmp_val = 'system'
        else:
            gmp_val = 'none'
    return gmp_val
Beispiel #18
0
def get_cfg_install_path(pkg, ucp=default_uniq_cfg_path()):
    return os.path.join(utils.get_chpl_home(), 'third-party', pkg, 'install', ucp)
Beispiel #19
0
def get_cfg_install_path(pkg, ucp=default_uniq_cfg_path()):
    return os.path.join(utils.get_chpl_home(), 'third-party', pkg, 'install',
                        ucp)