From 8386b9725b502bff00bdadf603441df8c83feda4 Mon Sep 17 00:00:00 2001 From: memsharded Date: Mon, 10 Apr 2023 23:40:38 +0200 Subject: [PATCH] Improve dependencies options changed in requirements() error msg --- conans/client/graph/compute_pid.py | 8 ++++++-- .../test/integration/conanfile/conanfile_errors_test.py | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/conans/client/graph/compute_pid.py b/conans/client/graph/compute_pid.py index 61a80f1d800..d878f53e079 100644 --- a/conans/client/graph/compute_pid.py +++ b/conans/client/graph/compute_pid.py @@ -1,7 +1,7 @@ from collections import OrderedDict from conans.errors import conanfile_exception_formatter, ConanInvalidConfiguration, \ - conanfile_remove_attr + conanfile_remove_attr, ConanException from conans.model.info import ConanInfo, RequirementsInfo, RequirementInfo, PythonRequiresInfo @@ -39,9 +39,13 @@ def compute_package_id(node, new_config): reqs_info = RequirementsInfo(data) build_requires_info = RequirementsInfo(build_data) python_requires = PythonRequiresInfo(python_requires, python_mode) + try: + copied_options = conanfile.options.copy_conaninfo_options() + except ConanException as e: + raise ConanException(f"{conanfile}: {e}") conanfile.info = ConanInfo(settings=conanfile.settings.copy_conaninfo_settings(), - options=conanfile.options.copy_conaninfo_options(), + options=copied_options, reqs_info=reqs_info, build_requires_info=build_requires_info, python_requires=python_requires, diff --git a/conans/test/integration/conanfile/conanfile_errors_test.py b/conans/test/integration/conanfile/conanfile_errors_test.py index 057bde53f27..a9c27c58a53 100644 --- a/conans/test/integration/conanfile/conanfile_errors_test.py +++ b/conans/test/integration/conanfile/conanfile_errors_test.py @@ -191,4 +191,4 @@ def requirements(self): """) c.save({"conanfile.py": conanfile}) c.run("create .", assert_error=True) - assert "Dependencies options were defined incorrectly." in c.out + assert "ERROR: hello/0.1: Dependencies options were defined incorrectly." in c.out