cocos2d / cocos2d-x

Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.
https://www.cocos.com/en/cocos2d-x
18.16k stars 7.05k forks source link

Python 2 End of Life Announced as January 1st 2020 , need to upgrade the cli #20522

Open meiry opened 4 years ago

meiry commented 4 years ago

Steps to Reproduce:

  1. python ./setup result :
    The python version is 3.6. But python 2.x is required. (Version 2.7 is well tested)
    Download it here: https://www.python.org/

the python 2.7 this year-end of life, need to upgrade to 3.7 any planes?

also i want to point out that installing python7 and making venv with python7 is not enough ! in windows compilation it searching for python2 out side the venv see error :

12>Building Custom Rule C:/Dev/my/cpp/2d/TestGameVC/CMakeLists.txt
12>    copying to C:/Dev/my/cpp/2d/TestGameVC/build/bin/TestGameVC/Debug/Resources
12>'C:\cygwin64\bin\python2' is not recognized as an internal or external command,
12>operable program or batch file.
12>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: The command "setlocal
12>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: "C:\Program Files\CMake\bin\cmake.exe" -E echo "    copying to C:/Dev/my/cpp/2d/TestGameVC/build/bin/TestGameVC/Debug/Resources"
12>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
12>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: C:\cygwin64\bin\python2 C:/Dev/my/cpp/2d/TestGameVC/cocos2d/cmake/scripts/sync_folder.py -s C:/Dev/my/cpp/2d/TestGameVC/Resources -d C:/Dev/my/cpp/2d/TestGameVC/build/bin/TestGameVC/Debug/Resources
12>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
12>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: :cmEnd
12>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
12>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: :cmErrorLevel
12>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: exit /b %1
12>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: :cmDone
12>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd
12>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: :VCEnd" exited with code 9009.
12>Done building project "SYNC_RESOURCE-TestGameVC.vcxproj" -- FAILED.
meiry commented 4 years ago

I found a solution which is "Good Enough" and works
first of all if you have python 3 , one can download python 2.7 and create venv which is isolated virtual env with your python version in my case python 2.7

python virtualenv --python=C:/python2.7/     my_python27_venv

then when created in windows you must activate it

c:/my_python27_venv/Scripts/activate.bat

then you can execute the cocos cli from within the venv no in CocosBuildSet.cmake remove python2 in find_program(PYTHON_COMMAND NAMES python)

the int will find the correct python 2.7 when executing cmak

zoozooll commented 3 years ago

Yes. Can cocos2ds upgrade python script files to 3.x?

betovidal commented 3 years ago

It doesn't seem like it's going to happen soon https://github.com/cocos2d/cocos2d-x/issues/11210

meiry commented 3 years ago

@betovidal its ashame , but i have feeling that the all cocos2d-x native lib support is not gooing to happen soon ...

solodon4 commented 2 years ago

GItHub actions runners complain as well:

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.

MrBenGriffin commented 2 years ago

The default python on macOS is no longer Python2.7 I could do the python for macOS (and probably linux). I don't know enough windows to handle setting environments.

I'm really not sure why there is one script handling all of the OS anyway. It's also highly likely that most of the OS variations can be packaged into a json file (as was done with translations, rather than using endless tests.

itoh-at-live2d-com commented 1 year ago

We’ve been keeping the particular Python 2 environment to build the Cocos2d-x using CI. Cocos2d-x is the gratest product in Opensource Game Engine we thought. To keep the sustainability, We hope for the migration of Python 3.

meiry commented 1 year ago

@itoh-at-live2d-com You know the cocos2dx c++ is dead right ? try this : https://github.com/axmolengine/axmol its fork