Skip to content

Commit 41958f9

Browse files
authored
Merge pull request #30992 from compnerd/the-impossible-future
build: explicitly execute `line-directive-tool` with Python3
2 parents 5d6298a + cba8723 commit 41958f9

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,7 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
893893
endif()
894894

895895
find_package(Python2 COMPONENTS Interpreter REQUIRED)
896+
find_package(Python3 COMPONENTS Interpreter REQUIRED)
896897

897898
#
898899
# Find optional dependencies.

stdlib/cmake/modules/SwiftSource.cmake

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ function(_compile_swift_files
693693
add_custom_command_target(
694694
dependency_target
695695
COMMAND
696-
"${PYTHON_EXECUTABLE}" "${line_directive_tool}" "@${file_path}" --
696+
"$<TARGET_FILE:Python3::Interpreter>" "${line_directive_tool}" "@${file_path}" --
697697
"${swift_compiler_tool}" "${main_command}" ${swift_flags}
698698
${output_option} ${embed_bitcode_option} "@${file_path}"
699699
${command_touch_standard_outputs}
@@ -731,7 +731,7 @@ function(_compile_swift_files
731731
"${CMAKE_COMMAND}" "-E" "make_directory" ${module_dir}
732732
${specific_module_dir}
733733
COMMAND
734-
"${PYTHON_EXECUTABLE}" "${line_directive_tool}" "@${file_path}" --
734+
"$<TARGET_FILE:Python3::Interpreter>" "${line_directive_tool}" "@${file_path}" --
735735
"${swift_compiler_tool}" "-emit-module" "-o" "${module_file}"
736736
"-avoid-emit-module-source-info"
737737
${swift_flags} ${swift_module_flags} "@${file_path}"
@@ -766,7 +766,7 @@ function(_compile_swift_files
766766
COMMAND
767767
"${CMAKE_COMMAND}" "-E" "make_directory" ${maccatalyst_specific_module_dir}
768768
COMMAND
769-
"${PYTHON_EXECUTABLE}" "${line_directive_tool}" "@${file_path}" --
769+
"$<TARGET_FILE:Python3::Interpreter>" "${line_directive_tool}" "@${file_path}" --
770770
"${swift_compiler_tool}" "-emit-module" "-o" "${maccatalyst_module_file}"
771771
${maccatalyst_swift_flags} ${maccatalyst_swift_module_flags} "@${file_path}"
772772
${command_touch_maccatalyst_module_outputs}
@@ -792,7 +792,7 @@ function(_compile_swift_files
792792
add_custom_command_target(
793793
sib_dependency_target
794794
COMMAND
795-
"${PYTHON_EXECUTABLE}" "${line_directive_tool}" "@${file_path}" --
795+
"$<TARGET_FILE:Python3::Interpreter>" "${line_directive_tool}" "@${file_path}" --
796796
"${swift_compiler_tool}" "-emit-sib" "-o" "${sib_file}" ${swift_flags} -Onone
797797
"@${file_path}"
798798
${command_touch_sib_outputs}
@@ -808,7 +808,7 @@ function(_compile_swift_files
808808
add_custom_command_target(
809809
sibopt_dependency_target
810810
COMMAND
811-
"${PYTHON_EXECUTABLE}" "${line_directive_tool}" "@${file_path}" --
811+
"$<TARGET_FILE:Python3::Interpreter>" "${line_directive_tool}" "@${file_path}" --
812812
"${swift_compiler_tool}" "-emit-sib" "-o" "${sibopt_file}" ${swift_flags} -O
813813
"@${file_path}"
814814
${command_touch_sibopt_outputs}
@@ -825,7 +825,7 @@ function(_compile_swift_files
825825
add_custom_command_target(
826826
sibgen_dependency_target
827827
COMMAND
828-
"${PYTHON_EXECUTABLE}" "${line_directive_tool}" "@${file_path}" --
828+
"$<TARGET_FILE:Python3::Interpreter>" "${line_directive_tool}" "@${file_path}" --
829829
"${swift_compiler_tool}" "-emit-sibgen" "-o" "${sibgen_file}" ${swift_flags}
830830
"@${file_path}"
831831
${command_touch_sibgen_outputs}

0 commit comments

Comments
 (0)