Skip to content

Commit

Permalink
Improve error message for unified patterns in options (#13264)
Browse files Browse the repository at this point in the history
Include the option in the proposed solution to make it easier for the
user to understand the new unified pattern syntax.

Also, avoid advocating `pkg*:option` to prevent ambiguities with libraries with
the same prefix, e.g. `pkg-ng`. Only propose using the more explicit
 `pkg/*:option` notation.
  • Loading branch information
oxygene authored Feb 28, 2023
1 parent b47876b commit cf0536f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions conans/model/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ def __init__(self, options=None, options_values=None):
package, option = tokens
if "/" not in package and "*" not in package and "&" not in package:
msg = "The usage of package names `{}` in options is " \
"deprecated, use a pattern like `{}/*` or `{}*` " \
"instead".format(k, package, package)
"deprecated, use a pattern like `{}/*:{}` " \
"instead".format(k, package, option)
raise ConanException(msg)
self._deps_package_options.setdefault(package, _PackageOptions())[option] = v
else:
Expand Down
2 changes: 1 addition & 1 deletion conans/test/functional/toolchains/env/test_complete.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def package_info(self):
"main.cpp": mycmake_main}, clean_first=True)
client.run("create . --name=mycmake --version=1.0", assert_error=True)
assert "The usage of package names `myopenssl:shared` in options is deprecated, " \
"use a pattern like `myopenssl/*` or `myopenssl*` instead" in client.out
"use a pattern like `myopenssl/*:shared` instead" in client.out

# Fix the default options and repeat the create
fixed_cf = mycmake_conanfile.replace('default_options = {"myopenssl:shared": True}',
Expand Down

0 comments on commit cf0536f

Please sign in to comment.