From 4631488a7861f19d1ffda8f0c6b270582a064055 Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Sun, 2 Aug 2020 02:58:50 -0400 Subject: [PATCH] Fix finding python2 interpreter on linux --- indra/cmake/BuildPackagesInfo.cmake | 4 +- indra/cmake/LLTestCommand.cmake | 6 +-- indra/cmake/Python.cmake | 41 ++++--------------- indra/cmake/TemplateCheck.cmake | 2 +- indra/cmake/run_build_test.py | 2 +- indra/copy_win_scripts/start-client.py | 2 +- indra/fix-incredibuild.py | 2 +- .../python/indra/util/test_win32_manifest.py | 2 +- indra/llcorehttp/CMakeLists.txt | 2 +- .../llcorehttp/tests/test_llcorehttp_peer.py | 2 +- .../llmessage/tests/test_llsdmessage_peer.py | 2 +- indra/llmessage/tests/testrunner.py | 2 +- indra/newview/CMakeLists.txt | 16 ++++---- indra/newview/generate_breakpad_symbols.py | 2 +- indra/newview/tests/test_llxmlrpc_peer.py | 2 +- indra/newview/viewer_manifest.py | 2 +- indra/test/test_llmanifest.py | 2 +- 17 files changed, 33 insertions(+), 60 deletions(-) diff --git a/indra/cmake/BuildPackagesInfo.cmake b/indra/cmake/BuildPackagesInfo.cmake index 8f8b6b23300..6f5f6fd9355 100644 --- a/indra/cmake/BuildPackagesInfo.cmake +++ b/indra/cmake/BuildPackagesInfo.cmake @@ -13,8 +13,8 @@ add_custom_command(OUTPUT packages-info.txt MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/../autobuild.xml DEPENDS ${CMAKE_SOURCE_DIR}/../scripts/packages-formatter.py ${CMAKE_SOURCE_DIR}/../autobuild.xml - COMMAND ${PYTHON_EXECUTABLE} + COMMAND ${Python2_EXECUTABLE} ${CMAKE_SOURCE_DIR}/cmake/run_build_test.py -DAUTOBUILD_ADDRSIZE=${ADDRESS_SIZE} -DAUTOBUILD=${AUTOBUILD_EXECUTABLE} - ${PYTHON_EXECUTABLE} + ${Python2_EXECUTABLE} ${CMAKE_SOURCE_DIR}/../scripts/packages-formatter.py "${VIEWER_CHANNEL}" "${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}" > packages-info.txt ) diff --git a/indra/cmake/LLTestCommand.cmake b/indra/cmake/LLTestCommand.cmake index f75c23a5de2..984f7bb22ad 100644 --- a/indra/cmake/LLTestCommand.cmake +++ b/indra/cmake/LLTestCommand.cmake @@ -4,14 +4,14 @@ MACRO(LL_TEST_COMMAND OUTVAR LD_LIBRARY_PATH) # cannot return a value. And yet, variables you set inside a FUNCTION are # local. Try a MACRO instead. SET(value - ${PYTHON_EXECUTABLE} + ${Python2_EXECUTABLE} "${CMAKE_SOURCE_DIR}/cmake/run_build_test.py") FOREACH(dir ${LD_LIBRARY_PATH}) LIST(APPEND value "-l${dir}") ENDFOREACH(dir) - # Enough different tests want to be able to find CMake's PYTHON_EXECUTABLE + # Enough different tests want to be able to find CMake's Python2_EXECUTABLE # that we should just pop it into the environment for everybody. - LIST(APPEND value "-DPYTHON=${PYTHON_EXECUTABLE}") + LIST(APPEND value "-DPYTHON=${Python2_EXECUTABLE}") LIST(APPEND value ${ARGN}) SET(${OUTVAR} ${value}) ##IF(LL_TEST_VERBOSE) diff --git a/indra/cmake/Python.cmake b/indra/cmake/Python.cmake index 1f687f59dbe..e9bf28fc832 100644 --- a/indra/cmake/Python.cmake +++ b/indra/cmake/Python.cmake @@ -1,19 +1,17 @@ # -*- cmake -*- -set(PYTHONINTERP_FOUND) - if (WINDOWS) # On Windows, explicitly avoid Cygwin Python. if (DEFINED ENV{VIRTUAL_ENV}) - find_program(PYTHON_EXECUTABLE + find_program(Python2_EXECUTABLE NAMES python.exe PATHS "$ENV{VIRTUAL_ENV}\\scripts" NO_DEFAULT_PATH ) else() - find_program(PYTHON_EXECUTABLE + find_program(Python2_EXECUTABLE NAMES python25.exe python23.exe python.exe NO_DEFAULT_PATH # added so that cmake does not find cygwin python PATHS @@ -29,37 +27,12 @@ if (WINDOWS) [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath] ) endif() -elseif (EXISTS /etc/debian_version) - # On Debian and Ubuntu, avoid Python 2.4 if possible. - - find_program(PYTHON_EXECUTABLE python PATHS /usr/bin) - - if (PYTHON_EXECUTABLE) - set(PYTHONINTERP_FOUND ON) - endif (PYTHON_EXECUTABLE) -elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - # On MAC OS X be sure to search standard locations first - string(REPLACE ":" ";" PATH_LIST "$ENV{PATH}") - find_program(PYTHON_EXECUTABLE - NAMES python python25 python24 python23 - NO_DEFAULT_PATH # Avoid searching non-standard locations first - PATHS - /bin - /usr/bin - /usr/local/bin - ${PATH_LIST} - ) + if (NOT Python2_EXECUTABLE) + message(FATAL_ERROR "No Python interpreter found") + endif (NOT Python2_EXECUTABLE) - if (PYTHON_EXECUTABLE) - set(PYTHONINTERP_FOUND ON) - endif (PYTHON_EXECUTABLE) + mark_as_advanced(Python2_EXECUTABLE) else (WINDOWS) - include(FindPythonInterp) + find_package(Python2 REQUIRED COMPONENTS Interpreter) endif (WINDOWS) - -if (NOT PYTHON_EXECUTABLE) - message(FATAL_ERROR "No Python interpreter found") -endif (NOT PYTHON_EXECUTABLE) - -mark_as_advanced(PYTHON_EXECUTABLE) diff --git a/indra/cmake/TemplateCheck.cmake b/indra/cmake/TemplateCheck.cmake index 2fada2eda97..4dc3e89c311 100644 --- a/indra/cmake/TemplateCheck.cmake +++ b/indra/cmake/TemplateCheck.cmake @@ -6,7 +6,7 @@ macro (check_message_template _target) add_custom_command( TARGET ${_target} PRE_LINK - COMMAND ${PYTHON_EXECUTABLE} + COMMAND ${Python2_EXECUTABLE} ARGS ${SCRIPTS_DIR}/template_verifier.py --mode=development --cache_master --master_url=${TEMPLATE_VERIFIER_MASTER_URL} ${TEMPLATE_VERIFIER_OPTIONS} COMMENT "Verifying message template - See http://wiki.secondlife.com/wiki/Template_verifier.py" diff --git a/indra/cmake/run_build_test.py b/indra/cmake/run_build_test.py index ec5d33f902b..af2d8a0153c 100755 --- a/indra/cmake/run_build_test.py +++ b/indra/cmake/run_build_test.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 """\ @file run_build_test.py @author Nat Goodspeed diff --git a/indra/copy_win_scripts/start-client.py b/indra/copy_win_scripts/start-client.py index bcc99a49b0d..6c4c15ad39f 100755 --- a/indra/copy_win_scripts/start-client.py +++ b/indra/copy_win_scripts/start-client.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 """\ @file start-client.py diff --git a/indra/fix-incredibuild.py b/indra/fix-incredibuild.py index 6a2c8f17078..6b13a7b466f 100755 --- a/indra/fix-incredibuild.py +++ b/indra/fix-incredibuild.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 ## ## $LicenseInfo:firstyear=2011&license=viewerlgpl$ ## Second Life Viewer Source Code diff --git a/indra/lib/python/indra/util/test_win32_manifest.py b/indra/lib/python/indra/util/test_win32_manifest.py index 0532cb00653..9863b97778a 100755 --- a/indra/lib/python/indra/util/test_win32_manifest.py +++ b/indra/lib/python/indra/util/test_win32_manifest.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 """\ @file test_win32_manifest.py @brief Test an assembly binding version and uniqueness in a windows dll or exe. diff --git a/indra/llcorehttp/CMakeLists.txt b/indra/llcorehttp/CMakeLists.txt index ee1163f1130..44f339d2c4a 100644 --- a/indra/llcorehttp/CMakeLists.txt +++ b/indra/llcorehttp/CMakeLists.txt @@ -149,7 +149,7 @@ if (LL_TESTS AND LLCOREHTTP_TESTS) "${llcorehttp_TEST_SOURCE_FILES}" "${test_libs}" "-Dhttp_proxy" - ${PYTHON_EXECUTABLE} + ${Python2_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/tests/test_llcorehttp_peer.py" ) diff --git a/indra/llcorehttp/tests/test_llcorehttp_peer.py b/indra/llcorehttp/tests/test_llcorehttp_peer.py index 493143641b0..6e5ca38e894 100755 --- a/indra/llcorehttp/tests/test_llcorehttp_peer.py +++ b/indra/llcorehttp/tests/test_llcorehttp_peer.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 """\ @file test_llsdmessage_peer.py @author Nat Goodspeed diff --git a/indra/llmessage/tests/test_llsdmessage_peer.py b/indra/llmessage/tests/test_llsdmessage_peer.py index 9cd2959ea18..511fd31fc86 100755 --- a/indra/llmessage/tests/test_llsdmessage_peer.py +++ b/indra/llmessage/tests/test_llsdmessage_peer.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 """\ @file test_llsdmessage_peer.py @author Nat Goodspeed diff --git a/indra/llmessage/tests/testrunner.py b/indra/llmessage/tests/testrunner.py index c25945067eb..baabe05f1b5 100755 --- a/indra/llmessage/tests/testrunner.py +++ b/indra/llmessage/tests/testrunner.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 """\ @file testrunner.py @author Nat Goodspeed diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 33a18dea087..aa244028870 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1903,7 +1903,7 @@ if (WINDOWS) add_custom_command( OUTPUT ${CMAKE_CFG_INTDIR}/copy_touched.bat - COMMAND ${PYTHON_EXECUTABLE} + COMMAND ${Python2_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py --actions=copy @@ -1967,7 +1967,7 @@ if (WINDOWS) if (PACKAGE) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/event_host.tar.bz2 - COMMAND ${PYTHON_EXECUTABLE} + COMMAND ${Python2_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/event_host_manifest.py ${CMAKE_CURRENT_SOURCE_DIR}/.. @@ -1981,7 +1981,7 @@ if (WINDOWS) add_custom_command( OUTPUT ${CMAKE_CFG_INTDIR}/touched.bat - COMMAND ${PYTHON_EXECUTABLE} + COMMAND ${Python2_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py --arch=${ARCH} @@ -2128,7 +2128,7 @@ if (LINUX) add_custom_command( OUTPUT ${product}.tar.bz2 - COMMAND ${PYTHON_EXECUTABLE} + COMMAND ${Python2_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py --arch=${ARCH} @@ -2154,7 +2154,7 @@ if (LINUX) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.copy_touched - COMMAND ${PYTHON_EXECUTABLE} + COMMAND ${Python2_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py --actions=copy @@ -2231,7 +2231,7 @@ if (DARWIN) add_custom_command( TARGET ${VIEWER_BINARY_NAME} POST_BUILD - COMMAND ${PYTHON_EXECUTABLE} + COMMAND ${Python2_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py --actions=copy @@ -2267,7 +2267,7 @@ if (DARWIN) add_custom_command( TARGET llpackage POST_BUILD - COMMAND ${PYTHON_EXECUTABLE} + COMMAND ${Python2_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py --arch=${ARCH} @@ -2333,7 +2333,7 @@ if (PACKAGE AND (RELEASE_CRASH_REPORTING OR NON_RELEASE_CRASH_REPORTING) AND VIE set(LLBUILD_CONFIG ${CMAKE_CFG_INTDIR}) endif(CMAKE_CFG_INTDIR STREQUAL ".") add_custom_command(OUTPUT "${VIEWER_SYMBOL_FILE}" - COMMAND "${PYTHON_EXECUTABLE}" + COMMAND "${Python2_EXECUTABLE}" ARGS "${CMAKE_CURRENT_SOURCE_DIR}/generate_breakpad_symbols.py" "${LLBUILD_CONFIG}" diff --git a/indra/newview/generate_breakpad_symbols.py b/indra/newview/generate_breakpad_symbols.py index d351c406bce..2fc5abe8bac 100755 --- a/indra/newview/generate_breakpad_symbols.py +++ b/indra/newview/generate_breakpad_symbols.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 """\ @file generate_breakpad_symbols.py @author Brad Kittenbrink <brad@lindenlab.com> diff --git a/indra/newview/tests/test_llxmlrpc_peer.py b/indra/newview/tests/test_llxmlrpc_peer.py index cff40aa4c25..f644afa1a2a 100755 --- a/indra/newview/tests/test_llxmlrpc_peer.py +++ b/indra/newview/tests/test_llxmlrpc_peer.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 """\ @file test_llxmlrpc_peer.py @author Nat Goodspeed diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index f48f073b20e..8c0bbc26c38 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 """\ @file viewer_manifest.py @author Ryan Williams diff --git a/indra/test/test_llmanifest.py b/indra/test/test_llmanifest.py index a97abbc6eed..b2b2b72c3bb 100755 --- a/indra/test/test_llmanifest.py +++ b/indra/test/test_llmanifest.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 """ @file test_llmanifest.py @author Ryan Williams -- GitLab