Skip to content

Commit

Permalink
ony enable once each module
Browse files Browse the repository at this point in the history
  • Loading branch information
ericLemanissier authored Apr 5, 2024
1 parent 213aea2 commit 433c972
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
15 changes: 9 additions & 6 deletions recipes/qt/5.x.x/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.errors import ConanException, ConanInvalidConfiguration
from conan.tools.android import android_abi
from conan.tools.apple import is_apple_os
from conan.tools.build import build_jobs, check_min_cppstd, cross_building
Expand Down Expand Up @@ -241,7 +241,8 @@ def configure(self):
modulename = section[section.find('"') + 1: section.rfind('"')]
status = str(config.get(section, "status"))
if status not in ("obsolete", "ignore"):
assert status in self._module_statuses, f"module {modulename} has status {status} which is not in self._module_statuses {self._module_statuses}"
if status not in self._module_statuses:
raise ConanException(f"module {modulename} has status {status} which is not in self._module_statuses {self._module_statuses}")
submodules_tree[modulename] = {"status": status,
"path": str(config.get(section, "path")), "depends": []}
if config.has_option(section, "depends"):
Expand All @@ -261,12 +262,14 @@ def _enablemodule(mod):
_enablemodule(req)

for module in self._submodules:
for status in self._module_statuses:
if getattr(self.options, f"{status}_modules"):
if module in submodules_tree and submodules_tree[module]['status'] == status:
_enablemodule(module)
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

for module in self._submodules:
if module in self.options and not self.options.get_safe(module):
Expand Down
14 changes: 8 additions & 6 deletions recipes/qt/6.x.x/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from conan.tools.gnu import PkgConfigDeps
from conan.tools.microsoft import msvc_runtime_flag, is_msvc
from conan.tools.scm import Version
from conan.errors import ConanInvalidConfiguration
from conan.errors import ConanException, ConanInvalidConfiguration

required_conan_version = ">=1.55.0"

Expand Down Expand Up @@ -150,7 +150,8 @@ def _get_module_tree(self):
continue
status = str(config.get(section, "status"))
if status not in ["obsolete", "ignore", "additionalLibrary"]:
assert status in self._module_statuses, f"module {modulename} has status {status} which is not in self._module_statuses {self._module_statuses}"
if status not in self._module_statuses:
raise ConanException(f"module {modulename} has status {status} which is not in self._module_statuses {self._module_statuses}")
assert modulename in self._submodules, f"module {modulename} not in self._submodules"
self._submodules_tree[modulename] = {"status": status,
"path": str(config.get(section, "path")), "depends": []}
Expand Down Expand Up @@ -220,12 +221,13 @@ def _enablemodule(mod):
# enable all modules which are
# - required by a module explicitely enabled by the consumer
for module_name, module in self._get_module_tree.items():
for status in self._module_statuses:
if getattr(self.options, f"{status}_modules"):
if module['status'] == status:
_enablemodule(module_name)
if getattr(self.options, module_name):
_enablemodule(module_name)
else:
for status in self._module_statuses:
if getattr(self.options, f"{status}_modules") and module['status'] == status:
_enablemodule(module_name)
break

# disable all modules which are:
# - not explicitely enabled by the consumer and
Expand Down

0 comments on commit 433c972

Please sign in to comment.