@@ -401,12 +401,12 @@ def build(options: Options, tmp_path: Path) -> None:
401401 identifier_tmp_dir .mkdir ()
402402 built_wheel_dir = identifier_tmp_dir / "built_wheel"
403403
404- dependency_constraint_flags : Sequence [ PathOrStr ] = []
405- if build_options . dependency_constraints :
406- dependency_constraint_flags = [
407- "-c" ,
408- build_options . dependency_constraints . get_for_python_version ( config . version ),
409- ]
404+ constraints_path = build_options . dependency_constraints . get_for_python_version (
405+ version = config . version , tmp_dir = identifier_tmp_dir
406+ )
407+ dependency_constraint_flags : Sequence [ PathOrStr ] = (
408+ [ "-c" , constraints_path ] if constraints_path else []
409+ )
410410
411411 target_install_path , env = setup_python (
412412 identifier_tmp_dir / "build" ,
@@ -445,11 +445,8 @@ def build(options: Options, tmp_path: Path) -> None:
445445
446446 build_env = env .copy ()
447447 build_env ["VIRTUALENV_PIP" ] = pip_version
448- if build_options .dependency_constraints :
449- constraint_path = build_options .dependency_constraints .get_for_python_version (
450- config .version
451- )
452- combine_constraints (build_env , constraint_path , None )
448+ if constraints_path :
449+ combine_constraints (build_env , constraints_path , None )
453450
454451 if build_frontend .name == "pip" :
455452 # Path.resolve() is needed. Without it pip wheel may try to
0 commit comments