ECC-1157: Python 2 support: Rename CMake option ENABLE_PYTHON to ENABLE_PYTHON2

This commit is contained in:
Shahram Najm 2020-10-15 17:08:25 +01:00
parent 95abb579a3
commit 4f1b1a6436
4 changed files with 13 additions and 13 deletions

View File

@ -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()

View File

@ -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 )

View File

@ -1,4 +1,4 @@
if( HAVE_PYTHON )
if( HAVE_PYTHON2 )
#find_package( SWIG )
#if( SWIG_FOUND )

View File

@ -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}