| 883 | |
| 884 | |
| 885 | def cibuildwheel( |
| 886 | env_extra, |
| 887 | cibw_name, |
| 888 | cibw_pyodide, |
| 889 | cibw_pyodide_version, |
| 890 | cibw_sdist, |
| 891 | cibw_test_project, |
| 892 | cibw_test_project_setjmp, |
| 893 | cibw_skip_add_defaults, |
| 894 | graal, |
| 895 | ): |
| 896 | |
| 897 | if cibw_sdist and platform.system() == 'Linux': |
| 898 | log(f'Building sdist.') |
| 899 | run(f'cd {pymupdf_dir_abs} && {sys.executable} setup.py -d wheelhouse sdist', env_extra=env_extra) |
| 900 | sdists = glob.glob(f'{pymupdf_dir_abs}/wheelhouse/pymupdf-*.tar.gz') |
| 901 | log(f'{sdists=}') |
| 902 | assert sdists |
| 903 | |
| 904 | run(f'pip install --upgrade --force-reinstall {cibw_name}') |
| 905 | |
| 906 | # Some general flags. |
| 907 | if 'CIBW_BUILD_VERBOSITY' not in env_extra: |
| 908 | env_extra['CIBW_BUILD_VERBOSITY'] = '1' |
| 909 | |
| 910 | # Add default flags to CIBW_SKIP. |
| 911 | # 2025-10-07: `cp3??t-*` excludes free-threading, which currently breaks |
| 912 | # some tests. |
| 913 | |
| 914 | if cibw_skip_add_defaults: |
| 915 | CIBW_SKIP = env_extra.get('CIBW_SKIP', '') |
| 916 | CIBW_SKIP += ' *i686 *musllinux* *-win32 *-aarch64 cp3??t-*' |
| 917 | CIBW_SKIP = CIBW_SKIP.split() |
| 918 | CIBW_SKIP = sorted(list(set(CIBW_SKIP))) |
| 919 | CIBW_SKIP = ' '.join(CIBW_SKIP) |
| 920 | env_extra['CIBW_SKIP'] = CIBW_SKIP |
| 921 | |
| 922 | # Set what wheels to build, if not already specified. |
| 923 | if 'CIBW_ARCHS' not in env_extra: |
| 924 | if 'CIBW_ARCHS_WINDOWS' not in env_extra: |
| 925 | env_extra['CIBW_ARCHS_WINDOWS'] = 'auto64' |
| 926 | |
| 927 | if 'CIBW_ARCHS_MACOS' not in env_extra: |
| 928 | env_extra['CIBW_ARCHS_MACOS'] = 'auto64' |
| 929 | |
| 930 | if 'CIBW_ARCHS_LINUX' not in env_extra: |
| 931 | env_extra['CIBW_ARCHS_LINUX'] = 'auto64' |
| 932 | |
| 933 | # Tell cibuildwheel not to use `auditwheel` on Linux and MacOS, |
| 934 | # because it cannot cope with us deliberately having required |
| 935 | # libraries in different wheel - specifically in the PyMuPDF wheel. |
| 936 | # |
| 937 | # We cannot use a subset of auditwheel's functionality |
| 938 | # with `auditwheel addtag` because it says `No tags |
| 939 | # to be added` and terminates with non-zero. See: |
| 940 | # https://github.com/pypa/auditwheel/issues/439. |
| 941 | # |
| 942 | env_extra['CIBW_REPAIR_WHEEL_COMMAND_LINUX'] = '' |