Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jcar87 committed Aug 9, 2024
1 parent 86bbbd0 commit 956fb1b
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 23 deletions.
35 changes: 23 additions & 12 deletions recipes/qt/5.x.x/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from conan import ConanFile
from conan import ConanFile, conan_version
from conan.errors import ConanException, ConanInvalidConfiguration
from conan.tools.android import android_abi
from conan.tools.apple import is_apple_os
Expand Down Expand Up @@ -208,6 +208,10 @@ def config_options(self):
if self.settings.os != "Android":
del self.options.android_sdk

def _debug_output(self, message):
if Version(conan_version) >= "2":
self.output.debug(message)

Check failure on line 213 in recipes/qt/5.x.x/conanfile.py

View workflow job for this annotation

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

Instance of 'ScopedOutput' has no 'debug' member. Please, check https://github.com/conan-io/conan-center-index/blob/master/docs/v2_linter.md

def configure(self):
# if self.settings.os != "Linux":
# self.options.with_libiconv = False # QTBUG-84708
Expand Down Expand Up @@ -252,7 +256,7 @@ def configure(self):

for module in self._submodules:
if module not in submodules_tree:
self.output.debug(f"qt5: removing {module} from options as it is not an option for this version, or it is ignored or obsolete")
self._debug_output(f"qt5: removing {module} from options as it is not an option for this version, or it is ignored or obsolete")
self.options.rm_safe(module)

# Requested modules:
Expand All @@ -268,21 +272,28 @@ def configure(self):
if not is_disabled:
requested_modules.add(module)
else:
self.output.debug(f"qt5: {module} requested because {status}_modules=True"
self.output.warning(f"qt5: {module} requested because {status}_modules=True"
f" but it has been explicitly disabled with {module}=False")

self.output.debug(f"qt5: requested modules {requested_modules}")
self.output.info(f"qt5: requested modules {list(requested_modules)}")

required_modules = set()
required_modules = {}
for module in requested_modules:
required_modules.update(submodules_tree[module]["depends"])
deps = submodules_tree[module]["depends"]
for dep in deps:
required_modules.setdefault(dep,[]).append(module)

required_but_disabled = [m for m in required_modules if self.options.get_safe(m) == False]
self.output.debug(f"qt5: required_modules modules {required_modules}")
required_but_disabled = [m for m in required_modules.keys() if self.options.get_safe(m) == False]
if required_modules:
self._debug_output(f"qt5: required_modules modules {list(required_modules.keys())}")
if required_but_disabled:
raise ConanInvalidConfiguration(f"Modules {', '.join(required_but_disabled)} are required by other options, but are explicitly disabled")
required_by = set()
for m in required_but_disabled:
required_by.update(required_modules[m])
raise ConanInvalidConfiguration(f"Modules {required_but_disabled} are explicitly disabled, "
f"but are required by {list(required_by)}, enabled by other options")

enabled_modules = requested_modules.union(required_modules)
enabled_modules = requested_modules.union(set(required_modules.keys()))
enabled_modules.discard("qtbase")

for module in list(enabled_modules):
Expand All @@ -305,12 +316,12 @@ def configure(self):
for status in self._module_statuses:
# These are convenience only, should not affect package_id
option_name = f"{status}_modules"
self.output.debug(f"qt5 removing convenience option: {option_name},"
self._debug_output(f"qt5 removing convenience option: {option_name},"
f" see individual module options")
self.options.rm_safe(option_name)

for option in self.options.items():
self.output.debug(f"qt5 option {option[0]}={option[1]}")
self._debug_output(f"qt5 option {option[0]}={option[1]}")

def validate(self):
if self.settings.compiler.get_safe("cppstd"):
Expand Down
33 changes: 22 additions & 11 deletions recipes/qt/6.x.x/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import platform
import textwrap

from conan import ConanFile
from conan import ConanFile, conan_version
from conan.tools.apple import is_apple_os
from conan.tools.build import cross_building, check_min_cppstd, default_cppstd
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
Expand Down Expand Up @@ -199,6 +199,10 @@ def _minimum_compilers_version(self):
"apple-clang": "12" if Version(self.version) >= "6.5.0" else "11"
}

def _debug_output(self, message):
if Version(conan_version) >= "2":
self.output.debug(message)

def configure(self):
if not self.options.gui:
del self.options.opengl
Expand Down Expand Up @@ -228,21 +232,28 @@ def configure(self):
if not is_disabled:
requested_modules.add(module)
else:
self.output.debug(f"qt6: {module} requested because {status}_modules=True"
self.output.warning(f"qt6: {module} requested because {status}_modules=True"
f" but it has been explicitly disabled with {module}=False")

self.output.debug(f"qt6: requested modules {requested_modules}")
self.output.info(f"qt6: requested modules {list(requested_modules)}")

required_modules = set()
required_modules = {}
for module in requested_modules:
required_modules.update(self._get_module_tree[module]["depends"])
deps = self._get_module_tree[module]["depends"]
for dep in deps:
required_modules.setdefault(dep,[]).append(module)

required_but_disabled = [m for m in required_modules if self.options.get_safe(m) == False]
self.output.debug(f"qt6: required_modules modules {required_modules}")
required_but_disabled = [m for m in required_modules.keys() if self.options.get_safe(m) == False]
if required_modules:
self._debug_output(f"qt6: required_modules modules {list(required_modules.keys())}")
if required_but_disabled:
raise ConanInvalidConfiguration(f"Modules {', '.join(required_but_disabled)} are required by other options, but are explicitly disabled")
required_by = set()
for m in required_but_disabled:
required_by.update(required_modules[m])
raise ConanInvalidConfiguration(f"Modules {required_but_disabled} are explicitly disabled, "
f"but are required by {list(required_by)}, enabled by other options")

enabled_modules = requested_modules.union(required_modules)
enabled_modules = requested_modules.union(set(required_modules.keys()))
enabled_modules.discard("qtbase")

for module in list(enabled_modules):
Expand All @@ -265,12 +276,12 @@ def configure(self):
for status in self._module_statuses:
# These are convenience only, should not affect package_id
option_name = f"{status}_modules"
self.output.debug(f"qt5 removing convenience option: {option_name},"
self._debug_output(f"qt6 removing convenience option: {option_name},"
f" see individual module options")
self.options.rm_safe(option_name)

for option in self.options.items():
self.output.debug(f"qt6 option: {option}")
self._debug_output(f"qt6 option: {option}")

def validate(self):
if os.getenv('CONAN_CENTER_BUILD_SERVICE') is not None:
Expand Down

0 comments on commit 956fb1b

Please sign in to comment.