circup 2.1.0__tar.gz → 2.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. {circup-2.1.0/circup.egg-info → circup-2.1.1}/PKG-INFO +2 -2
  2. {circup-2.1.0 → circup-2.1.1}/circup/backends.py +4 -1
  3. {circup-2.1.0 → circup-2.1.1}/circup/command_utils.py +15 -1
  4. {circup-2.1.0 → circup-2.1.1}/circup/commands.py +29 -7
  5. {circup-2.1.0 → circup-2.1.1/circup.egg-info}/PKG-INFO +2 -2
  6. {circup-2.1.0 → circup-2.1.1}/.github/ISSUE_TEMPLATE.md +0 -0
  7. {circup-2.1.0 → circup-2.1.1}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  8. {circup-2.1.0 → circup-2.1.1}/.github/workflows/build.yml +0 -0
  9. {circup-2.1.0 → circup-2.1.1}/.github/workflows/release.yml +0 -0
  10. {circup-2.1.0 → circup-2.1.1}/.gitignore +0 -0
  11. {circup-2.1.0 → circup-2.1.1}/.isort.cfg +0 -0
  12. {circup-2.1.0 → circup-2.1.1}/.pre-commit-config.yaml +0 -0
  13. {circup-2.1.0 → circup-2.1.1}/.pylintrc +0 -0
  14. {circup-2.1.0 → circup-2.1.1}/CODE_OF_CONDUCT.rst +0 -0
  15. {circup-2.1.0 → circup-2.1.1}/CODE_OF_CONDUCT.rst.license +0 -0
  16. {circup-2.1.0 → circup-2.1.1}/CONTRIBUTING.rst +0 -0
  17. {circup-2.1.0 → circup-2.1.1}/CONTRIBUTING.rst.license +0 -0
  18. {circup-2.1.0 → circup-2.1.1}/LICENSE +0 -0
  19. {circup-2.1.0 → circup-2.1.1}/LICENSES/CC-BY-4.0.txt +0 -0
  20. {circup-2.1.0 → circup-2.1.1}/LICENSES/MIT.txt +0 -0
  21. {circup-2.1.0 → circup-2.1.1}/LICENSES/Unlicense.txt +0 -0
  22. {circup-2.1.0 → circup-2.1.1}/README.rst +0 -0
  23. {circup-2.1.0 → circup-2.1.1}/README.rst.license +0 -0
  24. {circup-2.1.0 → circup-2.1.1}/circup/__init__.py +0 -0
  25. {circup-2.1.0 → circup-2.1.1}/circup/bundle.py +0 -0
  26. {circup-2.1.0 → circup-2.1.1}/circup/config/bundle_config.json +0 -0
  27. {circup-2.1.0 → circup-2.1.1}/circup/config/bundle_config.json.license +0 -0
  28. {circup-2.1.0 → circup-2.1.1}/circup/logging.py +0 -0
  29. {circup-2.1.0 → circup-2.1.1}/circup/module.py +0 -0
  30. {circup-2.1.0 → circup-2.1.1}/circup/shared.py +0 -0
  31. {circup-2.1.0 → circup-2.1.1}/circup/wwshell/README.rst +0 -0
  32. {circup-2.1.0 → circup-2.1.1}/circup/wwshell/README.rst.license +0 -0
  33. {circup-2.1.0 → circup-2.1.1}/circup/wwshell/__init__.py +0 -0
  34. {circup-2.1.0 → circup-2.1.1}/circup/wwshell/commands.py +0 -0
  35. {circup-2.1.0 → circup-2.1.1}/circup.egg-info/SOURCES.txt +0 -0
  36. {circup-2.1.0 → circup-2.1.1}/circup.egg-info/dependency_links.txt +0 -0
  37. {circup-2.1.0 → circup-2.1.1}/circup.egg-info/entry_points.txt +0 -0
  38. {circup-2.1.0 → circup-2.1.1}/circup.egg-info/requires.txt +0 -0
  39. {circup-2.1.0 → circup-2.1.1}/circup.egg-info/top_level.txt +0 -0
  40. {circup-2.1.0 → circup-2.1.1}/docs/_static/favicon.ico +0 -0
  41. {circup-2.1.0 → circup-2.1.1}/docs/_static/favicon.ico.license +0 -0
  42. {circup-2.1.0 → circup-2.1.1}/docs/conf.py +0 -0
  43. {circup-2.1.0 → circup-2.1.1}/docs/index.rst +0 -0
  44. {circup-2.1.0 → circup-2.1.1}/docs/index.rst.license +0 -0
  45. {circup-2.1.0 → circup-2.1.1}/docs/logo.png +0 -0
  46. {circup-2.1.0 → circup-2.1.1}/docs/logo.png.license +0 -0
  47. {circup-2.1.0 → circup-2.1.1}/optional_requirements.txt +0 -0
  48. {circup-2.1.0 → circup-2.1.1}/optional_requirements.txt.license +0 -0
  49. {circup-2.1.0 → circup-2.1.1}/pyproject.toml +0 -0
  50. {circup-2.1.0 → circup-2.1.1}/readthedocs.yml +0 -0
  51. {circup-2.1.0 → circup-2.1.1}/requirements.txt +0 -0
  52. {circup-2.1.0 → circup-2.1.1}/requirements.txt.license +0 -0
  53. {circup-2.1.0 → circup-2.1.1}/setup.cfg +0 -0
  54. {circup-2.1.0 → circup-2.1.1}/tests/__init__.py +0 -0
  55. {circup-2.1.0 → circup-2.1.1}/tests/bad_module/__init__.py +0 -0
  56. {circup-2.1.0 → circup-2.1.1}/tests/bad_module/my_module.py +0 -0
  57. {circup-2.1.0 → circup-2.1.1}/tests/bad_python.py +0 -0
  58. {circup-2.1.0 → circup-2.1.1}/tests/bundle.json +0 -0
  59. {circup-2.1.0 → circup-2.1.1}/tests/bundle.json.license +0 -0
  60. {circup-2.1.0 → circup-2.1.1}/tests/device.json +0 -0
  61. {circup-2.1.0 → circup-2.1.1}/tests/device.json.license +0 -0
  62. {circup-2.1.0 → circup-2.1.1}/tests/dir_module/__init__.py +0 -0
  63. {circup-2.1.0 → circup-2.1.1}/tests/dir_module/my_module.py +0 -0
  64. {circup-2.1.0 → circup-2.1.1}/tests/import_styles.py +0 -0
  65. {circup-2.1.0 → circup-2.1.1}/tests/local_module.py +0 -0
  66. {circup-2.1.0 → circup-2.1.1}/tests/local_module_cp7.mpy +0 -0
  67. {circup-2.1.0 → circup-2.1.1}/tests/local_module_cp7.mpy.license +0 -0
  68. {circup-2.1.0 → circup-2.1.1}/tests/mock_device/boot_out.txt +0 -0
  69. {circup-2.1.0 → circup-2.1.1}/tests/mock_device/boot_out.txt.license +0 -0
  70. {circup-2.1.0 → circup-2.1.1}/tests/mock_device/lib/adafruit_waveform/.gitkeep +0 -0
  71. {circup-2.1.0 → circup-2.1.1}/tests/mount_exists.txt +0 -0
  72. {circup-2.1.0 → circup-2.1.1}/tests/mount_exists.txt.license +0 -0
  73. {circup-2.1.0 → circup-2.1.1}/tests/mount_missing.txt +0 -0
  74. {circup-2.1.0 → circup-2.1.1}/tests/mount_missing.txt.license +0 -0
  75. {circup-2.1.0 → circup-2.1.1}/tests/remote_module.py +0 -0
  76. {circup-2.1.0 → circup-2.1.1}/tests/test_bundle_config.json +0 -0
  77. {circup-2.1.0 → circup-2.1.1}/tests/test_bundle_config.json.license +0 -0
  78. {circup-2.1.0 → circup-2.1.1}/tests/test_bundle_config_local.json +0 -0
  79. {circup-2.1.0 → circup-2.1.1}/tests/test_bundle_config_local.json.license +0 -0
  80. {circup-2.1.0 → circup-2.1.1}/tests/test_circup.py +0 -0
  81. {circup-2.1.0 → circup-2.1.1}/tests/test_module.mpy +0 -0
  82. {circup-2.1.0 → circup-2.1.1}/tests/test_module.mpy.license +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: circup
