Commit 850ce475 authored by Cédric Traizet's avatar Cédric Traizet
Browse files

Merge branch 'update-CI-python38' into 'develop'

Update Python to 3.8 on CI builds

See merge request !856
parents 5df655db 01e7e238
Pipeline #8851 passed with stages
in 3 minutes and 50 seconds
......@@ -74,8 +74,8 @@ if "%TARGET%"=="10" (
echo Home dir: %HOMEDRIVE%%HOMEPATH%
:: Setup Python
set PATH=C:\tools\Python35-%ARCH%;%PATH%
set PATH=C:\tools\Python35-%ARCH%\Scripts;%PATH%
set PATH=C:\tools\Python37-%ARCH%;%PATH%
set PATH=C:\tools\Python37-%ARCH%\Scripts;%PATH%
:: Setup GL dlls
set PATH=%PATH%;C:\tools\GL\%ARCH%\bin
......
#
# Copyright (C) 2005-2020 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Configuration options for windows-8.1-x64-vc14.0.cmake
set(site_option
"CMAKE_CXX_FLAGS:STRING=/DTHROW_QCRITICAL=0 /DWIN32 /D_WINDOWS /W3 /GR /EHsc /D_ENABLE_EXTENDED_ALIGNED_STORAGE
")
#
# Copyright (C) 2005-2020 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Configuration options for windows-8.1-x86-vc14.0.cmake
set(site_option
"CMAKE_CXX_FLAGS:STRING=/DTHROW_QCRITICAL=0 /DWIN32 /D_WINDOWS /W3 /GR /EHsc /D_ENABLE_EXTENDED_ALIGNED_STORAGE
")
......@@ -38,12 +38,9 @@
#----------------------------------------------------------------------
set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 1000000)
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 300)
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 50)
if(NOT DEFINED CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS)
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 300)
endif()
set(CTEST_CUSTOM_COVERAGE_EXCLUDE
${CTEST_CUSTOM_COVERAGE_EXCLUDE}
......@@ -84,6 +81,7 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION
".*gdal_priv.h.*[Ww]arning.*"
".*cpl_string.h.*[Ww]arning.*"
".*ogr_feature.h.*[Ww]arning.*"
".*abstract.h.*warning.*"
# Ignore clang's summary warning, assuming prior text has matched some
# other warning expression:
......
......@@ -103,18 +103,35 @@ repository_status(${PROJECT_SOURCE_DIR} OTB_GIT_STATUS_MESSAGE)
# Find python stuff
# Version 3 is preferred before 2
set ( Python_ADDITIONAL_VERSIONS "3;2" )
set ( PythonInterp_FIND_REQUIRED ${OTB_WRAP_PYTHON} )
set ( PythonLibs_FIND_REQUIRED ${OTB_WRAP_PYTHON} )
find_package( PythonInterp )
if ( OTB_WRAP_PYTHON AND ( "x${PYTHON_VERSION_MAJOR}" STREQUAL "x2" ) )
message (WARNING "Python3 not found. There is no longer support of \
wrapping in python2 in OTB, but it can still be used.")
if(CMAKE_VERSION VERSION_LESS 3.12.0)
set ( Python_ADDITIONAL_VERSIONS "3;2" )
set ( PythonInterp_FIND_REQUIRED ${OTB_WRAP_PYTHON} )
set ( PythonLibs_FIND_REQUIRED ${OTB_WRAP_PYTHON} )
find_package( PythonInterp )
if ( OTB_WRAP_PYTHON AND ( "x${PYTHON_VERSION_MAJOR}" STREQUAL "x2" ) )
message (WARNING "Python3 not found. There is no longer support of \
wrapping in python2 in OTB, but it can still be used.")
endif()
# Now that we have a python version the addditional versions should only
# contain the version we have to get the corresponding libs
set (Python_ADDITIONAL_VERSIONS "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
find_package ( PythonLibs )
else()
if(WIN32)
set(Python_ROOT_DIR "C:/tools/Python37-x64")
endif()
find_package(Python REQUIRED COMPONENTS Interpreter Development)
if(Python_FOUND)
message(STATUS "Python Library directory : ${Python_LIBRARY_DIRS}")
message(STATUS "Python Headers directory : ${Python_INCLUDE_DIRS}")
#For compatibility reason, we have to define these variables
set(PYTHON_LIBRARIES ${Python_LIBRARIES})
set(PYTHON_INCLUDE_DIR ${Python_INCLUDE_DIRS})
set(PYTHON_LIBRARY_DIR ${Python_LIBRARY_DIRS})
set(PYTHON_VERSION_STRING ${Python_VERSION})
set(PYTHON_EXECUTABLE ${Python_EXECUTABLE})
endif()
endif()
# Now that we have a python version the addditional versions should only
# contain the version we have to get the corresponding libs
set (Python_ADDITIONAL_VERSIONS "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
find_package ( PythonLibs )
#-----------------------------------------------------------------------------
# Configure the default OTB_DATA_ROOT for the location of OTB Data.
......
......@@ -31,7 +31,7 @@ message(STATUS "")
message(STATUS "Configuring Cookbook...")
# Check we have python bindings with python 3+
if (NOT OTB_WRAP_PYTHON OR ${PYTHONLIBS_VERSION_STRING} STRLESS "3.0.0")
if (NOT OTB_WRAP_PYTHON)
message(FATAL_ERROR "CookBook build requires Python 3 wrappers. Try setting OTB_WRAP_PYTHON=ON in the CMake configuration, or disable the CookBook with BUILD_COOKBOOK=OFF.")
endif()
......
......@@ -84,8 +84,8 @@ necessary to install one of the following packages:
Python bindings
~~~~~~~~~~~~~~~
Since OTB 6.7.0 OTB bindings for Python 3.5 are distributed as a binary
package.
Since OTB 8.0.0 OTB bindings for Python 3.8 are distributed as a binary
package. (From OTB 6.7 to 7.4, bindings are provided for Python 3.5)
Please note that using a different Python version may not be compatible with
OTB wrappings. If the installation completes
without issue, information relating to your Python bindings will be provided.
......@@ -94,12 +94,12 @@ You must have Python NumPy bindings installed in your system. They can be instal
without admin rights as follows: "pip install --user numpy". This is to give users the option
to select their own existing Python installation rather than the one dibstributed by the OTB package.
By default, bindings for Python 3.5 will be enabled with the ``otbenv`` script.
By default, bindings for Python 3.8 will be enabled with the ``otbenv`` script.
Recompiling Python bindings
+++++++++++++++++++++++++++
If you are using another version of Python 3 than 3.5, but still want to use OTB Python bindings, it is possible
If you are using another version of Python 3 than 3.8, but still want to use OTB Python bindings, it is possible
to compile the python bindings again with your version of Python. CMake is required (it is available in most package
managers or at [https://cmake.org/]). At the root of the OTB installation run :
......
......@@ -51,6 +51,7 @@ Python bindings
Since OTB 6.7.0 OTB bindings for Python 3.5 are distributed as a binary
package.
Since OTB 8.0.0, the bindings for Python 3.7 are distributed
Please note that using a different Python version may not be compatible with
OTB wrappings. If the installation completes
without issue, information relating to your Python bindings will be provided.
......@@ -59,5 +60,5 @@ You must have Python numpy bindings installed in your system. They can be instal
without admin rights as follows: "pip install --user numpy". This is to give users the option
to select their own existing Python installation rather than the one dibstributed by the OTB package.
By default, bindings for Python 3.5 will be enabled with the ``otbenv`` script.
By default, bindings for Python 3.7 will be enabled with the ``otbenv`` script.
......@@ -25,8 +25,8 @@ import sphinx_rtd_theme
# and a custom version selection widget
# taken from https://stackoverflow.com/a/43186995/5815110
def setup(app):
app.add_stylesheet("css/otb_theme.css")
app.add_javascript("js/versions.js")
app.add_css_file("css/otb_theme.css")
app.add_js_file("js/versions.js")
# -- General configuration ------------------------------------------------
......
......@@ -17,17 +17,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
include_directories ( ${PYTHON_INCLUDE_DIR} )
if(CMAKE_VERSION VERSION_LESS 3.12.0)
include_directories ( ${PYTHON_INCLUDE_DIR} )
else()
include_directories( ${Python_INCLUDE_DIRS} )
endif()
include_directories ( ${CMAKE_CURRENT_SOURCE_DIR})
set_source_files_properties ( ../otbApplication.i PROPERTIES CPLUSPLUS ON )
# Get target name
set(extension_target _otbApplication)
if(POLICY CMP0078)
cmake_policy(GET CMP0078 swig_target_name_policy)
if (swig_target_name_policy STREQUAL "NEW")
set(extension_target otbApplication)
endif()
if(CMAKE_VERSION VERSION_GREATER 3.13.0)
#UseSwig now defaults its target name to the name of the .i file
set(extension_target otbApplication)
endif()
# Run swig
set(CMAKE_SWIG_FLAGS ${CMAKE_SWIG_GLOBAL_FLAGS})
......
......@@ -33,19 +33,28 @@ find_package(OTB REQUIRED HINTS ${PKG_PREFIX}/@OTB_INSTALL_PACKAGE_DIR@)
list(APPEND CMAKE_MODULE_PATH ${OTB_CMAKE_DIR})
include(${OTB_USE_FILE})
set ( Python_ADDITIONAL_VERSIONS "3;2" )
set ( PythonInterp_FIND_REQUIRED ${OTB_WRAP_PYTHON} )
set ( PythonLibs_FIND_REQUIRED ${OTB_WRAP_PYTHON} )
find_package( PythonInterp )
if ( OTB_WRAP_PYTHON AND ( ${PYTHON_VERSION_MAJOR} EQUAL 2 ) )
message (WARNING "Python3 not found. There is no longer support of \
wrapping in python2 in OTB, but it can still be used.")
if(CMAKE_VERSION VERSION_LESS 3.12.0)
set ( Python_ADDITIONAL_VERSIONS "3;2" )
set ( PythonInterp_FIND_REQUIRED ${OTB_WRAP_PYTHON} )
set ( PythonLibs_FIND_REQUIRED ${OTB_WRAP_PYTHON} )
find_package( PythonInterp )
if ( OTB_WRAP_PYTHON AND ( "x${PYTHON_VERSION_MAJOR}" STREQUAL "x2" ) )
message (WARNING "Python3 not found. There is no longer support of \
wrapping in python2 in OTB, but it can still be used.")
endif()
# Now that we have a python version the addditional versions should only
# contain the version we have to get the corresponding libs
set (Python_ADDITIONAL_VERSIONS "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
find_package ( PythonLibs )
include_directories(${PYTHON_INCLUDE_DIR})
else()
if(WIN32)
set(Python_ROOT_DIR "C:/tools/Python37-x64")
endif()
find_package( Python REQUIRED COMPONENTS Interpreter Development)
include_directories(${Python_INCLUDE_DIRS})
set(PYTHON_LIBRARIES ${Python_LIBRARIES})
endif()
# Now that we have a python version the addditional versions should only
# contain the version we have to get the corresponding libs
set (Python_ADDITIONAL_VERSIONS "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
find_package ( PythonLibs )
include_directories(${PYTHON_INCLUDE_DIR})
find_package(Numpy)
if ( NUMPY_FOUND )
......
......@@ -29,9 +29,9 @@ python_version_check() {
python_check_failed() {
printf %s\\n "*****Error occurred during installation******"
printf %s\\n "OTB python bindings normally require python 3.5 but current \
printf %s\\n "OTB python bindings normally require python 3.8 (or 3.7 for windows users) but current \
detected python version is $python_version"
printf %s\\n "If you have python 3.5 installed in your system you should \
printf %s\\n "If you have python 3.8 (or 3.7 for win users) installed in your system you should \
set OTB_PYTHON_EXE and re-run this installation script."
printf %s\\n "eg: OTB_PYTHON_EXE=/path/to/python3 ./OTB-X.Y-Linux64.run"
printf %s\\n "Python bindings might not work."
......
......@@ -359,16 +359,35 @@ configure_file(${CMAKE_SOURCE_DIR}/CMake/CTestCustom.cmake.in
# -PYTHON_EXECUTABLE
# -PYTHON_INCLUDE_DIR
# -PYTHON_LIBRARY
set ( Python_ADDITIONAL_VERSIONS "3;2" )
set ( PythonInterp_FIND_REQUIRED ${OTB_WRAP_PYTHON} )
set ( PythonLibs_FIND_REQUIRED ${OTB_WRAP_PYTHON} )
find_package( PythonInterp )
if ( OTB_WRAP_PYTHON AND ( "x${PYTHON_VERSION_MAJOR}" STREQUAL "x2" ) )
message (WARNING "Python3 not found. There is no longer support of \
wrapping in python2 in OTB, but it can still be used.")
if(CMAKE_VERSION VERSION_LESS 3.12.0)
set ( Python_ADDITIONAL_VERSIONS "3;2" )
set ( PythonInterp_FIND_REQUIRED ${OTB_WRAP_PYTHON} )
set ( PythonLibs_FIND_REQUIRED ${OTB_WRAP_PYTHON} )
find_package( PythonInterp )
if ( OTB_WRAP_PYTHON AND ( "x${PYTHON_VERSION_MAJOR}" STREQUAL "x2" ) )
message (WARNING "Python3 not found. There is no longer support of \
wrapping in python2 in OTB, but it can still be used.")
endif()
# Now that we have a python version the addditional versions should only
# contain the version we have to get the corresponding libs
set (Python_ADDITIONAL_VERSIONS "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
find_package ( PythonLibs )
else()
if(WIN32)
set(Python_ROOT_DIR "C:/tools/Python37-x64")
endif()
find_package( Python REQUIRED COMPONENTS Interpreter Development)
if(Python_FOUND)
message(STATUS "Python Library directory : ${Python_LIBRARY_DIRS}")
message(STATUS "Python Headers directory : ${Python_INCLUDE_DIRS}")
#For compatibility reason, we have to define these variables
set(PYTHON_LIBRARIES ${Python_LIBRARIES})
set(PYTHON_INCLUDE_DIR ${Python_INCLUDE_DIRS})
set(PYTHON_LIBRARY_DIR ${Python_LIBRARY_DIRS})
set(PYTHON_VERSION_STRING ${Python_VERSION})
set(PYTHON_EXECUTABLE ${Python_EXECUTABLE})
endif()
endif()
set (Python_ADDITIONAL_VERSIONS "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
find_package ( PythonLibs )
include(External_otb)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment