MCPcopy Index your code
hub / github.com/RustPython/RustPython / _findwheel

Function _findwheel

Lib/test/support/__init__.py:2507–2525  ·  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

2505
2506@functools.cache
2507def _findwheel(pkgname):
2508 """Try to find a wheel with the package specified as pkgname.
2509
2510 If set, the wheels are searched for in WHEEL_PKG_DIR (see ensurepip).
2511 Otherwise, they are searched for in the test directory.
2512 """
2513 wheel_dir = sysconfig.get_config_var('WHEEL_PKG_DIR') or os.path.join(
2514 TEST_HOME_DIR, 'wheeldata',
2515 )
2516 filenames = os.listdir(wheel_dir)
2517 filenames = sorted(filenames, reverse=True) # approximate "newest" first
2518 for filename in filenames:
2519 # filename is like 'setuptools-{version}-py3-none-any.whl'
2520 if not filename.endswith(".whl"):
2521 continue
2522 prefix = pkgname + '-'
2523 if filename.startswith(prefix):
2524 return os.path.join(wheel_dir, filename)
2525 raise FileNotFoundError(f"No wheel for {pkgname} found in {wheel_dir}")
2526
2527
2528# Context manager that creates a virtual environment, install setuptools in it,

Callers 1

Calls 5

sortedFunction · 0.85
listdirMethod · 0.80
joinMethod · 0.45
endswithMethod · 0.45
startswithMethod · 0.45

Tested by

no test coverage detected