3
- Version: 2.1.0
3
+ Version: 2.1.1
4
4
  Summary: A tool to manage/update libraries on CircuitPython devices.
5
5
  Author-email: Adafruit Industries <circuitpython@adafruit.com>
6
6
  License: MIT License
@@ -950,7 +950,10 @@ class DiskBackend(Backend):
950
950
  # Copy the directory.
951
951
  shutil.copytree(source_path, target_path)
952
952
  else:
953
- target = os.path.basename(source_path)
953
+ if "target_name" in metadata:
954
+ target = metadata["target_name"]
955
+ else:
956
+ target = os.path.basename(source_path)
954
957
  target_path = os.path.join(location, target)
955
958
  # Copy file.
956
959
  shutil.copyfile(source_path, target_path)
@@ -100,6 +100,7 @@ def completion_for_example(ctx, param, incomplete):
100
100
  Returns the list of available modules for the command line tab-completion
101
101
  with the ``circup example`` command.
102
102
  """
103
+
103
104
  # pylint: disable=unused-argument, consider-iterating-dictionary
104
105
  available_examples = get_bundle_examples(get_bundles_list(), avoid_download=True)
105
106
 
@@ -319,14 +320,22 @@ def get_bundle_examples(bundles_list, avoid_download=False):
319
320
  :return: A dictionary of metadata about the examples available in the
320
321
  library bundle.
321
322
  """
322
- # pylint: disable=too-many-nested-blocks
323
+ # pylint: disable=too-many-nested-blocks,too-many-locals
323
324
  all_the_examples = dict()
