How to use the auditwheel.policy.versioned_symbols_policy function in auditwheel

To help you get started, we’ve selected a few auditwheel 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 pypa / auditwheel / tests / integration / test_policy.py View on Github external
def test_policy_checks_glibc():
    policy = versioned_symbols_policy({"some_library.so": {"GLIBC_2.5"}})
    assert policy > POLICY_PRIORITY_LOWEST
    policy = versioned_symbols_policy({"some_library.so": {"GLIBC_999"}})
    assert policy == POLICY_PRIORITY_LOWEST
    policy = versioned_symbols_policy({"some_library.so": {"OPENSSL_1_1_0"}})
    assert policy == POLICY_PRIORITY_HIGHEST
    policy = versioned_symbols_policy({"some_library.so": {"IAMALIBRARY"}})
    assert policy == POLICY_PRIORITY_HIGHEST
github pypa / auditwheel / auditwheel / wheel_abi.py View on Github external
e.g. [(100, {'libc.so.6', set(['GLIBC_2.5'])})]
    """
    result = []
    for policy in external_refs.values():
        # skip the linux policy
        if policy['priority'] == 0:
            continue
        policy_symbols = deepcopy(versioned_symbols)
        for soname in policy['libs'].keys():
            if soname not in external_versioned_symbols:
                continue
            ext_symbols = external_versioned_symbols[soname]
            for k in iter(ext_symbols):
                policy_symbols[k].update(ext_symbols[k])
        result.append(
            (versioned_symbols_policy(policy_symbols), policy_symbols))
    return result
github pypa / auditwheel / auditwheel / wheel_abi.py View on Github external
(elftree_by_fn, external_refs_by_fn, versioned_symbols, has_ucs2,
     uses_PyFPE_jbuf) = get_wheel_elfdata(wheel_fn)

    for fn in elftree_by_fn.keys():
        update(external_refs, external_refs_by_fn[fn])

    log.debug('external reference info')
    log.debug(json.dumps(external_refs, indent=4))

    external_libs = get_external_libs(external_refs)
    external_versioned_symbols = get_versioned_symbols(external_libs)
    symbol_policies = get_symbol_policies(versioned_symbols,
                                          external_versioned_symbols,
                                          external_refs)
    symbol_policy = versioned_symbols_policy(versioned_symbols)

    # let's keep the highest priority policy and
    # corresponding versioned_symbols
    symbol_policy, versioned_symbols = max(
        symbol_policies,
        key=lambda x: x[0],
        default=(symbol_policy, versioned_symbols)
    )

    ref_policy = max(
        (e['priority'] for e in external_refs.values() if len(e['libs']) == 0),
        default=POLICY_PRIORITY_LOWEST)

    if has_ucs2:
        ucs_policy = POLICY_PRIORITY_LOWEST
    else: