@@ -251,8 +251,10 @@ def build_wheels(py_envs=DEFAULT_PY_ENVS, single_wheel=False,
251251
252252        cmake_executable  =  "cmake.exe" 
253253        tools_venv  =  os .path .join (ROOT_DIR , "venv-"  +  py_envs [0 ])
254-         pip_install (tools_venv , "ninja" )
255-         ninja_executable  =  os .path .join (tools_venv , "Scripts" , "ninja.exe" )
254+         ninja_executable  =  shutil .which ('ninja.exe' )
255+         if  ninja_executable  is  None :
256+             pip_install (tools_venv , "ninja" )
257+             ninja_executable  =  os .path .join (tools_venv , "Scripts" , "ninja.exe" )
256258
257259        # Build standalone project and populate archive cache 
258260        check_call ([
@@ -268,7 +270,9 @@ def build_wheels(py_envs=DEFAULT_PY_ENVS, single_wheel=False,
268270    # Compile wheels re-using standalone project and archive cache 
269271    for  py_env  in  py_envs :
270272        tools_venv  =  os .path .join (ROOT_DIR , "venv-"  +  py_env )
271-         pip_install (tools_venv , "ninja" )
273+         ninja_executable  =  shutil .which ('ninja.exe' )
274+         if  ninja_executable  is  None :
275+             pip_install (tools_venv , "ninja" )
272276        build_wheel (py_env , single_wheel = single_wheel ,
273277            cleanup = cleanup , wheel_names = wheel_names ,
274278            cmake_options = cmake_options )
0 commit comments