File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2398,5 +2398,26 @@ def adjust_int_max_str_digits(max_digits):
23982398 finally :
23992399 sys .set_int_max_str_digits (current )
24002400
2401+
2402+ @functools .cache
2403+ def _findwheel (pkgname ):
2404+ """Try to find a wheel with the package specified as pkgname.
2405+
2406+ If set, the wheels are searched for in WHEEL_PKG_DIR (see ensurepip).
2407+ Otherwise, they are searched for in the test directory.
2408+ """
2409+ wheel_dir = sysconfig .get_config_var ('WHEEL_PKG_DIR' ) or TEST_HOME_DIR
2410+ filenames = os .listdir (wheel_dir )
2411+ filenames = sorted (filenames ) # sort this like ensurepip does it
2412+ for filename in filenames :
2413+ # filename is like 'pip-21.2.4-py3-none-any.whl'
2414+ if not filename .endswith (".whl" ):
2415+ continue
2416+ prefix = pkgname + '-'
2417+ if filename .startswith (prefix ):
2418+ return os .path .join (wheel_dir , filename )
2419+ raise FileNotFoundError (f"No wheel for { pkgname } found in { wheel_dir } " )
2420+
2421+
24012422#For recursion tests, easily exceeds default recursion limit
24022423EXCEEDS_RECURSION_LIMIT = 5000
Original file line number Diff line number Diff line change @@ -83,8 +83,8 @@ def run_cmd(operation, cmd):
8383
8484 cmd = [python , '-X' , 'dev' ,
8585 '-m' , 'pip' , 'install' ,
86- support .findfile ('setuptools-67.6.1-py3-none-any.whl ' ),
87- support .findfile ('wheel-0.40.0-py3-none-any.whl ' )]
86+ support ._findwheel ('setuptools' ),
87+ support ._findwheel ('wheel' )]
8888 run_cmd ('Install build dependencies' , cmd )
8989
9090 # Build and install the C++ extension
You can’t perform that action at this time.
0 commit comments