circfirm 2.0.0__py3-none-any.whl → 2.0.1__py3-none-any.whl

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.
circfirm/cli.py CHANGED
@@ -34,9 +34,15 @@ def cli() -> None:
34
34
  @click.option("-b", "--board", default=None, help="Assume the given board name")
35
35
  def install(version: str, language: str, board: Optional[str]) -> None:
36
36
  """Install the specified version of CircuitPython."""
37
+ circuitpy = circfirm.backend.find_circuitpy()
38
+ bootloader = circfirm.backend.find_bootloader()
39
+ if not circuitpy and not bootloader:
40
+ click.echo("CircuitPython device not found!")
41
+ click.echo("Check that the device is connected and mounted.")
42
+ sys.exit(1)
43
+
37
44
  if not board:
38
- circuitpy = circfirm.backend.find_circuitpy()
39
- if not circuitpy and circfirm.backend.find_bootloader():
45
+ if not circuitpy and bootloader:
40
46
  click.echo("CircuitPython device found, but it is in bootloader mode!")
41
47
  click.echo(
42
48
  "Please put the device out of bootloader mode, or use the --board option."
@@ -45,20 +51,14 @@ def install(version: str, language: str, board: Optional[str]) -> None:
45
51
  board = circfirm.backend.get_board_name(circuitpy)
46
52
 
47
53
  click.echo("Board name detected, please switch the device to bootloader mode.")
48
- while not circfirm.backend.find_bootloader():
54
+ while not (bootloader := circfirm.backend.find_bootloader()):
49
55
  time.sleep(1)
50
56
 
51
- mount_path = circfirm.backend.find_bootloader()
52
- if not mount_path:
53
- circuitpy = circfirm.backend.find_circuitpy()
54
- if circuitpy:
57
+ if not bootloader:
58
+ if circfirm.backend.find_circuitpy():
55
59
  click.echo("CircuitPython device found, but is not in bootloader mode!")
56
60
  click.echo("Please put the device in bootloader mode.")
57
61
  sys.exit(2)
58
- else:
59
- click.echo("CircuitPython device not found!")
60
- click.echo("Check that the device is connected and mounted.")
61
- sys.exit(1)
62
62
 
63
63
  if not circfirm.backend.is_downloaded(board, version, language):
64
64
  click.echo("Downloading UF2...")
@@ -66,7 +66,7 @@ def install(version: str, language: str, board: Optional[str]) -> None:
66
66
 
67
67
  uf2file = circfirm.backend.get_uf2_filepath(board, version, language)
68
68
  uf2filename = os.path.basename(uf2file)
69
- shutil.copyfile(uf2file, os.path.join(mount_path, uf2filename))
69
+ shutil.copyfile(uf2file, os.path.join(bootloader, uf2filename))
70
70
  click.echo("UF2 file copied to device!")
71
71
  click.echo("Device should reboot momentarily.")
72
72
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: circfirm
3
- Version: 2.0.0
3
+ Version: 2.0.1
4
4
  Summary: CLI tool for install firmware for CircuitPython boards
5
5
  Author-email: Alec Delaney <tekktrik@gmail.com>
6
6
  License: MIT
@@ -0,0 +1,10 @@
1
+ circfirm/__init__.py,sha256=c5spgXArUydQ9xwHyO-32mJS61okL3IgRXYUG1JFRO4,459
2
+ circfirm/backend.py,sha256=75fNPs4aURHEMxh0BdWVPrRYLJaMy1IZVhebM70jDEA,5589
3
+ circfirm/cli.py,sha256=7UJKLKnuiR_o1FQmJ3dq-U1rcJtXuXCQvNXB2aKTjns,5148
4
+ circfirm/startup.py,sha256=n3OI01SoOhvV-qzGbKis6YUaOiC5eV6zZ2MHfHgG59k,1514
5
+ circfirm-2.0.1.dist-info/LICENSE,sha256=6pPP6gJ00tqCkxg5gABHDwWUiXZ_mBzH94xxPOqwGj4,1069
6
+ circfirm-2.0.1.dist-info/METADATA,sha256=mKa7MbJ6SkeE-wBno4WTgKYDwYMHb7nZLVCQ7flsL88,3775
7
+ circfirm-2.0.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
8
+ circfirm-2.0.1.dist-info/entry_points.txt,sha256=33qZTmSuXz8dgi29yjSyb8VsEA8HyhWuhn2MNcjatGQ,46
9
+ circfirm-2.0.1.dist-info/top_level.txt,sha256=qA2407wap3My6jGA5uchH2JjUM7qn73oBPwALN7GR5k,9
10
+ circfirm-2.0.1.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- circfirm/__init__.py,sha256=c5spgXArUydQ9xwHyO-32mJS61okL3IgRXYUG1JFRO4,459
2
- circfirm/backend.py,sha256=75fNPs4aURHEMxh0BdWVPrRYLJaMy1IZVhebM70jDEA,5589
3
- circfirm/cli.py,sha256=8N-7mS4PmNPpjjtT0FALh2LNmXJguBiYmFwGZ42k9Bc,5174
4
- circfirm/startup.py,sha256=n3OI01SoOhvV-qzGbKis6YUaOiC5eV6zZ2MHfHgG59k,1514
5
- circfirm-2.0.0.dist-info/LICENSE,sha256=6pPP6gJ00tqCkxg5gABHDwWUiXZ_mBzH94xxPOqwGj4,1069
6
- circfirm-2.0.0.dist-info/METADATA,sha256=PN1HB8zr2DAG_ciN2jrhWYyIGwg5JYhxdvaChuNkXJE,3775
7
- circfirm-2.0.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
8
- circfirm-2.0.0.dist-info/entry_points.txt,sha256=33qZTmSuXz8dgi29yjSyb8VsEA8HyhWuhn2MNcjatGQ,46
9
- circfirm-2.0.0.dist-info/top_level.txt,sha256=qA2407wap3My6jGA5uchH2JjUM7qn73oBPwALN7GR5k,9
10
- circfirm-2.0.0.dist-info/RECORD,,