MCPcopy Index your code
hub / github.com/python/cpython / _findwheel

Function _findwheel

Lib/test/support/__init__.py:2577–2595  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

2575
2576@functools.cache
2577def _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,

Callers 1

Calls 4

listdirMethod · 0.80
joinMethod · 0.45
endswithMethod · 0.45
startswithMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…