Skip to content

Commit 3d94749

Browse files
memshardedczoido
andauthored
removing legacy from-conans usages (#3864)
* removing legacy from-conans usages * empty commit --------- Co-authored-by: czoido <mrgalleta@gmail.com>
1 parent 00ed176 commit 3d94749

File tree

2 files changed

+6
-27
lines changed

2 files changed

+6
-27
lines changed

examples/extensions/commands/clean/custom_command_clean_revisions.rst

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ The ``conan clean`` command has the following code:
9696
from conan.api.conan_api import ConanAPI
9797
from conan.api.output import ConanOutput, Color
9898
from conan.cli.command import OnceArgument, conan_command
99-
from conans.client.userio import UserInput
10099
101100
102101
recipe_color = Color.BRIGHT_BLUE
@@ -111,23 +110,14 @@ The ``conan clean`` command has the following code:
111110
"""
112111
parser.add_argument('-r', '--remote', action=OnceArgument,
113112
help='Will remove from the specified remote')
114-
parser.add_argument('--force', default=False, action='store_true',
115-
help='Remove without requesting a confirmation')
116113
args = parser.parse_args(*args)
117114
118-
def confirmation(message):
119-
return args.force or ui.request_boolean(message)
120-
121-
ui = UserInput(non_interactive=False)
122115
out = ConanOutput()
123116
remote = conan_api.remotes.get(args.remote) if args.remote else None
124117
output_remote = remote or "Local cache"
125118
126119
# Getting all the recipes
127120
recipes = conan_api.search.recipes("*/*", remote=remote)
128-
if recipes and not confirmation("Do you want to remove all the recipes revisions and their packages ones, "
129-
"except the latest package revision from the latest recipe one?"):
130-
return
131121
for recipe in recipes:
132122
out.writeln(f"{str(recipe)}", fg=recipe_color)
133123
all_rrevs = conan_api.list.recipe_revisions(recipe, remote=remote)
@@ -158,23 +148,12 @@ The ``parser`` param is an instance of the Python command-line parsing ``argpars
158148
so if you want to know more about its API, visit `its official website <https://docs.python.org/3/library/argparse.html>`_.
159149

160150

161-
User input and user output
162-
++++++++++++++++++++++++++
163-
164-
Important classes to manage user input and user output:
165-
166-
.. code-block:: python
167-
168-
ui = UserInput(non_interactive=False)
169-
out = ConanOutput()
170-
151+
User output
152+
+++++++++++
171153

172-
* ``UserInput(non_interactive)``: class to manage user inputs. In this example we're using ``ui.request_boolean("Do you want to proceed?")``,
173-
so it'll be automatically translated to ``Do you want to proceed? (yes/no):`` in the command prompt.
174-
**Note**: you can use ``UserInput(non_interactive=conan_api.config.get("core:non_interactive"))`` too.
175-
* ``ConanOutput()``: class to manage user outputs. In this example, we're using only ``out.writeln(message, fg=None, bg=None)``
176-
where ``fg`` is the font foreground, and ``bg`` is the font background. Apart from that, you have some predefined methods
177-
like ``out.info()``, ``out.success()``, ``out.error()``, etc.
154+
``ConanOutput()``: class to manage user outputs. In this example, we're using only ``out.writeln(message, fg=None, bg=None)``
155+
where ``fg`` is the font foreground, and ``bg`` is the font background. Apart from that, you have some predefined methods
156+
like ``out.info()``, ``out.success()``, ``out.error()``, etc.
178157

179158

180159
Conan public API

reference/conan_server.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ If you want to create your own Authorizer, create a Python module in
224224

225225
.. code-block:: python
226226
227-
from conans.errors import AuthenticationException, ForbiddenException
227+
from conan.internal.errors import AuthenticationException, ForbiddenException
228228
229229
def get_class():
230230
return MyAuthorizer()

0 commit comments

Comments
 (0)