mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-07-11 16:57:49 -06:00
🔨 Install 'heatshrink' if needed (#25896)
This commit is contained in:
parent
d926d4dea4
commit
47616c7dfa
2 changed files with 31 additions and 23 deletions
|
@ -7,17 +7,6 @@ import serial
|
|||
|
||||
Import("env")
|
||||
|
||||
# Needed (only) for compression, but there are problems with pip install heatshrink
|
||||
#try:
|
||||
# import heatshrink
|
||||
#except ImportError:
|
||||
# # Install heatshrink
|
||||
# print("Installing 'heatshrink' python module...")
|
||||
# env.Execute(env.subst("$PYTHONEXE -m pip install heatshrink"))
|
||||
#
|
||||
# Not tested: If it's safe to install python libraries in PIO python try:
|
||||
# env.Execute(env.subst("$PYTHONEXE -m pip install https://github.com/p3p/pyheatshrink/releases/download/0.3.3/pyheatshrink-pip.zip"))
|
||||
|
||||
import MarlinBinaryProtocol
|
||||
|
||||
#-----------------#
|
||||
|
@ -191,6 +180,21 @@ def Upload(source, target, env):
|
|||
# "upload_random_name": generate a random 8.3 firmware filename to upload
|
||||
upload_random_filename = upload_delete_old_bins and not marlin_long_filename_host_support
|
||||
|
||||
# Heatshrink module is needed (only) for compression
|
||||
if upload_compression:
|
||||
if sys.version_info[0] > 2:
|
||||
try:
|
||||
import heatshrink2
|
||||
except ImportError:
|
||||
print("Installing 'heatshrink2' python module...")
|
||||
env.Execute(env.subst("$PYTHONEXE -m pip install heatshrink2"))
|
||||
else:
|
||||
try:
|
||||
import heatshrink
|
||||
except ImportError:
|
||||
print("Installing 'heatshrink' python module...")
|
||||
env.Execute(env.subst("$PYTHONEXE -m pip install heatshrink"))
|
||||
|
||||
try:
|
||||
|
||||
# Start upload job
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue