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

Function build

setup.py:580–765  ·  view source on GitHub ↗

pipcl.py `build_fn()` callback.

()

Source from the content-addressed store, hash-verified

578pyodide = os.environ.get('OS') == 'pyodide'
579
580def build():
581 '''
582 pipcl.py `build_fn()` callback.
583 '''
584 #pipcl.show_sysconfig()
585
586 if PYMUPDF_SETUP_DUMMY == '1':
587 log(f'{PYMUPDF_SETUP_DUMMY=} Building dummy wheel with no files.')
588 return list()
589
590 # Download MuPDF.
591 #
592 mupdf_local, mupdf_location = get_mupdf()
593 if mupdf_local:
594 mupdf_version_tuple = get_mupdf_version(mupdf_local)
595 # else we cannot determine version this way and do not use it
596
597 build_type = os.environ.get( 'PYMUPDF_SETUP_MUPDF_BUILD_TYPE', 'release')
598 assert build_type in ('debug', 'memento', 'release'), \
599 f'Unrecognised build_type={build_type!r}'
600
601 overwrite_config = os.environ.get('PYMUPDF_SETUP_MUPDF_OVERWRITE_CONFIG', '1') == '1'
602
603 PYMUPDF_SETUP_MUPDF_REFCHECK_IF = os.environ.get('PYMUPDF_SETUP_MUPDF_REFCHECK_IF')
604 PYMUPDF_SETUP_MUPDF_TRACE_IF = os.environ.get('PYMUPDF_SETUP_MUPDF_TRACE_IF')
605
606 # Build MuPDF shared libraries.
607 #
608 if windows:
609 mupdf_build_dir = build_mupdf_windows(
610 mupdf_local,
611 build_type,
612 overwrite_config,
613 g_py_limited_api,
614 PYMUPDF_SETUP_MUPDF_REFCHECK_IF,
615 PYMUPDF_SETUP_MUPDF_TRACE_IF,
616 )
617 else:
618 if 'p' not in PYMUPDF_SETUP_FLAVOUR and 'b' not in PYMUPDF_SETUP_FLAVOUR:
619 # We only need MuPDF headers, so no point building MuPDF.
620 log(f'Not building MuPDF because not Windows and {PYMUPDF_SETUP_FLAVOUR=}.')
621 mupdf_build_dir = None
622 else:
623 mupdf_build_dir = build_mupdf_unix(
624 mupdf_local,
625 build_type,
626 overwrite_config,
627 g_py_limited_api,
628 PYMUPDF_SETUP_MUPDF_REFCHECK_IF,
629 PYMUPDF_SETUP_MUPDF_TRACE_IF,
630 PYMUPDF_SETUP_SWIG,
631 )
632 log( f'build(): mupdf_build_dir={mupdf_build_dir!r}')
633
634 # Build `extra` module.
635 #
636 if 'p' in PYMUPDF_SETUP_FLAVOUR:
637 path_so_leaf = _build_extension(

Callers

nothing calls this directly

Calls 13

get_mupdfFunction · 0.85
get_mupdf_versionFunction · 0.85
build_mupdf_windowsFunction · 0.85
build_mupdf_unixFunction · 0.85
_build_extensionFunction · 0.85
_windows_lib_directoryFunction · 0.85
int_or_0Function · 0.85
searchMethod · 0.80
logFunction · 0.70
addFunction · 0.70
git_infoFunction · 0.70
runFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…