conan-io / conan-center-index

Recipes for the ConanCenter repository
https://conan.io/center
MIT License
966 stars 1.77k forks source link

[package] qt/5.x.x: failure in python2 version checking if webengine build is enabled #25412

Open psikorski opened 1 month ago

psikorski commented 1 month ago

Description

Method "validate_build" (https://github.com/conan-io/conan-center-index/blob/master/recipes/qt/5.x.x/conanfile.py#L144) checks if the proper python2 version is installed if qtwebengine is set to true. And, I think, this method incorrectly checks the version based on the whole output of the cmd_v = f"\"{python_exe}\" -c \"import platform;print(platform.python_version())\"" command. As it is visible in the attached part of the log, it has a problem with parsing the version out of the command output.

I think it is related to this PR: https://github.com/conan-io/conan-center-index/pull/24768

Package and Environment Details

Conan profile

[settings] os=Windows os_build=Windows arch=x86_64 arch_build=x86_64 compiler=Visual Studio compiler.version=17 compiler.runtime=MD compiler.toolset=v142 build_type=RelWithDebInfo [options] qt:shared=True qt:qtgamepad=True qt:qtwebengine=True qt:gui=True qt:qtdeclarative=True qt:qtlocation=True qt:qtwebchannel=True qt:qtwebview=True qt:qtremoteobjects=True

Steps to reproduce

conan install --profile exampleProfile --build=missing ./

Logs

Click to expand log ``` ... Installing (downloading, building) binaries... ERROR: There are invalid packages (packages that cannot exist for this configuration): qt/5.15.14: Cannot build for this configuration: Found Python 2 in path, but with invalid version ----Running------ > "C:\Python279\python2.EXE" -c "import platform;print(platform.python_version())" ----------------- 2.7.9 (QtWebEngine requires >= 2.7.5 & < 3.0.0) If you have both Python 2 and 3 installed, copy the python 2 executable topython2(.exe) ```
jcar87 commented 1 month ago

HI @psikorski, thank you for reporting this.

Indeed it would have been caused by https://github.com/conan-io/conan-center-index/pull/24768 - although before then, it did not work either - I did test this (quite extensively) on both Windows and Linux.

Could you run the following command in a terminal:

"C:\Python279\python2.EXE" -c "import platform;print(platform.python_version())"

to check what string is being returned?