From: "cron2 (Code Review)" Date: Fri, 27 Dec 2024 11:54:11 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., lstipakov@...277... Message-ID: <064a673f542abd422959d3c2db07fdcb4bde601e-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="36bb3zSd8Ts="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[master]: Ensure that Python3 is available List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: stipa , flichtenheld , openvpn-devel --36bb3zSd8Ts= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/84= 6?usp=3Demail ) Change subject: Ensure that Python3 is available ...................................................................... Ensure that Python3 is available Use the more standard cmake find_package to search for Python3 and make it = required. This also provides a better error message than "version.cmake" not found when python3 is missi= ng. Change-Id: I350fd615ed8474d34392a057a5f8bded78173949 Signed-off-by: Arne Schwabe Acked-by: Lev Stipakov Message-Id: <20241227112255.11992-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg30= 232.html Signed-off-by: Gert Doering --- M CMakeLists.txt 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b5b7ff..9ffcc89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,9 +107,9 @@ endif () endif () -find_program(PYTHON NAMES python3 python) +find_package(Python3 REQUIRED COMPONENTS Interpreter) execute_process( - COMMAND ${PYTHON} ${CMAKE_CURRENT_SOURCE_DIR}/contrib/cmake/parse-vers= ion.m4.py ${CMAKE_CURRENT_SOURCE_DIR}/version.m4 + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/contrib/cmak= e/parse-version.m4.py ${CMAKE_CURRENT_SOURCE_DIR}/version.m4 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) include(${CMAKE_CURRENT_BINARY_DIR}/version.cmake) @@ -339,7 +339,7 @@ add_custom_command( OUTPUT always_rebuild config-version.h - COMMAND ${PYTHON} ${CMAKE_CURRENT_SOURCE_DIR}/contrib/cmake/git-versio= n.py + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/contrib/cmak= e/git-version.py ) set(HAVE_CONFIG_VERSION_H YES) -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/846?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I350fd615ed8474d34392a057a5f8bded78173949 Gerrit-Change-Number: 846 Gerrit-PatchSet: 3 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: stipa Gerrit-CC: openvpn-devel Gerrit-MessageType: merged --36bb3zSd8Ts= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 submitted this change.

View Change

Ensure that Python3 is available

Use th= e more standard cmake find_package to search for Python3 and make it requir= ed. This also provides
a better error message than "version.cmake&q= uot; not found when python3 is missing.

Change-Id: I350fd615ed8474d3= 4392a057a5f8bded78173949
Signed-off-by: Arne Schwabe <arne-openvpn@...1186...= .1227...>
Acked-by: Lev Stipakov <lstipakov@...277...>
Messa= ge-Id: <20241227112255.11992-1-gert@...1296...>
URL: https://www.m= ail-archive.com/openvpn-devel@lists.sourceforge.net/msg30232.html
Signed= -off-by: Gert Doering <gert@...1296...>
---
M CMakeLists.txt1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5b5b7= ff..9ffcc89 100644
--- a/CMakeLists.txt
+++= b/CMakeLists.txt
@@ -107,9 +107,9 @@
= endif ()
endif ()

-find_program(PYTHON NAMES python3 python)
+find_package(Python3 = REQUIRED COMPONENTS Interpreter)
execute_process(- COMMAND ${PYTHON} ${CMAKE_= CURRENT_SOURCE_DIR}/contrib/cmake/parse-version.m4.py ${CMAKE_CURRENT_SOURC= E_DIR}/version.m4
+ = COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/contrib/cmake/p= arse-version.m4.py ${CMAKE_CURRENT_SOURCE_DIR}/version.m4
= WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
include(${CMAKE_CURRENT_BINARY_DIR}/version.cmake)@@ -339,7 +339,7 @@

add_custom_co= mmand(
OUTPUT always_rebuild config-version.h- COMMAND ${PYTHON} ${CMAKE_= CURRENT_SOURCE_DIR}/contrib/cmake/git-version.py
+ COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURR= ENT_SOURCE_DIR}/contrib/cmake/git-version.py
)<= br> set(HAVE_CONFIG_VERSION_H YES)

=

To view, visit change 846. To unsubscribe, or for help writi= ng mail filters, visit setti= ngs.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I350fd615ed8474d34392a057a5f= 8bded78173949
Gerrit-Change-Number: 846
Gerrit-PatchSet: 3
Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: stipa <lstipakov@...277...= >
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: merged
--36bb3zSd8Ts=--