Try to find a wheel with the package specified as pkgname. If set, the wheels are searched for in WHEEL_PKG_DIR (see ensurepip). Otherwise, they are searched for in the test directory.
(pkgname)
| 2575 | |
| 2576 | @functools.cache |
| 2577 | def _findwheel(pkgname): |
| 2578 | """Try to find a wheel with the package specified as pkgname. |
| 2579 | |
| 2580 | If set, the wheels are searched for in WHEEL_PKG_DIR (see ensurepip). |
| 2581 | Otherwise, they are searched for in the test directory. |
| 2582 | """ |
| 2583 | wheel_dir = sysconfig.get_config_var('WHEEL_PKG_DIR') or os.path.join( |
| 2584 | TEST_HOME_DIR, 'wheeldata', |
| 2585 | ) |
| 2586 | filenames = os.listdir(wheel_dir) |
| 2587 | filenames = sorted(filenames, reverse=True) # approximate "newest" first |
| 2588 | for filename in filenames: |
| 2589 | # filename is like 'setuptools-{version}-py3-none-any.whl' |
| 2590 | if not filename.endswith(".whl"): |
| 2591 | continue |
| 2592 | prefix = pkgname + '-' |
| 2593 | if filename.startswith(prefix): |
| 2594 | return os.path.join(wheel_dir, filename) |
| 2595 | raise FileNotFoundError(f"No wheel for {pkgname} found in {wheel_dir}") |
| 2596 | |
| 2597 | |
| 2598 | # Context manager that creates a virtual environment, install setuptools in it, |
no test coverage detected
searching dependent graphs…