pipcl.py `build_fn()` callback.
()
| 578 | pyodide = os.environ.get('OS') == 'pyodide' |
| 579 | |
| 580 | def 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( |
nothing calls this directly
no test coverage detected
searching dependent graphs…