Instead of building wheel, we look for and copy a wheel from location specified by PYMUPDF_SETUP_URL_WHEEL.
(
wheel_directory,
config_settings=None,
metadata_directory=None,
p=p,
)
| 1458 | |
| 1459 | if PYMUPDF_SETUP_URL_WHEEL: |
| 1460 | def build_wheel( |
| 1461 | wheel_directory, |
| 1462 | config_settings=None, |
| 1463 | metadata_directory=None, |
| 1464 | p=p, |
| 1465 | ): |
| 1466 | ''' |
| 1467 | Instead of building wheel, we look for and copy a wheel from location |
| 1468 | specified by PYMUPDF_SETUP_URL_WHEEL. |
| 1469 | ''' |
| 1470 | log(f'{PYMUPDF_SETUP_URL_WHEEL=}') |
| 1471 | log(f'{p.wheel_name()=}') |
| 1472 | url = PYMUPDF_SETUP_URL_WHEEL |
| 1473 | if url.startswith(('http://', 'https://')): |
| 1474 | leaf = p.wheel_name() |
| 1475 | out_path = f'{wheel_directory}{leaf}' |
| 1476 | out_path_temp = out_path + '-' |
| 1477 | if url.endswith('/'): |
| 1478 | url += leaf |
| 1479 | log(f'Downloading from {url=} to {out_path_temp=}.') |
| 1480 | urllib.request.urlretrieve(url, out_path_temp) |
| 1481 | elif url.startswith(f'file://'): |
| 1482 | in_path = url[len('file://'):] |
| 1483 | log(f'{in_path=}') |
| 1484 | if in_path.endswith('/'): |
| 1485 | # Look for matching wheel within this directory. |
| 1486 | wheels = glob.glob(f'{in_path}*.whl') |
| 1487 | log(f'{len(wheels)=}') |
| 1488 | for in_path in wheels: |
| 1489 | log(f'{in_path=}') |
| 1490 | leaf = os.path.basename(in_path) |
| 1491 | if p.wheel_name_match(leaf): |
| 1492 | log(f'Match: {in_path=}') |
| 1493 | break |
| 1494 | else: |
| 1495 | message = f'Cannot find matching for {p.wheel_name()=} in ({len(wheels)=}):\n' |
| 1496 | wheels_text = '' |
| 1497 | for wheel in wheels: |
| 1498 | wheels_text += f' {wheel}\n' |
| 1499 | assert 0, f'Cannot find matching for {p.wheel_name()=} in:\n{wheels_text}' |
| 1500 | else: |
| 1501 | leaf = os.path.basename(in_path) |
| 1502 | out_path = os.path.join(wheel_directory, leaf) |
| 1503 | out_path_temp = out_path + '-' |
| 1504 | log(f'Copying from {in_path=} to {out_path_temp=}.') |
| 1505 | shutil.copy2(in_path, out_path_temp) |
| 1506 | else: |
| 1507 | assert 0, f'Unrecognised prefix in {PYMUPDF_SETUP_URL_WHEEL=}.' |
| 1508 | |
| 1509 | log(f'Renaming from:\n {out_path_temp}\nto:\n {out_path}.') |
| 1510 | os.rename(out_path_temp, out_path) |
| 1511 | return os.path.basename(out_path) |
| 1512 | else: |
| 1513 | build_wheel = p.build_wheel |
| 1514 |
nothing calls this directly
no test coverage detected
searching dependent graphs…