MCPcopy Index your code
hub / github.com/pymupdf/PyMuPDF / build_extension

Function build_extension

pipcl.py:1591–1964  ·  view source on GitHub ↗

Builds a Python extension module using SWIG. Works on Windows, Linux, MacOS and OpenBSD. On Unix, sets rpath when linking shared libraries. Args: name: Name of generated extension module. path_i: Path of input SWIG `.i` file. Internally we u

(
        name,
        path_i,
        outdir,
        *,
        builddir=None,
        includes=None,
        defines=None,
        libpaths=None,
        libs=None,
        optimise=True,
        debug=False,
        compiler_extra='',
        linker_extra='',
        swig=None,
        cpp=True,
        source_extra=None,
        prerequisites_swig=None,
        prerequisites_compile=None,
        prerequisites_link=None,
        infer_swig_includes=True,
        py_limited_api=False,
        )

Source from the content-addressed store, hash-verified

1589_extensions_to_py_limited_api = dict()
1590
1591def build_extension(
1592 name,
1593 path_i,
1594 outdir,
1595 *,
1596 builddir=None,
1597 includes=None,
1598 defines=None,
1599 libpaths=None,
1600 libs=None,
1601 optimise=True,
1602 debug=False,
1603 compiler_extra='',
1604 linker_extra='',
1605 swig=None,
1606 cpp=True,
1607 source_extra=None,
1608 prerequisites_swig=None,
1609 prerequisites_compile=None,
1610 prerequisites_link=None,
1611 infer_swig_includes=True,
1612 py_limited_api=False,
1613 ):
1614 '''
1615 Builds a Python extension module using SWIG. Works on Windows, Linux, MacOS
1616 and OpenBSD.
1617
1618 On Unix, sets rpath when linking shared libraries.
1619
1620 Args:
1621 name:
1622 Name of generated extension module.
1623 path_i:
1624 Path of input SWIG `.i` file. Internally we use swig to generate a
1625 corresponding `.c` or `.cpp` file.
1626 outdir:
1627 Output directory for generated files:
1628
1629 * `{outdir}/{name}.py`
1630 * `{outdir}/_{name}.so` # Unix
1631 * `{outdir}/_{name}.*.pyd` # Windows
1632 We return the leafname of the `.so` or `.pyd` file.
1633 builddir:
1634 Where to put intermediate files, for example the .cpp file
1635 generated by swig and `.d` dependency files. Default is `outdir`.
1636 includes:
1637 A string, or a sequence of extra include directories to be prefixed
1638 with `-I`.
1639 defines:
1640 A string, or a sequence of extra preprocessor defines to be
1641 prefixed with `-D`.
1642 libpaths
1643 A string, or a sequence of library paths to be prefixed with
1644 `/LIBPATH:` on Windows or `-L` on Unix.
1645 libs
1646 A string, or a sequence of library names. Each item is prefixed
1647 with `-l` on non-Windows.
1648 optimise:

Callers

nothing calls this directly

Calls 14

_flagsFunction · 0.85
windowsFunction · 0.85
_get_prerequisitesFunction · 0.85
run_ifFunction · 0.85
pyodideFunction · 0.85
log0Function · 0.85
_so_suffixFunction · 0.85
current_py_limited_apiFunction · 0.85
base_compilerFunction · 0.85
base_linkerFunction · 0.85
darwinFunction · 0.85
log2Function · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…