lib-installer 3.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.
Files changed (48) hide show
  1. lib_installer/__init__.py +51 -0
  2. lib_installer/__main__.py +8 -0
  3. lib_installer/arduino/__init__.py +1 -0
  4. lib_installer/arduino/arduino.py +334 -0
  5. lib_installer/arduino/properties.py +168 -0
  6. lib_installer/arduino/sketchbook.py +133 -0
  7. lib_installer/cli.py +38 -0
  8. lib_installer/core/__init__.py +8 -0
  9. lib_installer/core/blocks.py +373 -0
  10. lib_installer/core/cli.py +1432 -0
  11. lib_installer/core/console.py +132 -0
  12. lib_installer/core/download.py +781 -0
  13. lib_installer/core/files.py +35 -0
  14. lib_installer/core/installer.py +1222 -0
  15. lib_installer/core/manifest.py +1487 -0
  16. lib_installer/core/steps.py +222 -0
  17. lib_installer/core/target.py +261 -0
  18. lib_installer/core/updates.py +120 -0
  19. lib_installer/core/usercode.py +193 -0
  20. lib_installer/core/yamlreader.py +417 -0
  21. lib_installer/esp32/__init__.py +1 -0
  22. lib_installer/esp32/component.py +354 -0
  23. lib_installer/esp32/esp32.py +491 -0
  24. lib_installer/esp32/project.py +768 -0
  25. lib_installer/pio/__init__.py +1 -0
  26. lib_installer/pio/ini.py +304 -0
  27. lib_installer/pio/library_json.py +161 -0
  28. lib_installer/pio/pio.py +208 -0
  29. lib_installer/stm32/__init__.py +1 -0
  30. lib_installer/stm32/checks.py +204 -0
  31. lib_installer/stm32/ide/__init__.py +110 -0
  32. lib_installer/stm32/ide/base.py +269 -0
  33. lib_installer/stm32/ide/cmake.py +299 -0
  34. lib_installer/stm32/ide/cubeide.py +344 -0
  35. lib_installer/stm32/ide/iar.py +509 -0
  36. lib_installer/stm32/ide/keil.py +419 -0
  37. lib_installer/stm32/ide/makefile.py +376 -0
  38. lib_installer/stm32/stm32.py +101 -0
  39. lib_installer/zephyr/__init__.py +1 -0
  40. lib_installer/zephyr/app.py +648 -0
  41. lib_installer/zephyr/module.py +375 -0
  42. lib_installer/zephyr/zephyr.py +620 -0
  43. lib_installer-3.0.1.dist-info/METADATA +583 -0
  44. lib_installer-3.0.1.dist-info/RECORD +48 -0
  45. lib_installer-3.0.1.dist-info/WHEEL +5 -0
  46. lib_installer-3.0.1.dist-info/entry_points.txt +2 -0
  47. lib_installer-3.0.1.dist-info/licenses/LICENSE +201 -0
  48. lib_installer-3.0.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,132 @@
1
+ """
2
+ Colored terminal output.
3
+
4
+ No dependency on colorama. Windows 10 and later can render ANSI escapes once
5
+ virtual terminal processing is switched on, which is done here at import time.
6
+ Where that fails, and wherever the output is not a terminal, every helper
7
+ degrades to plain text rather than printing escape codes into a log file.
8
+
9
+ Honours the NO_COLOR convention, see https://no-color.org
10
+ """
11
+
12
+ import os
13
+ import sys
14
+
15
+ RESET = "\033[0m"
16
+ BOLD = "\033[1m"
17
+ DIM = "\033[2m"
18
+
19
+ RED = "\033[31m"
20
+ GREEN = "\033[32m"
21
+ YELLOW = "\033[33m"
22
+ BLUE = "\033[34m"
23
+ MAGENTA = "\033[35m"
24
+ CYAN = "\033[36m"
25
+ GREY = "\033[90m"
26
+
27
+
28
+ def _enable_windows_ansi():
29
+ """Turn on virtual terminal processing. Returns True when colour is usable."""
30
+ if os.name != "nt":
31
+ return True
32
+
33
+ try:
34
+ import ctypes
35
+
36
+ kernel32 = ctypes.windll.kernel32
37
+ # -11 is STD_OUTPUT_HANDLE, 0x0004 is ENABLE_VIRTUAL_TERMINAL_PROCESSING.
38
+ handle = kernel32.GetStdHandle(-11)
39
+ mode = ctypes.c_ulong()
40
+
41
+ if kernel32.GetConsoleMode(handle, ctypes.byref(mode)) == 0:
42
+ return False
43
+
44
+ return kernel32.SetConsoleMode(handle, mode.value | 0x0004) != 0
45
+ except Exception:
46
+ return False
47
+
48
+
49
+ def _supported():
50
+ """Whether to emit escape codes at all."""
51
+ if os.environ.get("NO_COLOR") is not None:
52
+ return False
53
+
54
+ if os.environ.get("TERM") == "dumb":
55
+ return False
56
+
57
+ if not hasattr(sys.stdout, "isatty") or not sys.stdout.isatty():
58
+ return False
59
+
60
+ return _enable_windows_ansi()
61
+
62
+
63
+ ENABLED = _supported()
64
+
65
+
66
+ def paint(text, *codes):
67
+ """Wrap text in escape codes, or return it untouched when colour is off."""
68
+ if not ENABLED or not codes:
69
+ return text
70
+
71
+ return "".join(codes) + str(text) + RESET
72
+
73
+
74
+ def title(text):
75
+ return paint(text, BOLD, CYAN)
76
+
77
+
78
+ def good(text):
79
+ return paint(text, GREEN)
80
+
81
+
82
+ def warn(text):
83
+ return paint(text, YELLOW)
84
+
85
+
86
+ def bad(text):
87
+ return paint(text, RED)
88
+
89
+
90
+ def note(text):
91
+ return paint(text, GREY)
92
+
93
+
94
+ def strong(text):
95
+ return paint(text, BOLD)
96
+
97
+
98
+ def banner(name, version, description=""):
99
+ """The block printed before anything is written."""
100
+ head = paint(name, BOLD, CYAN)
101
+
102
+ # A library whose header carries no @version simply shows none.
103
+ if version:
104
+ head += f" {paint(version, DIM)}"
105
+
106
+ lines = [head]
107
+
108
+ if description:
109
+ lines.append(note(description))
110
+
111
+ return "\n".join(lines)
112
+
113
+
114
+ def item(mark, label, path, colour=None):
115
+ """
116
+ One line of the file report.
117
+
118
+ The mark is a short word, so the column stays aligned and the output still
119
+ reads correctly when colour is off or the font has no symbols.
120
+ """
121
+ painted = paint(f"{mark:<8}", colour) if colour else f"{mark:<8}"
122
+
123
+ return f" {painted}{path}{(' ' + note(label)) if label else ''}"
124
+
125
+
126
+ def heading(text):
127
+ """A section heading inside the output."""
128
+ return paint(text, BOLD)
129
+
130
+
131
+ def bullet(text, colour=None):
132
+ return f" {paint('-', GREY)} {paint(text, colour) if colour else text}"