@@ -108,11 +108,14 @@ def bootstrap(self, req: Requirement, req_type: RequirementType) -> Version:
108108 self ._add_to_graph (req , req_type , resolved_version , source_url )
109109
110110 # Is bootstrap going to create a wheel or just an sdist?
111- # Use fast sdist-only if flag is set, requirement is not a build
112- # requirement, and wheel is not pre-built.
113- build_sdist_only = (
114- self .sdist_only and req_type .is_install_requirement and not pbi .pre_built
115- )
111+ # Use fast sdist-only if flag is set and requirement is not a build
112+ # requirement.
113+ # An install requirement on a pre-built wheel treats the
114+ # wheel as sdist-only in order to build its installation requirements
115+ # sdist-only. When bootstrap encounters another package with a
116+ # *build* requirement on a pre-built wheel, its installation
117+ # dependencies are materialized.
118+ build_sdist_only = self .sdist_only and req_type .is_install_requirement
116119
117120 # Avoid cyclic dependencies and redundant processing.
118121 if self ._has_been_seen (req , resolved_version , build_sdist_only ):
@@ -259,28 +262,38 @@ def bootstrap(self, req: Requirement, req_type: RequirementType) -> Version:
259262 wheel_filename = wheel_filename ,
260263 )
261264
262- if build_sdist_only :
263- if typing .TYPE_CHECKING :
264- assert build_env is not None
265- assert sdist_root_dir is not None
266- assert wheel_filename is None
267-
265+ if wheel_filename is not None :
266+ assert unpack_dir is not None
267+ logger .debug (
268+ "get install dependencies of wheel %s" ,
269+ wheel_filename .name ,
270+ )
271+ install_dependencies = dependencies .get_install_dependencies_of_wheel (
272+ req = req ,
273+ wheel_filename = wheel_filename ,
274+ requirements_file_dir = unpack_dir ,
275+ )
276+ elif sdist_filename is not None :
277+ assert sdist_root_dir is not None
278+ assert build_env is not None
279+ logger .debug (
280+ "get install dependencies of sdist from directory %s" ,
281+ sdist_root_dir ,
282+ )
268283 install_dependencies = dependencies .get_install_dependencies_of_sdist (
269284 ctx = self .ctx ,
270285 req = req ,
271286 sdist_root_dir = sdist_root_dir ,
272287 build_env = build_env ,
273288 )
274289 else :
275- if typing .TYPE_CHECKING :
276- assert wheel_filename is not None
277- assert unpack_dir is not None
290+ # unreachable
291+ raise RuntimeError ("wheel_filename and sdist_filename are None" )
278292
279- install_dependencies = dependencies .get_install_dependencies_of_wheel (
280- req = req ,
281- wheel_filename = wheel_filename ,
282- requirements_file_dir = unpack_dir ,
283- )
293+ logger .debug (
294+ "install dependencies: %s" ,
295+ ", " .join (sorted (str (req ) for req in install_dependencies )),
296+ )
284297
285298 self ._add_to_build_order (
286299 req = req ,
0 commit comments