Skip to content
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

qt5: fix check for python2 version #24768

Merged
merged 2 commits into from
Jul 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions recipes/qt/5.x.x/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from conan.tools.scm import Version
import configparser
import glob
from io import StringIO
import itertools
import os
import textwrap
Expand Down Expand Up @@ -154,20 +155,17 @@
raise ConanInvalidConfiguration(msg)

# 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"
self.run(cmd_v, mybuf)
verstr = mybuf.getvalue().strip().split("Python ")[1]
if verstr.endswith("+"):
verstr = verstr[:-1]
command_output = StringIO()
cmd_v = f"\"{python_exe}\" -c \"import platform;print(platform.python_version())\""
self.run(cmd_v, command_output)
verstr = command_output.getvalue().strip()
version = Version(verstr)
# >= 2.7.5 & < 3
v_min = "2.7.5"
v_max = "3.0.0"
if (version >= v_min) and (version < v_max):
msg = ("Found valid Python 2 required for QtWebengine:"
f" version={mybuf.getvalue()}, path={python_exe}")
f" version={verstr}, path={python_exe}")
self.output.success(msg)
else:
msg = (f"Found Python 2 in path, but with invalid version {verstr}"
Expand Down Expand Up @@ -933,7 +931,7 @@
filecontents += 'set(CMAKE_AUTOMOC_MACRO_NAMES "Q_OBJECT" "Q_GADGET" "Q_GADGET_EXPORT" "Q_NAMESPACE" "Q_NAMESPACE_EXPORT")\n'
save(self, os.path.join(self.package_folder, self._cmake_core_extras_file), filecontents)

def _create_private_module(module, dependencies=[]):

Check warning on line 934 in recipes/qt/5.x.x/conanfile.py

View workflow job for this annotation

GitHub Actions / Lint changed conanfile.py (v2 migration)

Dangerous default value [] as argument
if "Core" not in dependencies:
dependencies.append("Core")
dependencies_string = ';'.join(f'Qt5::{dependency}' for dependency in dependencies)
Expand Down Expand Up @@ -1004,7 +1002,7 @@
reqs.append(corrected_req)
return reqs

def _create_module(module, requires=[], has_include_dir=True):

Check warning on line 1005 in recipes/qt/5.x.x/conanfile.py

View workflow job for this annotation

GitHub Actions / Lint changed conanfile.py (v2 migration)

Dangerous default value [] as argument
componentname = f"qt{module}"
assert componentname not in self.cpp_info.components, f"Module {module} already present in self.cpp_info.components"
self.cpp_info.components[componentname].set_property("cmake_target_name", f"Qt5::{module}")
Expand Down
Loading