Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Computing dependency graph fails due to iterating over a boolean #15742

Closed
meimunchi opened this issue Feb 22, 2024 · 1 comment · Fixed by #15743
Closed

[bug] Computing dependency graph fails due to iterating over a boolean #15742

meimunchi opened this issue Feb 22, 2024 · 1 comment · Fixed by #15743
Assignees
Milestone

Comments

@meimunchi
Copy link

meimunchi commented Feb 22, 2024

Environment details

  • Operating System+version:
Linux x86_64, Ubuntu 20.04.6 LTS
  • Compiler+version:
compiler=gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
compiler.cppstd=gnu14
compiler.libcxx=libstdc++11
  • Conan version: 2.1.0
  • Python version: 3.8

Steps to reproduce

  1. Install conan version 2.1.0
  2. Use python api to call
conan_api.graph.load_graph_consumer(path, None, None,
       None, None,
       profile_host, profile_build, None, None,
       False)

Where path refers to directory that conanfile.py is in
3. Observe failure

  File "/usr/local/lib/python3.8/dist-packages/conans/client/graph/proxy.py", line 151, in should_update_reference
    return any(name == "*" or reference.name == name for name in update)

TypeError: 'bool' object is not iterable

This failure does not occur in Conan version 2.0.17
This issue seems to have originated from this commit: 0bad0d1#diff-cb762ed907b992f9c0a13f229acd541bd559e84bd2a9dc7ce3c2b28e6febca57

Logs

Traceback:

======== Computing dependency graph ========
No LSB modules are available.
Failed to generate dependency graph. Make sure the target package and its dependencies are built and available in local cache.
Traceback (most recent call last):
    deps_graph = conan_api.graph.load_graph_consumer(path, None, None,
  File "/usr/local/lib/python3.8/dist-packages/conan/api/subapi/graph.py", line 148, in load_graph_consumer
    deps_graph = self.load_graph(root_node, profile_host=profile_host,
  File "/usr/local/lib/python3.8/dist-packages/conan/api/subapi/graph.py", line 180, in load_graph
    deps_graph = builder.load_graph(root_node, profile_host, profile_build, lockfile)
  File "/usr/local/lib/python3.8/dist-packages/conans/client/graph/graph_builder.py", line 52, in load_graph
    new_node = self._expand_require(require, node, dep_graph, profile_host,
  File "/usr/local/lib/python3.8/dist-packages/conans/client/graph/graph_builder.py", line 92, in _expand_require
    new_node = self._create_new_node(node, require, graph, profile_host, profile_build,
  File "/usr/local/lib/python3.8/dist-packages/conans/client/graph/graph_builder.py", line 316, in _create_new_node
    resolved = self._resolve_recipe(require.ref, graph_lock)
  File "/usr/local/lib/python3.8/dist-packages/conans/client/graph/graph_builder.py", line 214, in _resolve_recipe
    result = self._proxy.get_recipe(ref, self._remotes, self._update, self._check_update)
  File "/usr/local/lib/python3.8/dist-packages/conans/client/graph/proxy.py", line 25, in get_recipe
    resolved = self._get_recipe(ref, remotes, update, check_update)
  File "/usr/local/lib/python3.8/dist-packages/conans/client/graph/proxy.py", line 52, in _get_recipe
    if not (check_update or should_update_reference(reference, update)):
  File "/usr/local/lib/python3.8/dist-packages/conans/client/graph/proxy.py", line 151, in should_update_reference
    return any(name == "*" or reference.name == name for name in update)

TypeError: 'bool' object is not iterable
@memsharded memsharded added this to the 2.1.1 milestone Feb 22, 2024
@memsharded memsharded modified the milestones: 2.1.1, 2.2.0 Feb 22, 2024
@AbrilRBS
Copy link
Member

Hi @meimunchi thanks a lot for the report

You are seeing the the effects of #15652 in which we moved to allow for list of libraries to update with --update=ref, or all by passing --update

As a consequence of this, the API changed to have update be a list of strings. Note that the graph api is still not stabilized (https://docs.conan.io/2/reference/extensions/python_api/GraphAPI.html mentions it's subject to breaking changes), so while we try to avoid issues like this, we might have to do this for other APIs.

As for your issue, changing the argument to ["*"] will work to update all references in the graph - We will be bringing back support for the legacy bool in the next 2.2 release too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants