From a748e1f8b7c07b5c04d82f48c3169e83d935db01 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Mon, 7 Jan 2019 15:48:21 -0700 Subject: [PATCH] Add "*" or "--all" option to update all --- conda.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/conda.py b/conda.py index 6ccddb5..0455c86 100755 --- a/conda.py +++ b/conda.py @@ -17,7 +17,8 @@ Requires conda to already be installed. options: name: - description: The name of a Python package to install. + description: The name of a Python package to install. Can be "*" or "--all" combined with state=latest to update + all packages. required: true version: description: The specific version of a package to install. @@ -91,6 +92,12 @@ def run_package_operation(conda, name, version, state, dry_run, command_runner, :param on_failure: method that takes any kwargs to be called on failure :param on_success: method that takes any kwargs to be called on success """ + # Special case to update all installed packages + if ( name == '*' or name == '--all' ) and state == 'latest': + output, stderr = run_conda_package_command( + command_runner, '--all', None, [conda, 'update', '--json', '--all']) + on_success(changed=True, output=output, stderr=stderr) + correct_version_installed = check_package_installed(command_runner, conda, name, version) # TODO: State should be an "enum" (or whatever the Py2.7 equivalent is)