From patchwork Tue Jul 4 13:09:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Lichtenheld X-Patchwork-Id: 3271 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7301:3c07:b0:d9:b492:11d6 with SMTP id ki7csp4965941dyb; Tue, 4 Jul 2023 06:10:20 -0700 (PDT) X-Google-Smtp-Source: APBJJlFrATNlUkt2yg7FOTCd7nkgRSGBJU23UWULzSuR83IXjBz9P+BptJFLMVADNDL/nWzOTSlW X-Received: by 2002:a25:b842:0:b0:bf2:b00c:f08 with SMTP id b2-20020a25b842000000b00bf2b00c0f08mr10347389ybm.31.1688476220119; Tue, 04 Jul 2023 06:10:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688476220; cv=none; d=google.com; s=arc-20160816; b=sgoO2s4YQeSQrGNeoTZnSqsCLiqT3m68tx9JriXLFyHZk4y5MVGcOU0rAn7rteJgYL MjmqqqrJ50/GCXVr8xnFKtzDUcjZYLtvWVj4mBzuvmWjUDOJSZjIfZ+zU0OElJo0Z+i+ u7AF4aX+GO57nHdPj4zdKn++WFj91tciTMQZzywK3C+INdXqUB4585ktMYLzLG7vdneG /KWghjAJt/kYw6xoZorosHIr1GWXhkijjklO9rhgpOyFXoIM7XCG9daa9lJ3xEJs4eS5 phIh7EDgJwd20/aTpoc83bSrpiuLuybcnYAlksU8x+0dfn3zRFOK1d/ENQKx0Mutkx2H iCCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:message-id:date:to:from:dkim-signature:dkim-signature :dkim-signature; bh=UZd+1uJ8Z84JnJqHPa6Mx70mpOX+jBzSqHf+n17/voo=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=OoNbksCf+1UFw6w62tBndsBTSgdAwwafi4/5mKh3wmIoKmwiw7iHGSYLJP3egfvX89 bPktO+Hw54B7aFZq/x6naTXhz4nkuPhlzFuSEi956UyOsuYLqe04Lbm2HxbzSpuaQ/U4 ooHZhDlFGGcA03djpz1yy/1CVjtsEW6ZXipLoWJ+lZDpIpriJrbQRerVIWuvCGRVDQm1 g8txRC3PRywUdT+u7PDtuPrSOFd1GOzvx+kJ80h7BD9r9zyZRuanV3LnZvzoOAXxRI6f 2wy+sdFX3VhWEWhXfH6w1hgWeXN6n+iWq1FiRY/Mk1vh3aoPlsTJwrDhE2xlE8s/0Abl /bqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=LxtXEVmE; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=AA8k8KlW; dkim=neutral (body hash did not verify) header.i=@lichtenheld.com header.s=MBO0001 header.b=ZfEII15g; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id r19-20020a63ec53000000b005574bf28173si20851954pgj.481.2023.07.04.06.10.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Jul 2023 06:10:20 -0700 (PDT) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=LxtXEVmE; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=AA8k8KlW; dkim=neutral (body hash did not verify) header.i=@lichtenheld.com header.s=MBO0001 header.b=ZfEII15g; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1qGfmW-0007CJ-1E; Tue, 04 Jul 2023 13:09:24 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qGfmU-0007C8-CN for openvpn-devel@lists.sourceforge.net; Tue, 04 Jul 2023 13:09:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-Id: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=9DPXhinctSDflyIF3NpgukU/N73aPUT2rbwqu4ILiJo=; b=LxtXEVmEctpxhgr6eZa2rV1wSP pCbqsnmlFh+j0fgqCbnph/Nybgk6c4cux4mowcXv3MWwST6CyPdNYFO7BRE41UGef815ZnxzBpnkA lINKItU+dCoUhrqMODZaHO5b9TSL/3e2E2Zzzxrh9o20vYX67khl9cNeYp3JIl69J3bE=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:To:From: Sender:Reply-To:Cc:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=9DPXhinctSDflyIF3NpgukU/N73aPUT2rbwqu4ILiJo=; b=A A8k8KlW1E9ql8rnY0O2eUgKj8ECNr1OtGL/T2Wzs1GMxnttO0zCVJk/Edb2hBB0cGJtjv+VChmxrQ 7hSGpV0LhOFb8zynr9FQSin4IU7paeQFHnVf3J67b4NjSdUhPFqC2OqZKHyyxYRgPHtldi+F6uc0j XtvX3Rrm9R1dByJY=; Received: from mout-p-202.mailbox.org ([80.241.56.172]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1qGfmN-0007bR-Uc for openvpn-devel@lists.sourceforge.net; Tue, 04 Jul 2023 13:09:21 +0000 Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4QwNR42rVfz9sWt for ; Tue, 4 Jul 2023 15:09:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lichtenheld.com; s=MBO0001; t=1688476144; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=9DPXhinctSDflyIF3NpgukU/N73aPUT2rbwqu4ILiJo=; b=ZfEII15ggHCmAeLgzFVnseet9YycMwRowjpCo0hvYhztomSwWcZcVE5b7Fmjov2Ct86yvB b0w9Tg+cAMq6tGepo6eG3ba1vClGB+xOHjx+GHt62sPjyUZY98CbbedPND8wtvUnP+QqlU 9UjmJntkLzHHDS5gNSSLTsngnlI2HRq2BuOAIne8okvF2DgugHEgkoxVJ6rf4nSf1J8IoS VaOKsjsbqiltWCLRkd14OORHr+7y+CUhuFuFUPUU2id5SNU/q0zUNBdzW7gjqjri28GXQ/ bskcyt9zHJWC10TBys0VOX5wXQbUFxXk0U2UIG1tb4+lZT94TlN3rJWtYqNo0g== From: Frank Lichtenheld To: openvpn-devel@lists.sourceforge.net Date: Tue, 4 Jul 2023 15:09:02 +0200 Message-Id: <20230704130902.105585-1-frank@lichtenheld.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 4QwNR42rVfz9sWt X-Spam-Score: -0.9 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-2.v13.lw.sourceforge.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: On Windows we might need to call python because .py files are not directly executable. This is true e.g. for GHA runners. For now we assume that rst2html and rst2man can be handled in the same way and [...] Content analysis details: (-0.9 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [80.241.56.172 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Headers-End: 1qGfmN-0007bR-Uc Subject: [Openvpn-devel] [PATCH] CMake: Support doc builds on Windows machines that do not have .py file association X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1770495641224730171?= X-GMAIL-MSGID: =?utf-8?q?1770495641224730171?= On Windows we might need to call python because .py files are not directly executable. This is true e.g. for GHA runners. For now we assume that rst2html and rst2man can be handled in the same way and do not test both of them. Commit e8881ec6dd63bd80ce05202573eac54ab8657fcb unconditionally used $PYTHON, but that broke build on systems where the default python can't be used and we need to respect the shebang. Commit 5dbec1c019d14880ae7bf364b062d3589c7fd9e7 unconditionally did not use $PYTHON, but that broke build on the aformentioned GHA runners. This commit tries to establish a solution that works for both systems. Signed-off-by: Frank Lichtenheld Acked-BY: Arne Schwabe --- doc/CMakeLists.txt | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 2fba80bb..5e729efa 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1,14 +1,46 @@ set(_GENERATE_HTML_DOC YES) set(_GENERATE_MAN_DOC YES) +set(_MAYBE_PYTHON "") find_program(RST2HTML NAMES rst2html rst2html.py) find_program(RST2MAN NAMES rst2man rst2man.py) if (RST2HTML STREQUAL "RST2HTML-NOTFOUND") message(STATUS "rst2html not found, not generating HTML documentation") set(_GENERATE_HTML_DOC NO) +else () + # We only run this for RST2HTML and assume the result would be the same + # for RST2MAN + if (DEFINED CACHE{DOCUTILS_NEED_PYTHON}) + if ($CACHE{DOCUTILS_NEED_PYTHON}) + set(_MAYBE_PYTHON ${PYTHON}) + endif () + else () + execute_process( + COMMAND ${RST2HTML} --version + OUTPUT_VARIABLE RST2HTML_VERSION_EXE + ) + execute_process( + COMMAND ${PYTHON} ${RST2HTML} --version + OUTPUT_VARIABLE RST2HTML_VERSION_PY + ) + set(_DOCUTILS_NEED_PYTHON OFF) + if(RST2HTML_VERSION_EXE STREQUAL "") + if(RST2HTML_VERSION_PY STREQUAL "") + message(STATUS "${RST2HTML} found but not working, not generating documentation") + set(_GENERATE_HTML_DOC NO) + set(_GENERATE_MAN_DOC NO) + else () + message(STATUS "${RST2HTML} needs to be executed by ${PYTHON} to work") + set(_MAYBE_PYTHON ${PYTHON}) + set(_DOCUTILS_NEED_PYTHON ON) + endif () + endif () + set(DOCUTILS_NEED_PYTHON ${_DOCUTILS_NEED_PYTHON} CACHE BOOL + "Whether we need to call python instead of rst2*.py directly") + endif (DEFINED CACHE{DOCUTILS_NEED_PYTHON}) endif () if (RST2MAN STREQUAL "RST2MAN-NOTFOUND") - message(STATUS "rst2man not found, not generating HTML documentation") + message(STATUS "rst2man not found, not generating man pages") set(_GENERATE_MAN_DOC NO) endif () @@ -50,13 +82,13 @@ if (_GENERATE_HTML_DOC) list(APPEND ALL_DOCS openvpn.8.html openvpn-examples.5.html) add_custom_command( OUTPUT openvpn.8.html - COMMAND ${RST2HTML} ${RST_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/openvpn.8.rst ${CMAKE_CURRENT_BINARY_DIR}/openvpn.8.html + COMMAND ${_MAYBE_PYTHON} ${RST2HTML} ${RST_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/openvpn.8.rst ${CMAKE_CURRENT_BINARY_DIR}/openvpn.8.html MAIN_DEPENDENCY openvpn.8.rst DEPENDS ${OPENVPN_SECTIONS} ) add_custom_command( OUTPUT openvpn-examples.5.html - COMMAND ${RST2HTML} ${RST_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/openvpn-examples.5.rst ${CMAKE_CURRENT_BINARY_DIR}/openvpn-examples.5.html + COMMAND ${_MAYBE_PYTHON} ${RST2HTML} ${RST_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/openvpn-examples.5.rst ${CMAKE_CURRENT_BINARY_DIR}/openvpn-examples.5.html MAIN_DEPENDENCY openvpn-examples.5.rst DEPENDS ${OPENVPN_EXAMPLES_SECTIONS} ) @@ -65,13 +97,13 @@ if (_GENERATE_MAN_DOC) list(APPEND ALL_DOCS openvpn.8 openvpn-examples.5) add_custom_command( OUTPUT openvpn.8 - COMMAND ${RST2MAN} ${RST_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/openvpn.8.rst ${CMAKE_CURRENT_BINARY_DIR}/openvpn.8 + COMMAND ${_MAYBE_PYTHON} ${RST2MAN} ${RST_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/openvpn.8.rst ${CMAKE_CURRENT_BINARY_DIR}/openvpn.8 MAIN_DEPENDENCY openvpn.8.rst DEPENDS ${OPENVPN_SECTIONS} ) add_custom_command( OUTPUT openvpn-examples.5 - COMMAND ${RST2MAN} ${RST_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/openvpn-examples.5.rst ${CMAKE_CURRENT_BINARY_DIR}/openvpn-examples.5 + COMMAND ${_MAYBE_PYTHON} ${RST2MAN} ${RST_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/openvpn-examples.5.rst ${CMAKE_CURRENT_BINARY_DIR}/openvpn-examples.5 MAIN_DEPENDENCY openvpn-examples.5.rst DEPENDS ${OPENVPN_EXAMPLES_SECTIONS} )