325
+ bundle_examples = dict()
324
326
 
325
327
  try:
326
328
  for bundle in bundles_list:
327
329
  if not avoid_download or not os.path.isdir(bundle.lib_dir("py")):
328
330
  ensure_latest_bundle(bundle)
329
331
  path = bundle.examples_dir("py")
332
+ meta_saved = os.path.join(path, "../bundle_examples.json")
333
+ if os.path.exists(meta_saved):
334
+ with open(meta_saved, "r", encoding="utf-8") as f:
335
+ bundle_examples = json.load(f)
336
+ all_the_examples.update(bundle_examples)
337
+ bundle_examples.clear()
338
+ continue
330
339
  path_examples = _get_modules_file(path, logger)
331
340
  for lib_name, lib_metadata in path_examples.items():
332
341
  for _dir_level in os.walk(lib_metadata["path"]):
@@ -337,8 +346,13 @@ def get_bundle_examples(bundles_list, avoid_download=False):
337
346
  if _dirs[-1] == "":
338
347
  _dirs.pop(-1)
339
348
  slug = f"{os.path.sep}".join(_dirs + [_file.replace(".py", "")])
349
+ bundle_examples[slug] = os.path.join(_dir_level[0], _file)
340
350
  all_the_examples[slug] = os.path.join(_dir_level[0], _file)
341
351
 
352
+ with open(meta_saved, "w", encoding="utf-8") as f:
353
+ json.dump(bundle_examples, f)
354
+ bundle_examples.clear()
355
+
342
356
  except NotADirectoryError:
343
357
  # Bundle does not have new style examples directory
344
358
  # so we cannot include its examples.
@@ -178,8 +178,8 @@ def main( # pylint: disable=too-many-locals
178
178
  else (cpy_version, board_id)
179
179
  )
180
180
  click.echo(
181
- "Found device at {}, running CircuitPython {}.".format(
182
- device_path, cpy_version
181
+ "Found device {} at {}, running CircuitPython {}.".format(
182
+ board_id, device_path, cpy_version
183
183
  )
184
184
  )
185
185
  try:
@@ -406,31 +406,53 @@ def install(
406
406
 
407
407
  @main.command()
408
408
  @click.option("--overwrite", is_flag=True, help="Overwrite the file if it exists.")
409
+ @click.option("--list", "-ls", "op_list", is_flag=True, help="List available examples.")
410
+ @click.option("--rename", is_flag=True, help="Install the example as code.py.")
409
411
  @click.argument(
410
- "examples", required=True, nargs=-1, shell_complete=completion_for_example
412
+ "examples", required=False, nargs=-1, shell_complete=completion_for_example
411
413
  )
412
414
  @click.pass_context
413
- def example(ctx, examples, overwrite):
415
+ def example(ctx, examples, op_list, rename, overwrite):
414
416
  """
415
417
  Copy named example(s) from a bundle onto the device. Multiple examples
416
418
  can be installed at once by providing more than one example name, each
417
419
  separated by a space.
418
420
  """
419
421
 
422
+ if op_list:
423
+ if examples:
424
+ click.echo("\n".join(completion_for_example(ctx, "", examples)))
425
+ else:
426
+ click.echo("Available example libraries:")
427
+ available_examples = get_bundle_examples(
428
+ get_bundles_list(), avoid_download=True
429
+ )
430
+ lib_names = {
431
+ str(key.split(os.path.sep)[0]): value
432
+ for key, value in available_examples.items()
433
+ }
434
+ click.echo("\n".join(sorted(lib_names.keys())))
435
+ return
436
+
420
437
  for example_arg in examples:
421
438
  available_examples = get_bundle_examples(
422
439
  get_bundles_list(), avoid_download=True
423
440
  )
424
441
  if example_arg in available_examples:
425
442
  filename = available_examples[example_arg].split(os.path.sep)[-1]
443
+ install_metadata = {"path": available_examples[example_arg]}
444
+
445
+ filename = available_examples[example_arg].split(os.path.sep)[-1]
446
+ if rename:
447
+ if os.path.isfile(available_examples[example_arg]):
448
+ filename = "code.py"
449
+ install_metadata["target_name"] = filename
426
450
 
427
451
  if overwrite or not ctx.obj["backend"].file_exists(filename):
428
452
  click.echo(
429
453
  f"{'Copying' if not overwrite else 'Overwriting'}: {filename}"
430
454
  )
431
- ctx.obj["backend"].install_module_py(
432
- {"path": available_examples[example_arg]}, location=""
433
- )
455
+ ctx.obj["backend"].install_module_py(install_metadata, location="")
434
456
  else:
435
457
  click.secho(
436
458
  f"File: {filename} already exists. Use --overwrite if you wish to replace it.",
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: circup
3
- Version: 2.1.0
3
+ Version: 2.1.1
4
4
  Summary: A tool to manage/update libraries on CircuitPython devices.
5
5
  Author-email: Adafruit Industries <circuitpython@adafruit.com>
6
6
  License: MIT License
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes