circup 2.1.0__tar.gz → 2.1.2__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.
- {circup-2.1.0 → circup-2.1.2}/.github/workflows/build.yml +1 -1
- {circup-2.1.0/circup.egg-info → circup-2.1.2}/PKG-INFO +2 -2
- {circup-2.1.0 → circup-2.1.2}/circup/backends.py +4 -1
- {circup-2.1.0 → circup-2.1.2}/circup/command_utils.py +15 -1
- {circup-2.1.0 → circup-2.1.2}/circup/commands.py +29 -7
- {circup-2.1.0 → circup-2.1.2}/circup/shared.py +1 -1
- {circup-2.1.0 → circup-2.1.2/circup.egg-info}/PKG-INFO +2 -2
- {circup-2.1.0 → circup-2.1.2}/tests/mock_device/boot_out.txt +1 -1
- {circup-2.1.0 → circup-2.1.2}/tests/test_circup.py +18 -6
- {circup-2.1.0 → circup-2.1.2}/.github/ISSUE_TEMPLATE.md +0 -0
- {circup-2.1.0 → circup-2.1.2}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {circup-2.1.0 → circup-2.1.2}/.github/workflows/release.yml +0 -0
- {circup-2.1.0 → circup-2.1.2}/.gitignore +0 -0
- {circup-2.1.0 → circup-2.1.2}/.isort.cfg +0 -0
- {circup-2.1.0 → circup-2.1.2}/.pre-commit-config.yaml +0 -0
- {circup-2.1.0 → circup-2.1.2}/.pylintrc +0 -0
- {circup-2.1.0 → circup-2.1.2}/CODE_OF_CONDUCT.rst +0 -0
- {circup-2.1.0 → circup-2.1.2}/CODE_OF_CONDUCT.rst.license +0 -0
- {circup-2.1.0 → circup-2.1.2}/CONTRIBUTING.rst +0 -0
- {circup-2.1.0 → circup-2.1.2}/CONTRIBUTING.rst.license +0 -0
- {circup-2.1.0 → circup-2.1.2}/LICENSE +0 -0
- {circup-2.1.0 → circup-2.1.2}/LICENSES/CC-BY-4.0.txt +0 -0
- {circup-2.1.0 → circup-2.1.2}/LICENSES/MIT.txt +0 -0
- {circup-2.1.0 → circup-2.1.2}/LICENSES/Unlicense.txt +0 -0
- {circup-2.1.0 → circup-2.1.2}/README.rst +0 -0
- {circup-2.1.0 → circup-2.1.2}/README.rst.license +0 -0
- {circup-2.1.0 → circup-2.1.2}/circup/__init__.py +0 -0
- {circup-2.1.0 → circup-2.1.2}/circup/bundle.py +0 -0
- {circup-2.1.0 → circup-2.1.2}/circup/config/bundle_config.json +0 -0
- {circup-2.1.0 → circup-2.1.2}/circup/config/bundle_config.json.license +0 -0
- {circup-2.1.0 → circup-2.1.2}/circup/logging.py +0 -0
- {circup-2.1.0 → circup-2.1.2}/circup/module.py +0 -0
- {circup-2.1.0 → circup-2.1.2}/circup/wwshell/README.rst +0 -0
- {circup-2.1.0 → circup-2.1.2}/circup/wwshell/README.rst.license +0 -0
- {circup-2.1.0 → circup-2.1.2}/circup/wwshell/__init__.py +0 -0
- {circup-2.1.0 → circup-2.1.2}/circup/wwshell/commands.py +0 -0
- {circup-2.1.0 → circup-2.1.2}/circup.egg-info/SOURCES.txt +0 -0
- {circup-2.1.0 → circup-2.1.2}/circup.egg-info/dependency_links.txt +0 -0
- {circup-2.1.0 → circup-2.1.2}/circup.egg-info/entry_points.txt +0 -0
- {circup-2.1.0 → circup-2.1.2}/circup.egg-info/requires.txt +0 -0
- {circup-2.1.0 → circup-2.1.2}/circup.egg-info/top_level.txt +0 -0
- {circup-2.1.0 → circup-2.1.2}/docs/_static/favicon.ico +0 -0
- {circup-2.1.0 → circup-2.1.2}/docs/_static/favicon.ico.license +0 -0
- {circup-2.1.0 → circup-2.1.2}/docs/conf.py +0 -0
- {circup-2.1.0 → circup-2.1.2}/docs/index.rst +0 -0
- {circup-2.1.0 → circup-2.1.2}/docs/index.rst.license +0 -0
- {circup-2.1.0 → circup-2.1.2}/docs/logo.png +0 -0
- {circup-2.1.0 → circup-2.1.2}/docs/logo.png.license +0 -0
- {circup-2.1.0 → circup-2.1.2}/optional_requirements.txt +0 -0
- {circup-2.1.0 → circup-2.1.2}/optional_requirements.txt.license +0 -0
- {circup-2.1.0 → circup-2.1.2}/pyproject.toml +0 -0
- {circup-2.1.0 → circup-2.1.2}/readthedocs.yml +0 -0
- {circup-2.1.0 → circup-2.1.2}/requirements.txt +0 -0
- {circup-2.1.0 → circup-2.1.2}/requirements.txt.license +0 -0
- {circup-2.1.0 → circup-2.1.2}/setup.cfg +0 -0
- {circup-2.1.0 → circup-2.1.2}/tests/__init__.py +0 -0
- {circup-2.1.0 → circup-2.1.2}/tests/bad_module/__init__.py +0 -0
- {circup-2.1.0 → circup-2.1.2}/tests/bad_module/my_module.py +0 -0
- {circup-2.1.0 → circup-2.1.2}/tests/bad_python.py +0 -0
- {circup-2.1.0 → circup-2.1.2}/tests/bundle.json +0 -0
- {circup-2.1.0 → circup-2.1.2}/tests/bundle.json.license +0 -0
- {circup-2.1.0 → circup-2.1.2}/tests/device.json +0 -0
- {circup-2.1.0 → circup-2.1.2}/tests/device.json.license +0 -0
- {circup-2.1.0 → circup-2.1.2}/tests/dir_module/__init__.py +0 -0
- {circup-2.1.0 → circup-2.1.2}/tests/dir_module/my_module.py +0 -0
- {circup-2.1.0 → circup-2.1.2}/tests/import_styles.py +0 -0
- {circup-2.1.0 → circup-2.1.2}/tests/local_module.py +0 -0
- {circup-2.1.0 → circup-2.1.2}/tests/local_module_cp7.mpy +0 -0
- {circup-2.1.0 → circup-2.1.2}/tests/local_module_cp7.mpy.license +0 -0
- {circup-2.1.0 → circup-2.1.2}/tests/mock_device/boot_out.txt.license +0 -0
- {circup-2.1.0 → circup-2.1.2}/tests/mock_device/lib/adafruit_waveform/.gitkeep +0 -0
- {circup-2.1.0 → circup-2.1.2}/tests/mount_exists.txt +0 -0
- {circup-2.1.0 → circup-2.1.2}/tests/mount_exists.txt.license +0 -0
- {circup-2.1.0 → circup-2.1.2}/tests/mount_missing.txt +0 -0
- {circup-2.1.0 → circup-2.1.2}/tests/mount_missing.txt.license +0 -0
- {circup-2.1.0 → circup-2.1.2}/tests/remote_module.py +0 -0
- {circup-2.1.0 → circup-2.1.2}/tests/test_bundle_config.json +0 -0
- {circup-2.1.0 → circup-2.1.2}/tests/test_bundle_config.json.license +0 -0
- {circup-2.1.0 → circup-2.1.2}/tests/test_bundle_config_local.json +0 -0
- {circup-2.1.0 → circup-2.1.2}/tests/test_bundle_config_local.json.license +0 -0
- {circup-2.1.0 → circup-2.1.2}/tests/test_module.mpy +0 -0
- {circup-2.1.0 → circup-2.1.2}/tests/test_module.mpy.license +0 -0
|
@@ -16,7 +16,7 @@ jobs:
|
|
|
16
16
|
run: echo "$GITHUB_CONTEXT"
|
|
17
17
|
- name: Translate Repo Name For Build Tools filename_prefix
|
|
18
18
|
id: repo-name
|
|
19
|
-
run: echo
|
|
19
|
+
run: echo "repo-name=circup" >> $GITHUB_OUTPUT
|
|
20
20
|
- name: Set up Python 3.11
|
|
21
21
|
uses: actions/setup-python@v1
|
|
22
22
|
with:
|
|
@@ -950,7 +950,10 @@ class DiskBackend(Backend):
|
|
|
950
950
|
# Copy the directory.
|
|
951
951
|
shutil.copytree(source_path, target_path)
|
|
952
952
|
else:
|
|
953
|
-
|
|
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=
|
|
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.",
|
|
@@ -21,7 +21,7 @@ BAD_FILE_FORMAT = "Invalid"
|
|
|
21
21
|
DATA_DIR = appdirs.user_data_dir(appname="circup", appauthor="adafruit")
|
|
22
22
|
|
|
23
23
|
#: Module formats list (and the other form used in github files)
|
|
24
|
-
PLATFORMS = {"py": "py", "
|
|
24
|
+
PLATFORMS = {"py": "py", "9mpy": "9.x-mpy"}
|
|
25
25
|
|
|
26
26
|
#: Timeout for requests calls like get()
|
|
27
27
|
REQUESTS_TIMEOUT = 30
|
|
@@ -94,10 +94,10 @@ def test_Bundle_lib_dir():
|
|
|
94
94
|
"adafruit/adafruit-circuitpython-bundle-py/"
|
|
95
95
|
"adafruit-circuitpython-bundle-py-TESTTAG/lib"
|
|
96
96
|
)
|
|
97
|
-
assert bundle.lib_dir("
|
|
97
|
+
assert bundle.lib_dir("9mpy") == (
|
|
98
98
|
circup.shared.DATA_DIR + "/"
|
|
99
|
-
"adafruit/adafruit-circuitpython-bundle-
|
|
100
|
-
"adafruit-circuitpython-bundle-
|
|
99
|
+
"adafruit/adafruit-circuitpython-bundle-9mpy/"
|
|
100
|
+
"adafruit-circuitpython-bundle-9.x-mpy-TESTTAG/lib"
|
|
101
101
|
)
|
|
102
102
|
|
|
103
103
|
|
|
@@ -378,6 +378,16 @@ def test_Module_mpy_mismatch():
|
|
|
378
378
|
assert m2.outofdate is False
|
|
379
379
|
assert m3.mpy_mismatch is True
|
|
380
380
|
assert m3.outofdate is True
|
|
381
|
+
with mock.patch(
|
|
382
|
+
"circup.backends.DiskBackend.get_circuitpython_version",
|
|
383
|
+
return_value=("9.0.0", ""),
|
|
384
|
+
):
|
|
385
|
+
assert m1.mpy_mismatch is False
|
|
386
|
+
assert m1.outofdate is False
|
|
387
|
+
assert m2.mpy_mismatch is True
|
|
388
|
+
assert m2.outofdate is True
|
|
389
|
+
assert m3.mpy_mismatch is True
|
|
390
|
+
assert m3.outofdate is True
|
|
381
391
|
|
|
382
392
|
|
|
383
393
|
def test_Module_major_update_bad_versions():
|
|
@@ -419,14 +429,16 @@ def test_Module_row():
|
|
|
419
429
|
repo = "https://github.com/adafruit/SomeLibrary.git"
|
|
420
430
|
with mock.patch("circup.os.path.isfile", return_value=True), mock.patch(
|
|
421
431
|
"circup.backends.DiskBackend.get_circuitpython_version",
|
|
422
|
-
return_value=("
|
|
432
|
+
return_value=("9.0.0", ""),
|
|
423
433
|
), mock.patch("circup.logger.warning") as mock_logger:
|
|
424
434
|
backend = DiskBackend("mock_device", mock_logger)
|
|
425
435
|
m = Module(name, backend, repo, "1.2.3", None, False, bundle, (None, None))
|
|
426
436
|
assert m.row == ("module", "1.2.3", "unknown", "Major Version")
|
|
427
437
|
m = Module(name, backend, repo, "1.2.3", "1.3.4", False, bundle, (None, None))
|
|
428
438
|
assert m.row == ("module", "1.2.3", "1.3.4", "Minor Version")
|
|
429
|
-
m = Module(
|
|
439
|
+
m = Module(
|
|
440
|
+
name, backend, repo, "1.2.3", "1.2.3", True, bundle, ("8.0.0", "9.0.0")
|
|
441
|
+
)
|
|
430
442
|
assert m.row == ("module", "1.2.3", "1.2.3", "MPY Format")
|
|
431
443
|
|
|
432
444
|
|
|
@@ -806,7 +818,7 @@ def test_get_circuitpython_version():
|
|
|
806
818
|
with mock.patch("circup.logger.warning") as mock_logger:
|
|
807
819
|
backend = DiskBackend("tests/mock_device", mock_logger)
|
|
808
820
|
assert backend.get_circuitpython_version() == (
|
|
809
|
-
"
|
|
821
|
+
"9.0.0",
|
|
810
822
|
"this_is_a_board",
|
|
811
823
|
)
|
|
812
824
|
|
|
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
|
|
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
|