From 06d8a956c6f17007d3030c2b1d167d9f28d37336 Mon Sep 17 00:00:00 2001 From: askpatricw <4002194+askpatrickw@users.noreply.github.com> Date: Wed, 20 Jan 2021 00:40:13 -0800 Subject: [PATCH] multi module install and updated readme --- README.rst | 14 +++++++++++--- circup.py | 17 +++++++++-------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/README.rst b/README.rst index 784d1b1..a134b63 100644 --- a/README.rst +++ b/README.rst @@ -75,7 +75,7 @@ To get help, just type the command:: Commands: freeze Output details of all the modules found on the connected... - install Install a named module onto the device. + install Install a named module(s) onto the device. list Lists all out of date modules found on the connected... show Show the long list of all available modules in the bundle. show Search the names in the modules in the bundle for a match. @@ -126,11 +126,15 @@ To interactively update the out-of-date modules:: Update 'adafruit_ble'? [y/N]: Y OK -Install a module onto the connected device with:: +Install a module or modules onto the connected device with:: $ circup install adafruit_thermal_printer Installed 'adafruit_thermal_printer'. + $ circup install adafruit_thermal_printer adafruit_bus_io + Installed 'adafruit_thermal_printer'. + Installed 'adafruit_bus_io'. + You can also install a list of modules from a requirements.txt file in the current working directory with:: @@ -141,11 +145,15 @@ the current working directory with:: Installed 'adafruit_sht31d'. Installed 'neopixel'. -Uninstall a module like this:: +Uninstall a module or modules like this:: $ circup uninstall adafruit_thermal_printer Uninstalled 'adafruit_thermal_printer'. + $ circup uninstall adafruit_thermal_printer adafruit_bus_io + Uninstalled 'adafruit_thermal_printer'. + Uninstalled 'adafruit_bus_io'. + Use the ``--verbose`` flag to see the logs as the command is working:: $ circup --verbose freeze diff --git a/circup.py b/circup.py index 697fe8e..07489d0 100644 --- a/circup.py +++ b/circup.py @@ -789,7 +789,7 @@ def install_module(device_path, name, py, mod_names): # pragma: no cover TODO: There is currently no check for the version. """ if not name: - click.echo("No module name provided.") + click.echo("No module name(s) provided.") elif name in mod_names: library_path = os.path.join(device_path, "lib") if not os.path.exists(library_path): # pragma: no cover @@ -848,15 +848,17 @@ def install_module(device_path, name, py, mod_names): # pragma: no cover @main.command() -@click.argument("names", required=False, nargs=-1) +@click.argument("modules", required=False, nargs=-1) @click.option("--py", is_flag=True) @click.option("-r", "--requirement") @click.pass_context -def install(ctx, names, py, requirement): # pragma: no cover +def install(ctx, modules, py, requirement): # pragma: no cover """ - Install a named module onto the device. This is a very naive / simple - hacky proof of concept. Option -r allows specifying a text file to - install all modules listed in the text file. + Install a named module(s) onto the device. Multiple modules + can be installed at once by providing more than one module name, each + separated by a space. + Option -r allows specifying a text file to install all modules listed in + the text file. TODO: Work out how to specify / handle dependencies (if at all), ensure there's enough space on the device, work out the version of CircuitPython @@ -864,8 +866,7 @@ def install(ctx, names, py, requirement): # pragma: no cover """ available_modules = get_bundle_versions() # Normalize user input. - for name in names: - print(name) + for name in modules: name = name.lower() if name else "" mod_names = {} for module, metadata in available_modules.items():