How to use the auditwheel.elfutils.elf_references_PyFPE_jbuf 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 / unit / test_elfutils.py View on Github external
def test_elf_references_pyfpe_jbuf_no_section(self):
        # GIVEN
        elf = Mock()

        # WHEN
        elf.get_section_by_name.return_value = None

        # WHEN/THEN
        assert elf_references_PyFPE_jbuf(elf) is False
github pypa / auditwheel / tests / unit / test_elfutils.py View on Github external
def test_elf_references_pyfpe_jbuf(self):
        # GIVEN
        elf = Mock()
        symbols = (MockSymbol("PyFPE_jbuf",
                              st_shndx="SHN_UNDEF",
                              st_info=dict(type="STT_FUNC")),)

        elf.get_section_by_name.return_value.iter_symbols.return_value = symbols

        # WHEN/THEN
        assert elf_references_PyFPE_jbuf(elf) is True
github pypa / auditwheel / tests / unit / test_elfutils.py View on Github external
def test_elf_references_pyfpe_jbuf_false(self):
        # GIVEN
        elf = Mock()
        symbols = (MockSymbol("SomeSymbol",
                              st_shndx="SHN_UNDEF",
                              st_info=dict(type="STT_FUNC")),)

        elf.get_section_by_name.return_value.iter_symbols.return_value = symbols

        # WHEN/THEN
        assert elf_references_PyFPE_jbuf(elf) is False
github pypa / auditwheel / auditwheel / wheel_abi.py View on Github external
# to fail and there's no need to do further checks
            if not shared_libraries_in_purelib:
                log.debug('processing: %s', fn)
                elftree = lddtree(fn)

                for key, value in elf_find_versioned_symbols(elf):
                    log.debug('key %s, value %s', key, value)
                    versioned_symbols[key].add(value)

                is_py_ext, py_ver = elf_is_python_extension(fn, elf)

                # If the ELF is a Python extention, we definitely need to
                # include its external dependencies.
                if is_py_ext:
                    full_elftree[fn] = elftree
                    uses_PyFPE_jbuf |= elf_references_PyFPE_jbuf(elf)
                    if py_ver == 2:
                        uses_ucs2_symbols |= any(
                            True for _ in elf_find_ucs2_symbols(elf))
                    full_external_refs[fn] = lddtree_external_references(
                        elftree,
                        ctx.path)
                else:
                    # If the ELF is not a Python extension, it might be
                    # included in the wheel already because auditwheel repair
                    # vendored it, so we will check whether we should include
                    # its internal references later.
                    nonpy_elftree[fn] = elftree

        if not platform_wheel:
            raise NonPlatformWheel