From 4f1b1a6436b183253ea28a186cf989f579f95c31 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Thu, 15 Oct 2020 17:08:25 +0100 Subject: [PATCH] ECC-1157: Python 2 support: Rename CMake option ENABLE_PYTHON to ENABLE_PYTHON2 --- CMakeLists.txt | 10 +++++----- examples/python/CMakeLists.txt | 12 ++++++------ python/CMakeLists.txt | 2 +- tests/CMakeLists.txt | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d3b4bf3e..f37c3c67c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ cmake_minimum_required( VERSION 3.12 FATAL_ERROR ) find_package( ecbuild 3.4 REQUIRED HINTS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../ecbuild) # Initialise project -project( eccodes VERSION 2.19.0 LANGUAGES C ) +project( eccodes VERSION 2.20.0 LANGUAGES C ) ############################################################################### # system checks needed for eccodes_config.h and some options like MEMFS @@ -117,7 +117,7 @@ ecbuild_add_option( FEATURE AEC ecbuild_find_python( VERSION 2.6 NO_LIBS ) find_package( NumPy ) -ecbuild_add_option( FEATURE PYTHON +ecbuild_add_option( FEATURE PYTHON2 DESCRIPTION "Build the ecCodes Python2 interface (deprecated)" DEFAULT OFF #CONDITION Python_FOUND AND NumPy_FOUND @@ -452,7 +452,7 @@ ecbuild_pkgconfig( IGNORE_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS} ${NUMPY_INCLUDE_DIRS} ${NETCDF_INCLUDE_DIRS} VARIABLES HAVE_MEMFS HAVE_JPEG HAVE_LIBJASPER HAVE_LIBOPENJPEG HAVE_ECCODES_THREADS HAVE_ECCODES_OMP_THREADS - HAVE_NETCDF HAVE_PYTHON HAVE_FORTRAN HAVE_PNG HAVE_AEC + HAVE_NETCDF HAVE_PYTHON2 HAVE_FORTRAN HAVE_PNG HAVE_AEC ) if( HAVE_FORTRAN ) ecbuild_pkgconfig( @@ -464,7 +464,7 @@ if( HAVE_FORTRAN ) ${PYTHON_INCLUDE_DIRS} ${NUMPY_INCLUDE_DIRS} ${NETCDF_INCLUDE_DIRS} VARIABLES HAVE_MEMFS HAVE_JPEG HAVE_LIBJASPER HAVE_LIBOPENJPEG HAVE_ECCODES_THREADS HAVE_ECCODES_OMP_THREADS - HAVE_NETCDF HAVE_PYTHON HAVE_PNG HAVE_AEC + HAVE_NETCDF HAVE_PYTHON2 HAVE_PNG HAVE_AEC ) endif() @@ -487,7 +487,7 @@ ecbuild_info(" | ecCodes version ${eccodes_VERSION} |") ecbuild_info(" +--------------------------+") ecbuild_info("") -if( HAVE_PYTHON ) +if( HAVE_PYTHON2 ) ecbuild_deprecate("Python2 support is deprecated and will be discontinued") endif() diff --git a/examples/python/CMakeLists.txt b/examples/python/CMakeLists.txt index 2e7fb82c5..1b446e231 100644 --- a/examples/python/CMakeLists.txt +++ b/examples/python/CMakeLists.txt @@ -18,7 +18,7 @@ foreach( tool ${test_bins} ) ecbuild_add_executable( TARGET p_${tool} NOINSTALL SOURCES ${tool}.c - CONDITION HAVE_PYTHON + CONDITION HAVE_PYTHON2 LIBS eccodes ) list( APPEND ptools p_${tool} ) endforeach() @@ -104,7 +104,7 @@ endif() # The high level python test requires new features in the unittest # which are only there for python 2.7 onwards -if( HAVE_PYTHON AND PYTHON_VERSION_STRING VERSION_GREATER "2.7" ) +if( HAVE_PYTHON2 AND PYTHON_VERSION_STRING VERSION_GREATER "2.7" ) #ecbuild_info("Python examples: Adding test for High-level Pythonic Interface") list( APPEND tests_extra high_level_api ) list( APPEND tests_extra grib_set_keys ) # Uses OrderedDict @@ -115,7 +115,7 @@ foreach( test ${tests_basic} ) TYPE SCRIPT DEPENDS ${ptools} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh - CONDITION HAVE_PYTHON + CONDITION HAVE_PYTHON2 ENVIRONMENT PYTHON=${PYTHON_EXECUTABLE} ) endforeach() foreach( test ${tests_extra} ) @@ -123,7 +123,7 @@ foreach( test ${tests_extra} ) TYPE SCRIPT DEPENDS ${ptools} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test}.sh - CONDITION HAVE_PYTHON AND ENABLE_EXTRA_TESTS + CONDITION HAVE_PYTHON2 AND ENABLE_EXTRA_TESTS ENVIRONMENT PYTHON=${PYTHON_EXECUTABLE} TEST_DEPENDS eccodes_download_gribs eccodes_download_tigge_gribs eccodes_download_bufrs ) endforeach() @@ -133,7 +133,7 @@ ecbuild_add_test( TARGET eccodes_p_bufr_encode_flight_test TYPE SCRIPT DEPENDS ${ptools} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bufr_encode_flight.sh - CONDITION HAVE_PYTHON AND ENABLE_EXTRA_TESTS AND HAVE_BUILD_TOOLS + CONDITION HAVE_PYTHON2 AND ENABLE_EXTRA_TESTS AND HAVE_BUILD_TOOLS ENVIRONMENT PYTHON=${PYTHON_EXECUTABLE} RESOURCES flight_data.csv TEST_DEPENDS eccodes_download_bufrs ) @@ -143,6 +143,6 @@ ecbuild_add_test( TARGET eccodes_p_grib_ccsds_test TYPE SCRIPT DEPENDS ${ptools} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_ccsds.sh - CONDITION HAVE_PYTHON AND HAVE_AEC AND ENABLE_EXTRA_TESTS + CONDITION HAVE_PYTHON2 AND HAVE_AEC AND ENABLE_EXTRA_TESTS ENVIRONMENT PYTHON=${PYTHON_EXECUTABLE} TEST_DEPENDS eccodes_download_gribs ) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 43cd2be22..a65005596 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,4 +1,4 @@ -if( HAVE_PYTHON ) +if( HAVE_PYTHON2 ) #find_package( SWIG ) #if( SWIG_FOUND ) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9940abddd..ba3d5094d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -243,7 +243,7 @@ if( HAVE_BUILD_TOOLS ) endif() - if( HAVE_PYTHON AND ENABLE_EXTRA_TESTS ) + if( HAVE_PYTHON2 AND ENABLE_EXTRA_TESTS ) list( APPEND ptests bufr_dump_encode_python bufr_dump_decode_python ) foreach( test ${ptests} ) ecbuild_add_test( TARGET eccodes_t_${test}