Exemple #1
0
def get_sysroot_resource_dir_args():
    args = []
    target_platform = chpl_platform.get('target')
    llvm_val = get()
    if (target_platform == "darwin" and llvm_val == "bundled"):
        # Add -isysroot and -resourcedir based upon what 'clang' uses
        cfile = os.path.join(get_chpl_home(), "runtime", "include",
                             "sys_basic.h")
        if not os.path.isfile(cfile):
            error("error computing isysroot -- sys_basic.h is missing")

        (out, err) = run_command(['clang', '-###', cfile],
                                 stdout=True,
                                 stderr=True)
        out += err

        found = re.search('"-isysroot" "([^"]+)"', out)
        if found:
            args.append('-isysroot')
            args.append(found.group(1).strip())

        found = re.search('"-resource-dir" "([^"]+)"', out)
        if found:
            args.append('-resource-dir')
            args.append(found.group(1).strip())

    return args
Exemple #2
0
def validate_compiler(compiler_val):
    if compiler_val != 'llvm':
        import chpl_home_utils
        chpl_home = chpl_home_utils.get_chpl_home()
        comp_makefile = os.path.join(chpl_home, 'make', 'compiler', 'Makefile.{0}'.format(compiler_val))
        if not os.path.isfile(comp_makefile):
            warning('Unknown compiler: "{0}"'.format(compiler_val))
def validate(compiler_val):
    import chpl_home_utils
    chpl_home = chpl_home_utils.get_chpl_home()
    comp_makefile = os.path.join(chpl_home, 'make', 'compiler',
                                 'Makefile.{0}'.format(compiler_val))
    if not os.path.isfile(comp_makefile):
        sys.stderr.write(
            'Warning: Unknown compiler: "{0}"\n'.format(compiler_val))
Exemple #4
0
def validate_compiler(compiler_val, flag):
    if compiler_val != 'llvm':
        import chpl_home_utils
        chpl_home = chpl_home_utils.get_chpl_home()
        comp_makefile = os.path.join(chpl_home, 'make', 'compiler',
                                     'Makefile.{0}'.format(compiler_val))
        if not os.path.isfile(comp_makefile):
            warning('Unknown compiler: "{0}"'.format(compiler_val))

    if chpl_locale_model.get() == 'gpu' and flag == 'target':
        if compiler_val != 'llvm':
            error("The 'gpu' locale model can only be used with "
                  "CHPL_TARGET_COMPILER=llvm.")
def get():
    regexp_val = overrides.get('CHPL_REGEXP')
    if not regexp_val:
        chpl_home = 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
Exemple #6
0
def get():
    regexp_val = overrides.get('CHPL_REGEXP')
    if not regexp_val:
        chpl_home = 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
Exemple #7
0
def get():
    llvm_val = overrides.get('CHPL_LLVM')
    if not llvm_val:
        host_platform = chpl_platform.get('host')
        host_compiler = chpl_compiler.get('host')
        chpl_home = 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
Exemple #8
0
def get():
    llvm_val = overrides.get('CHPL_LLVM')
    if not llvm_val:
        host_platform = chpl_platform.get('host')
        host_compiler = chpl_compiler.get('host')
        chpl_home = 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
Exemple #9
0
def get():
    gmp_val = overrides.get('CHPL_GMP')
    if not gmp_val:
        target_platform = chpl_platform.get('target')

        # Detect if gmp has been built for this configuration.
        chpl_home = 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
Exemple #10
0
def get():
    gmp_val = overrides.get('CHPL_GMP')
    if not gmp_val:
        target_platform = chpl_platform.get('target')

        # Detect if gmp has been built for this configuration.
        chpl_home = 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'
        elif target_platform == 'aarch64':
            gmp_val = 'system'
        else:
            gmp_val = 'none'
    return gmp_val
Exemple #11
0
def main():
    """
    Parse and do some basic validation of the ANNOTATIONS.yaml file
    """
    chpl_home = get_chpl_home()
    test_dir = os.path.join(chpl_home, 'test')
    ann_path = os.path.join(test_dir, 'ANNOTATIONS.yaml')

    with warnings.catch_warnings(record=True) as warnings_list:
        ann_data = annotate.load(ann_path)
        graph_list = get_graph_names(test_dir)

        check_graph_names(ann_data, graph_list)
        try_parsing_annotations(ann_data, graph_list)
        check_configs(ann_data)
        check_pr_number_dates(ann_data)

        for warning in warnings_list:
            print(warning.message)
        print('No fatal annotation errors detected')
        return len(warnings_list) != 0
Exemple #12
0
def main():
    """
    Parse and do some basic validation of the ANNOTATIONS.yaml file
    """
    chpl_home = get_chpl_home()
    test_dir = os.path.join(chpl_home, 'test')
    ann_path = os.path.join(test_dir, 'ANNOTATIONS.yaml')

    with warnings.catch_warnings(record=True) as warnings_list:
        ann_data = annotate.load(ann_path)
        graph_list = get_graph_names(test_dir)

        check_graph_names(ann_data, graph_list)
        try_parsing_annotations(ann_data, graph_list)
        check_configs(ann_data)
        check_pr_number_dates(ann_data)

        for warning in warnings_list:
            print(warning.message)
        print('No fatal annotation errors detected')
        return len(warnings_list) != 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' + 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
Exemple #14
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' + 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
Exemple #15
0
def get_cfg_install_path(pkg, ucp=default_uniq_cfg_path()):
    return os.path.join(get_chpl_home(), 'third-party', pkg, 'install', ucp)
def get_cfg_install_path(pkg, ucp=default_uniq_cfg_path()):
    return os.path.join(get_chpl_home(), 'third-party', pkg, 'install', ucp)
Exemple #17
0
def validate(compiler_val):
    import chpl_home_utils
    chpl_home = chpl_home_utils.get_chpl_home()
    comp_makefile = os.path.join(chpl_home, 'make', 'compiler', 'Makefile.{0}'.format(compiler_val))
    if not os.path.isfile(comp_makefile):
        sys.stderr.write('Warning: Unknown compiler: "{0}"\n'.format(compiler_val))