-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
qt refactor option handling and error reporting
- Loading branch information
Showing
2 changed files
with
100 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,9 +123,10 @@ class QtConan(ConanFile): | |
"sysroot": None, | ||
"config": None, | ||
"multiconfiguration": False, | ||
"essential_modules": not os.getenv('CONAN_CENTER_BUILD_SERVICE') | ||
} | ||
default_options.update({f"{status}_modules": False for status in _module_statuses if status != "essential"}) | ||
# essential_modules, addon_modules, deprecated_modules, preview_modules: | ||
# these are only provided for convenience, set to False by default | ||
default_options.update({f"{status}_modules": False for status in _module_statuses}) | ||
|
||
no_copy_source = True | ||
short_paths = True | ||
|
@@ -249,25 +250,43 @@ def configure(self): | |
for m in submodules_tree: | ||
assert m in ["qtbase", "qtqa", "qtrepotools"] or m in self._submodules, "module %s is not present in recipe options : (%s)" % (m, ",".join(self._submodules)) | ||
|
||
for m in self._submodules: | ||
if m not in submodules_tree: | ||
delattr(self.options, m) | ||
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") | ||
Check failure on line 255 in recipes/qt/5.x.x/conanfile.py GitHub Actions / Lint changed conanfile.py (v2 migration)
|
||
self.options.rm_safe(module) | ||
|
||
# Requested modules: | ||
# - any module for non-removed options that have 'True' value | ||
# - any enabled via `xxx_modules` that does not have a 'False' value | ||
# Note that at this point, the submodule options dont have a value unless one is given externally | ||
# to the recipe (e.g. via the command line, a profile, or a consumer) | ||
requested_modules = set([module for module in self._submodules if self.options.get_safe(module)]) | ||
for module in [m for m in self._submodules if m in submodules_tree]: | ||
status = submodules_tree[module]['status'] | ||
is_disabled = self.options.get_safe(module) == False | ||
if self.options.get_safe(f"{status}_modules"): | ||
if not is_disabled: | ||
requested_modules.add(module) | ||
else: | ||
self.output.debug(f"qt5: {module} requested because {status}_modules=True" | ||
Check failure on line 271 in recipes/qt/5.x.x/conanfile.py GitHub Actions / Lint changed conanfile.py (v2 migration)
|
||
f" but it has been explicitly disabled with {module}=False") | ||
|
||
def _enablemodule(mod): | ||
if mod != "qtbase": | ||
setattr(self.options, mod, True) | ||
for req in submodules_tree[mod]["depends"]: | ||
_enablemodule(req) | ||
self.output.debug(f"qt5: requested modules {requested_modules}") | ||
Check failure on line 274 in recipes/qt/5.x.x/conanfile.py GitHub Actions / Lint changed conanfile.py (v2 migration)
|
||
|
||
for module in self._submodules: | ||
if self.options.get_safe(module): | ||
_enablemodule(module) | ||
else: | ||
if module in submodules_tree: | ||
for status in self._module_statuses: | ||
if getattr(self.options, f"{status}_modules") and submodules_tree[module]['status'] == status: | ||
_enablemodule(module) | ||
break | ||
required_modules = set() | ||
for module in requested_modules: | ||
required_modules.update(submodules_tree[module]["depends"]) | ||
|
||
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}") | ||
Check failure on line 281 in recipes/qt/5.x.x/conanfile.py GitHub Actions / Lint changed conanfile.py (v2 migration)
|
||
if required_but_disabled: | ||
raise ConanInvalidConfiguration(f"Modules {', '.join(required_but_disabled)} are required by other options, but are explicitly disabled") | ||
|
||
enabled_modules = requested_modules.union(required_modules) | ||
enabled_modules.discard("qtbase") | ||
|
||
for module in list(enabled_modules): | ||
setattr(self.options, module, True) | ||
|
||
for module in self._submodules: | ||
if module in self.options and not self.options.get_safe(module): | ||
|
@@ -283,6 +302,16 @@ def _enablemodule(mod): | |
if self.options.qtwebengine: | ||
self.options.with_fontconfig = True | ||
|
||
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}," | ||
Check failure on line 308 in recipes/qt/5.x.x/conanfile.py GitHub Actions / Lint changed conanfile.py (v2 migration)
|
||
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]}") | ||
Check failure on line 313 in recipes/qt/5.x.x/conanfile.py GitHub Actions / Lint changed conanfile.py (v2 migration)
|
||
|
||
def validate(self): | ||
if self.settings.compiler.get_safe("cppstd"): | ||
check_min_cppstd(self, "11") | ||
|
@@ -438,8 +467,6 @@ def package_id(self): | |
self.info.settings.compiler.runtime_type = "Release/Debug" | ||
if self.info.settings.os == "Android": | ||
del self.info.options.android_sdk | ||
for status in self._module_statuses: | ||
delattr(self.info.options, f"{status}_modules") | ||
|
||
def build_requirements(self): | ||
if self._settings_build.os == "Windows" and is_msvc(self): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters