Skip to content

Commit

Permalink
Drop python2 support.
Browse files Browse the repository at this point in the history
  • Loading branch information
o01eg committed Feb 22, 2021
1 parent 8e5a415 commit 1a7385f
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 132 deletions.
122 changes: 2 additions & 120 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -220,121 +220,6 @@ ExternalProject_Get_Property(python-cmake SOURCE_DIR)
set(PYTHON_CMAKE_SOURCE_DIR ${SOURCE_DIR})
unset(SOURCE_DIR)


if(WIN32)
set(PYTHON_CONFIGURE_FLAGS
-DBUILD_EXTENSIONS_AS_BUILTIN=ON
)
set(PYTHON_CONFIGURE_INSTALL_DIR ${SDK_INSTALL_DIR})
else()
set(PYTHON_CONFIGURE_FLAGS "-DBUILD_FRAMEWORK=ON")
set(PYTHON_CONFIGURE_INSTALL_DIR ${SDK_INSTALL_DIR}/Frameworks)
endif()

ExternalProject_PatchSet(python PYTHON_PATCHSET)
ExternalProject_Add(python
DEPENDS ${DIST_PACK_TOOLS} python-cmake zlib
URL ${PYTHON_URL}
URL_MD5 ${PYTHON_MD5}
DOWNLOAD_DIR ${SDK_DOWNLOAD_DIR}
${PYTHON_PATCHSET}
COMMAND
${CMAKE_COMMAND} -E copy ${PYTHON_CMAKE_SOURCE_DIR}/CMakeLists.txt <SOURCE_DIR>
COMMAND
${CMAKE_COMMAND} -E copy ${PYTHON_CMAKE_SOURCE_DIR}/CTestConfig.cmake <SOURCE_DIR>
COMMAND
${CMAKE_COMMAND} -E make_directory <SOURCE_DIR>/cmake
COMMAND
${CMAKE_COMMAND} -E copy_directory ${PYTHON_CMAKE_SOURCE_DIR}/cmake/ <SOURCE_DIR>/cmake/
COMMAND
${CMAKE_COMMAND} -E copy_directory ${PYTHON_CMAKE_SOURCE_DIR}/patches/ <SOURCE_DIR>/patches/
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE_MAKEFILE}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES_}
-DCMAKE_INSTALL_MESSAGE=${CMAKE_INSTALL_MESSAGE}
-DCMAKE_PREFIX_PATH=<INSTALL_DIR>
-DBUILD_LIBPYTHON_SHARED=${BUILD_SHARED_LIBS}
-DPYTHON_VERSION=${PYTHON_VERSION}
${PYTHON_CONFIGURE_FLAGS}
-DDOWNLOAD_SOURCES=OFF
-DBUILD_TESTING=OFF
-DBUILD_WININST=OFF
-DUSE_SYSTEM_OpenSSL=OFF
-DENABLE_AUDIOOP=OFF
-DENABLE_BSDDB=OFF
#DENABLE_BZ2=OFF
-DENABLE_CODECS_CN=OFF
-DENABLE_CODECS_HK=OFF
-DENABLE_CODECS_ISO2022=OFF
-DENABLE_CODECS_JP=OFF
-DENABLE_CODECS_KR=OFF
#DENABLE_CODECS=OFF
-DENABLE_CODECS_TW=OFF
#DENABLE_CRYPT=OFF
-DENABLE_CSV=OFF
-DENABLE_CTYPES_TEST=OFF
-DENABLE_CURSES=OFF
-DENABLE_CURSES_PANEL=OFF
-DENABLE_DBM=OFF
-DENABLE_ELEMENTTREE=OFF
-DENABLE_GDBM=OFF
-DENABLE_GRP=OFF
-DENABLE_HASHLIB=OFF
-DENABLE_HOTSHOT=OFF
-DENABLE_JSON=OFF
-DENABLE_LINUXAUDIODEV=OFF
-DENABLE_MMAP=OFF
-DENABLE_MULTIBYTECODEC=OFF
-DENABLE_MULTIPROCESSING=OFF
-DENABLE_NIS=OFF
-DENABLE_OSSAUDIODEV=OFF
-DENABLE_PARSER=OFF
-DENABLE_PWD=OFF
-DENABLE_PYEXPAT=OFF
#DENABLE_READLINE=OFF
-DENABLE_SOCKET=OFF
-DENABLE_SPWD=OFF
-DENABLE_SQLITE3=OFF
-DENABLE_SSL=OFF
#DENABLE_STRUCT=OFF
-DENABLE_SYSLOG=OFF
-DENABLE_TERMIOS=OFF
-DENABLE_TESTCAPI=OFF
-DENABLE_TKINTER=OFF
-DENABLE_UNICODEDATA=OFF
#DENABLE_ZLIB=OFF
INSTALL_DIR ${PYTHON_CONFIGURE_INSTALL_DIR}
)
list(APPEND DIST_PACK_TARGETS python)

