8000 add warning-risk for deprecated packages by memsharded · Pull Request #17957 · conan-io/conan · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

add warning-risk for deprecated packages #17957

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

Merged
merged 1 commit into from
Mar 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions conan/cli/printers/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def print_graph_basic(graph):
deprecated = {}
for node in graph.nodes:
if hasattr(node.conanfile, "python_requires"):
for r in node.conanfile.python_requires._pyrequires.values(): # TODO: improve interface
for _, r in node.conanfile.python_requires.items():
python_requires[r.ref] = r.recipe, r.remote
if node.recipe in (RECIPE_CONSUMER, RECIPE_VIRTUAL):
continue
Expand All @@ -40,10 +40,10 @@ def _format_requires(title, reqs_to_print):
if not reqs_to_print:
return
output.info(title, Color.BRIGHT_YELLOW)
for ref, (recipe, remote) in sorted(reqs_to_print.items()):
for ref_, (recipe, remote) in sorted(reqs_to_print.items()):
if remote is not None:
recipe = "{} ({})".format(recipe, remote.name)
output.info(" {} - {}".format(ref.repr_notime(), recipe), Color.BRIGHT_CYAN)
output.info(" {} - {}".format(ref_.repr_notime(), recipe), Color.BRIGHT_CYAN)

_format_requires("Requirements", requires)
_format_requires("Test requirements", test_requires)
Expand All @@ -54,8 +54,8 @@ def _format_resolved(title, reqs_to_print):
if not reqs_to_print:
return
output.info(title, Color.BRIGHT_YELLOW)
for k, v in sorted(reqs_to_print.items()):
output.info(" {}: {}".format(k, v), Color.BRIGHT_CYAN)
for k_, v_ in sorted(reqs_to_print.items()):
output.info(" {}: {}".format(k_, v_), Color.BRIGHT_CYAN)

if graph.replaced_requires:
output.info("Replaced requires", Color.BRIGHT_YELLOW)
Expand All @@ -70,7 +70,8 @@ def _format_resolved(title, reqs_to_print):
_format_resolved("Resolved version ranges", graph.resolved_ranges)
for req in graph.resolved_ranges:
if str(req.version) == "[]":
output.warning("Empty version range usage is discouraged. Use [*] instead", warn_tag="deprecated")
output.warning("Empty version range usage is discouraged. Use [*] instead",
warn_tag="deprecated")
break

overrides = graph.overrides()
Expand All @@ -97,6 +98,9 @@ def _format_resolved(title, reqs_to_print):
Color.BRIGHT_CYAN)
output.warning("There are options conflicts in the dependency graph", warn_tag="risk")

if deprecated:
output.warning("There are deprecated packages in the graph", warn_tag="risk")


def print_graph_packages(graph):
# I am excluding the "download"-"cache" or remote information, that is not
Expand Down
2 changes: 1 addition & 1 deletion conans/client/graph/python_requires.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def serialize(self):
"path": self.path}


class PyRequires(object):
class PyRequires:
""" this is the object that replaces the declared conanfile.py_requires"""
def __init__(self):
self._pyrequires = {} # {pkg-name: PythonRequire}
Expand Down
1 change: 1 addition & 0 deletions test/integration/conanfile/test_deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def test_deprecated_simple(self):
t.run("create taskflow.py")

assert "Deprecated\n cpp-taskflow/1.0" in t.out
assert "WARN: risk: There are deprecated packages in the graph" in t.out

t.run("create taskflow.py --user=conan --channel=stable")
assert "Deprecated\n cpp-taskflow/1.0" in t.out
Expand Down
0