-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'python2 --version' sends output to stderr, redirect to stdout to cat… #20979
Conversation
🤖 Beep Boop! This pull request is making changes to 'recipes/qt//'. 👋 @ericLemanissier @jwillikers @MartinDelille you might be interested. 😉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I don't think this will work on Windows though, but I've proposed a workaround
recipes/qt/5.x.x/conanfile.py
Outdated
@@ -151,7 +151,7 @@ def validate_build(self): | |||
# In any case, check its actual version for compatibility | |||
from six import StringIO # Python 2 and 3 compatible | |||
mybuf = StringIO() | |||
cmd_v = f"\"{python_exe}\" --version" | |||
cmd_v = f"\"{python_exe}\" --version 2>&1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work on Windows - You might need to use subprocess
to execute the command directly and get stderr from there
I'll look into allowing Conan's run method to also output stderr just like what is done with stdout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Ruben,
Thanks for reviewing.
Before submitting I tested the "python --version 2>&1
" command in a Windows command prompt and it worked.
A colleague of mine is currently building qt 5.15.11 on Windows and with the above patched he has no errors yet. Before the patch the build would quit almost immediately because of the broken Python2 version check.
So I am quite confident this solution will work also on Windows.
Of course it would still be nice if stderr could be re-directed as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wdobbe Please, let's avoid workarounds and follow Ruben's approach, the subprocess
is specially designed for this case, it's cross-platform compatibly, has fine-grained control over pipes, is more secure (avoids injections), and much better for error handling in case of an exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed as requested and tested with Conan 2.13.0 on Linux x86_64 with:
conan create . --version=5.15.11 -o qt/*:qtwebengine=True -o sqlite3/*:shared=True -o qt/*:shared=True -o qt/*:gui=True -o qt/*:qtdeclarative=True -o qt/*:qtlocation=True -o qt/*:qtwebchannel=True --build=missing
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Hooks produced the following warnings for commit 9948787qt/5.15.11@#330f62d5265b7b1327724f31250726a7
qt/5.15.10@#f6a2e57bc3494e5438de6315c34abc14
qt/5.15.8@#ca1a0c5f61503f96e13930ba51388c56
qt/5.15.7@#fb7ffdac7d421923eb5190af0e79dbca
qt/5.15.9@#be766e2e7f08aa0e6263160232c555e0
|
This comment has been minimized.
This comment has been minimized.
The missing |
@valgur Yes, thanks. I already did a rebase and push to re-trigger a build for PR #21026 (also qt/5.x) but it now results in the following error:
Comment from Eric Lemanissier:
|
Looking at #21943 it appears it ran into the same problem and it has been fixed now. @wdobbe, could you try merging master again and see if it fixes this pull request too? |
Conan v1 pipeline ✔️All green in build 12 (
Conan v2 pipeline ❌
The v2 pipeline failed. Please, review the errors and note this is required for pull requests to be merged. In case this recipe is still not ported to Conan 2.x, please, ping See details:Failure in build 13 (
Note: To save resources, CI tries to finish as soon as an error is found. For this reason you might find that not all the references have been launched or not all the configurations for a given reference. Also, take into account that we cannot guarantee the order of execution as it depends on CI workload and workers availability. |
Hooks produced the following warnings for commit 7604e81qt/5.15.12@#d1d4e7388f85f0a53a29e0a8f3d9803f
qt/5.15.11@#b1c474f0b9f5848a8689973171756c3d
qt/5.15.9@#8114200f11a945bd061ea454e82dcc80
qt/5.15.10@#d9251f76d0eec614394f34ac99beaf53
qt/5.15.8@#08176cc0937bb0bf6e7b716ce7d680eb
qt/5.15.7@#0c5f73dd2635b31dc7a00463dd16e23b
|
if completed.returncode != 0: | ||
msg = ("Found python2 executable %s but could not run it" % python_exe) | ||
raise ConanInvalidConfiguration(msg) | ||
verstr = completed.stderr.decode('utf-8').split("Python ")[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
verstr = completed.stderr.decode('utf-8').split("Python ")[1] | |
verstr = completed.stderr.decode('utf-8').split("Python ")[1].strip() |
Just to be safe.
There is another important point about this issue, it targets Python 2, which is EOL, and Conan 2.x. The Conan 2.x explicitly requires Python 3.6: https://github.com/conan-io/tribe/blob/main/design/003-codebase-python.md |
sure, but in qt5 qtwebengine requires python 2, because the chromium version used under the hood requires python 2. |
Conan still uses Python 3.x. The python 2 detection is used only for the build of QtWebEngine. As Eric mentioned QtWebEngine 5 requires python 2.On 4 Mar 2024, at 09:13, Uilian Ries ***@***.***> wrote:
There is another important point about this issue, it targets Python 2, which is EOL, and Conan 2.x. The Conan 2.x explicitly requires Python 3.6: https://github.com/conan-io/tribe/blob/main/design/003-codebase-python.md
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Hi @wdobbe - thank you for your contribution and please accept my apologies for the delay in ensuring this PR went through CI validation. As part of reviewing a different PR, I've proposed a simpler approach that allows us to still call I'll make sure this is reviewed and merged this week. |
Closing via #24768. Apologies it took this long to fix this. |
Specify library name and version: qt/5.15.11
The qt5 qtwebengine module still needs python2 to build it. The qt5 conanfile.py checks if a valid python2 version is installed by running 'python2 --version'.
However the python2 executable sends the version output to stderr (python3 sends it to stdout). As a result the stdout output of the self.run(...) command is empty and results in an error:
Because self.run(...) doesn't seem to have an argument to catch the stderr output I changed the 'python2 --version' command to send stderr output to stdout.
Tested on Linux with conan 2.0.13.