if(WIN32)
# FreeOrion packages the python standard library in a zip file for
# distribution.
ExternalProject_Add_Step(python
zipPythonSTDlib
DEPENDEES install
WORKING_DIRECTORY
<INSTALL_DIR>/lib/python27
COMMAND ${CMAKE_COMMAND} -E remove_directory
<INSTALL_DIR>/lib/python27/lib-dynload
COMMAND ${ZIP_EXECUTABLE} -r -9 -q --exclude=*.pyc
<INSTALL_DIR>/bin/python27.zip
.
COMMENT "Zip python standard library"
)

ExternalProject_Add_Step(python
removePythonSTDlib
DEPENDEES zipPythonSTDlib
COMMAND ${CMAKE_COMMAND} -E remove_directory
<INSTALL_DIR>/lib/python27
COMMENT "Remove python standard library from install"
)
endif()

if(WIN32)
set(PYTHON3_CONFIGURE_FLAGS
-DBUILD_EXTENSIONS_AS_BUILTIN=ON
Expand Down Expand Up @@ -680,7 +565,6 @@ else()
set(BOOST_TOOLSET msvc-${_VS_PLATFORM_TOOLSET_VERSION})
set(BOOST_OSX_SYSROOT "")
endif()
string(SUBSTRING "${PYTHON_VERSION}" 0 3 PYTHON_VERSION)
string(SUBSTRING "${PYTHON3_VERSION}" 0 3 PYTHON3_VERSION)

if(BUILD_SHARED_LIBS OR APPLE)
Expand All @@ -696,10 +580,8 @@ else()
endif()

if(APPLE)
set(PYTHON_INSTALL_DIR ${SDK_INSTALL_DIR}/Frameworks/Python.framework/Versions/${PYTHON_VERSION})
set(PYTHON3_INSTALL_DIR ${SDK_INSTALL_DIR}/Frameworks/Python.framework/Versions/${PYTHON3_VERSION})
else()
set(PYTHON_INSTALL_DIR ${SDK_INSTALL_DIR})
set(PYTHON3_INSTALL_DIR ${SDK_INSTALL_DIR})
endif()

Expand All @@ -719,7 +601,7 @@ endif()

ExternalProject_PatchSet(boost BOOST_PATCHSET)
ExternalProject_Add(boost
DEPENDS patch zlib python python3
DEPENDS patch zlib python3
URL ${BOOST_URL}
URL_MD5 ${BOOST_MD5}
DOWNLOAD_DIR ${SDK_DOWNLOAD_DIR}
Expand Down Expand Up @@ -749,7 +631,7 @@ ExternalProject_Add(boost
debug-symbols=on
${BOOST_CONFIGURE_FLAGS}
pch=off
python=${PYTHON_VERSION},${PYTHON3_VERSION}
python=${PYTHON3_VERSION}
-s NO_BZIP2=1
-s NO_ZLIB=0
# Build documentation for boost::iostreams is outdated.
Expand Down
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Notable changes to the FreeOrionSDK project will be documented in this file.

- Update boost version to 1.70
- Add Python3 in version 3.5.7 to SDK
- Drop Python2 from SDK
- Update python-cmake-buildsystem from c3b8d532242efed85fb3cd77b0e39e424b6db475
to 501869c2b124552dae669d5fd6b7e7101a7cc30c.
- Drop MSVC toolkit version v14.0 support.
Expand Down
1 change: 0 additions & 1 deletion README-WIN32.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,5 @@ Dependency Versions Included:
* OpenAL Soft 1.18.2 <http://kcat.strangesoft.net/openal.html>
* libpng 1.6.34 <http://www.libpng.org/pub/png/libpng.html>
* zlib 1.2.11 <http://www.zlib.net/>
* Python 2.7.14 <https://www.python.org/>
* Python 3.5.7 <https://www.python.org/>
* SDL 2.0.8 <https://www.libsdl.org/>
4 changes: 0 additions & 4 deletions Sources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ set(LIBPNG_MD5 6c7519f6c75939efa0ed3053197abd54)
set(PYTHON_CMAKE_URL https://github.com/python-cmake-buildsystem/python-cmake-buildsystem/archive/501869c2b124552dae669d5fd6b7e7101a7cc30c.zip)
set(PYTHON_CMAKE_MD5 06d2b8fe33eeb08be5e8a127ffa5fff8)

set(PYTHON_VERSION 2.7.14)
set(PYTHON_URL https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz)
set(PYTHON_MD5 cee2e4b33ad3750da77b2e85f2f8b724)

set(PYTHON3_VERSION 3.5.7)
set(PYTHON3_URL https://www.python.org/ftp/python/${PYTHON3_VERSION}/Python-${PYTHON3_VERSION}.tgz)
set(PYTHON3_MD5 92f4c16c55429bf986f5ab45fe3a6659)
Expand Down
7 changes: 0 additions & 7 deletions boost-config.jam.in
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
using python
: @PYTHON_VERSION@ # version
: @PYTHON_INSTALL_DIR@/bin/python@PYTHON_VERSION@ # cmd-or-prefix
: @PYTHON_INSTALL_DIR@/include/python@PYTHON_VERSION@ # includes
: @PYTHON_INSTALL_DIR@/lib # libraries
;

using python
: @PYTHON3_VERSION@ # version
: @PYTHON3_INSTALL_DIR@/bin/python@PYTHON3_VERSION@ # cmd-or-prefix
Expand Down

0 comments on commit 1a7385f

Please sign in to comment.