microweb 0.1.2__py3-none-any.whl → 0.1.3__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.
- microweb/cli.py +35 -18
- microweb/uploader.py +1 -1
- {microweb-0.1.2.dist-info → microweb-0.1.3.dist-info}/METADATA +1 -1
- {microweb-0.1.2.dist-info → microweb-0.1.3.dist-info}/RECORD +8 -8
- {microweb-0.1.2.dist-info → microweb-0.1.3.dist-info}/WHEEL +0 -0
- {microweb-0.1.2.dist-info → microweb-0.1.3.dist-info}/entry_points.txt +0 -0
- {microweb-0.1.2.dist-info → microweb-0.1.3.dist-info}/licenses/LICENSE +0 -0
- {microweb-0.1.2.dist-info → microweb-0.1.3.dist-info}/top_level.txt +0 -0
microweb/cli.py
CHANGED
@@ -183,31 +183,47 @@ def verify_static_files_exist(static_files, static_dir):
|
|
183
183
|
return existing_files, missing_files
|
184
184
|
|
185
185
|
def upload_boot_py(port, module_name):
|
186
|
-
"""Create and upload boot.py
|
186
|
+
"""Create and upload boot.py that imports the specified app module."""
|
187
187
|
boot_content = f"import {module_name}\n"
|
188
|
-
|
189
|
-
with
|
190
|
-
|
191
|
-
|
188
|
+
|
189
|
+
with open("boot.py", "w", encoding="utf-8") as f:
|
190
|
+
f.write(boot_content)
|
191
|
+
|
192
192
|
try:
|
193
|
-
print_colored(f"⬆️ Uploading boot.py to import {module_name}...", color='cyan')
|
194
|
-
upload_file(
|
193
|
+
print_colored(f"⬆️ Uploading boot.py to import '{module_name}'...", color='cyan')
|
194
|
+
upload_file("boot.py", port, destination='boot.py')
|
195
|
+
print_colored("✅ boot.py uploaded successfully.", color='green')
|
195
196
|
finally:
|
196
|
-
os.
|
197
|
+
os.remove("boot.py")
|
198
|
+
|
197
199
|
|
198
200
|
def remove_boot_py(port):
|
199
|
-
"""
|
201
|
+
"""Replace boot.py on ESP32 with minimal content using ampy."""
|
202
|
+
boot_content = "import gc\ngc.collect()\n"
|
203
|
+
boot_filename = "boot.py"
|
204
|
+
|
205
|
+
# Write minimal boot.py locally
|
206
|
+
with open(boot_filename, "w", encoding="utf-8") as f:
|
207
|
+
f.write(boot_content)
|
208
|
+
|
200
209
|
try:
|
201
|
-
print_colored("🗑️
|
202
|
-
cmd = [
|
203
|
-
result = subprocess.run(cmd, capture_output=True, text=True, timeout=
|
210
|
+
print_colored(f"🗑️ Replacing boot.py on ESP32 (port {port}) using ampy...", color='cyan')
|
211
|
+
cmd = ["ampy", "--port", port, "put", boot_filename]
|
212
|
+
result = subprocess.run(cmd, capture_output=True, text=True, timeout=15)
|
213
|
+
|
204
214
|
if result.returncode != 0:
|
205
|
-
print_colored(f"⚠️
|
215
|
+
print_colored(f"⚠️ Failed to replace boot.py: {result.stderr.strip()}", color='yellow')
|
206
216
|
else:
|
207
|
-
print_colored("boot.py
|
217
|
+
print_colored("✅ boot.py replaced successfully.", color='green')
|
218
|
+
|
208
219
|
except Exception as e:
|
209
|
-
print_colored(f"Error
|
220
|
+
print_colored(f"❌ Error replacing boot.py: {e}", color='red')
|
210
221
|
|
222
|
+
finally:
|
223
|
+
if os.path.exists(boot_filename):
|
224
|
+
os.remove(boot_filename)
|
225
|
+
|
226
|
+
|
211
227
|
@click.group()
|
212
228
|
def cli():
|
213
229
|
pass
|
@@ -353,12 +369,13 @@ def run(file, port, check_only, static, force, no_stop, timeout, add_boot, remov
|
|
353
369
|
if not port:
|
354
370
|
print_colored("No ESP32 found. Specify --port, e.g., --port COM10.", color='red')
|
355
371
|
return
|
356
|
-
if not check_micropython(port):
|
357
|
-
print_colored(f"MicroPython not detected on ESP32. Please run 'microweb flash --port {port}' first.", color='red')
|
358
|
-
return
|
359
372
|
if remove_boot:
|
360
373
|
remove_boot_py(port)
|
361
374
|
return
|
375
|
+
if not check_micropython(port):
|
376
|
+
print_colored(f"MicroPython not detected on ESP32. Please run 'microweb flash --port {port}' first.", color='red')
|
377
|
+
return
|
378
|
+
|
362
379
|
try:
|
363
380
|
print_colored(f"\nGetting remote file information from {port}...", color='blue')
|
364
381
|
remote_files = get_remote_file_info(port)
|
microweb/uploader.py
CHANGED
@@ -33,7 +33,7 @@ def upload_file(file_path, port=None,destination=None):
|
|
33
33
|
raise Exception(f"File {file_name} not found after upload")
|
34
34
|
|
35
35
|
except subprocess.TimeoutExpired:
|
36
|
-
raise Exception(f"Upload timeout for {file_name}")
|
36
|
+
raise Exception(f"Upload timeout for {file_name} or that's uploaded that is effect to boot.py that is why timeout. ")
|
37
37
|
except Exception as e:
|
38
38
|
raise Exception(f"Upload error for {file_name}: {e}")
|
39
39
|
|
@@ -1,15 +1,15 @@
|
|
1
1
|
microweb/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
microweb/cli.py,sha256=
|
2
|
+
microweb/cli.py,sha256=MoFSGG1AXvza4pwFxhoT9R65-9Jo7VtMslXN993kfv4,27919
|
3
3
|
microweb/microweb.py,sha256=WlDV1Fk5M4EsvmmkWKVLWaoZh6Vgl9G0qORFsQEQ3iM,12799
|
4
|
-
microweb/uploader.py,sha256=
|
4
|
+
microweb/uploader.py,sha256=4aTFBMwIIKzONuvXla70ch7yT1pJ8XDmInYBPfVqcok,3164
|
5
5
|
microweb/wifi.py,sha256=S2gOOmTKp2G1uUHxOH0DHQ_k7QSERKHDCm89qv-WlKs,904
|
6
6
|
microweb/firmware/ESP32_GENERIC-20250415-v1.25.0.bin,sha256=HrGohHPjKqak1F3BtbatQLwfBhKOeqhUjkOM-kYz2hs,1702240
|
7
7
|
microweb/firmware/ESP8266_GENERIC-20250415-v1.25.0.bin,sha256=DcEkzHgtDl-BCwap6UbgKhirHjbWepSgd8PonauaVcY,636820
|
8
8
|
microweb/firmware/boot.py,sha256=1522jvxAjGk-y7X4mzMilB4pMQ6KrAgosDXRAMtac8k,22
|
9
9
|
microweb/firmware/main.py,sha256=g_rg-1qpQEzvQoSnhXairx_v7xHNuGDJVrmbdziKt1A,10
|
10
|
-
microweb-0.1.
|
11
|
-
microweb-0.1.
|
12
|
-
microweb-0.1.
|
13
|
-
microweb-0.1.
|
14
|
-
microweb-0.1.
|
15
|
-
microweb-0.1.
|
10
|
+
microweb-0.1.3.dist-info/licenses/LICENSE,sha256=7tSPQeJFv8168MWaFKTWEqYRvM9Lh5xsBh-US0mxUF0,1070
|
11
|
+
microweb-0.1.3.dist-info/METADATA,sha256=EsCNvIOp8eJ2c6gM_9lw1dTKaLlP5teu09Eo54bgnQ8,13725
|
12
|
+
microweb-0.1.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
13
|
+
microweb-0.1.3.dist-info/entry_points.txt,sha256=yBGjIy-e3mx-HHkmkGNLBcSDEALB327du5KuauZHmg4,46
|
14
|
+
microweb-0.1.3.dist-info/top_level.txt,sha256=CkRcDTo-nv4JTieAZPKFC-EGKYYQmKNq5C8zU2k5zRM,9
|
15
|
+
microweb-0.1.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|