Skip to content

Commit

Permalink
multi module install and updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
askpatrickw committed Jan 20, 2021
1 parent 84737a6 commit 06d8a95
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
14 changes: 11 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <query> Search the names in the modules in the bundle for a match.
Expand Down Expand Up @@ -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::

Expand All @@ -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
Expand Down
17 changes: 9 additions & 8 deletions circup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -848,24 +848,25 @@ 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
on the device in order to copy the appropriate .mpy versions too. ;-)
"""
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():
Expand Down

0 comments on commit 06d8a95

Please sign in to comment.