mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-31 18:44:27 +02:00
Better handling of upload port for OTA // Issue #417
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
VERSION = (2, 7, "0.dev12")
|
VERSION = (2, 7, "0.dev13")
|
||||||
__version__ = ".".join([str(s) for s in VERSION])
|
__version__ = ".".join([str(s) for s in VERSION])
|
||||||
|
|
||||||
__title__ = "platformio"
|
__title__ = "platformio"
|
||||||
|
@@ -19,7 +19,6 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import socket
|
|
||||||
from os.path import join
|
from os.path import join
|
||||||
|
|
||||||
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default,
|
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default,
|
||||||
@@ -116,7 +115,7 @@ env.Replace(
|
|||||||
UPLOADEROTAFLAGS=[
|
UPLOADEROTAFLAGS=[
|
||||||
"--debug",
|
"--debug",
|
||||||
"--progress",
|
"--progress",
|
||||||
"-i", '"$UPLOAD_PORT"',
|
"-i", "$UPLOAD_PORT",
|
||||||
"$UPLOAD_FLAGS"
|
"$UPLOAD_FLAGS"
|
||||||
],
|
],
|
||||||
|
|
||||||
@@ -230,15 +229,12 @@ if "FRAMEWORK" in env:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Handle uploading via OTA
|
# Handle uploading via OTA
|
||||||
try:
|
ota_port = None
|
||||||
if (env.get("UPLOAD_PORT") and (
|
if env.get("UPLOAD_PORT"):
|
||||||
env.get("UPLOAD_PORT").endswith(".local") or
|
ota_port = re.match(r"((([0-9]{1,3}\.){3}[0-9]{1,3})|.+\.local)$",
|
||||||
socket.inet_aton(env.get("UPLOAD_PORT")))):
|
env.get("UPLOAD_PORT"))
|
||||||
env.Replace(
|
if ota_port:
|
||||||
UPLOADCMD="$UPLOADOTACMD"
|
env.Replace(UPLOADCMD="$UPLOADOTACMD")
|
||||||
)
|
|
||||||
except socket.error:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# Configure native SDK
|
# Configure native SDK
|
||||||
else:
|
else:
|
||||||
|
Reference in New Issue
Block a user