Skip to content

Commit

Permalink
adding migration warnings for internal model
Browse files Browse the repository at this point in the history
  • Loading branch information
memsharded committed Jan 15, 2025
1 parent 67ea889 commit db23cef
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 141 deletions.
141 changes: 0 additions & 141 deletions conan/cli/formatters/list/binary_html_table.py

This file was deleted.

Empty file added conans/model/__init__.py
Empty file.
28 changes: 28 additions & 0 deletions conans/model/package_ref.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from conan.api.output import ConanOutput
from conan.internal.model.package_ref import PkgReference as _PkgReference

_msg = """
*******************************************************************
private '{}'
detected in user code (custom commands, extensions, recipes, etc).
Stop using it, use only public documented APIs.
*******************************************************************
"""


class PkgReference(_PkgReference):
usage_counter = 0

def __init__(self, *args, **kwargs):
if PkgReference.usage_counter == 0:
ConanOutput().warning(_msg.format("from conans.model.package_ref import PkgReference"))
PkgReference.usage_counter += 1
super(PkgReference, self).__init__(*args, **kwargs)

@staticmethod
def loads(*args, **kwargs):
if PkgReference.usage_counter == 0:
ConanOutput().warning(_msg.format("from conans.model.package_ref import PkgReference"),
warn_tag="deprecated")
PkgReference.usage_counter += 1
return _PkgReference.loads(*args, **kwargs)
29 changes: 29 additions & 0 deletions conans/model/recipe_ref.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from conan.api.output import ConanOutput
from conan.internal.model.recipe_ref import RecipeReference as _RecipeReference

_msg = """
*******************************************************************
private '{}'
detected in user code (custom commands, extensions, recipes, etc).
Stop using it, use only public documented APIs.
*******************************************************************
"""


class RecipeReference(_RecipeReference):
usage_counter = 0

def __init__(self, *args, **kwargs):
if RecipeReference.usage_counter == 0:
ConanOutput().warning(_msg.format("from conans.model.recipe_ref import RecipeReference"),
warn_tag="deprecated")
RecipeReference.usage_counter += 1
super(RecipeReference, self).__init__(*args, **kwargs)

@staticmethod
def loads(*args, **kwargs):
if RecipeReference.usage_counter == 0:
ConanOutput().warning(_msg.format("from conans.model.recipe_ref import RecipeReference"),
warn_tag="deprecated")
RecipeReference.usage_counter += 1
return _RecipeReference.loads(*args, **kwargs)

0 comments on commit db23cef

Please sign in to comment.