Drop support for Python 2

This commit is contained in:
Ivan Kravets
2021-03-19 00:21:44 +02:00
parent dbb9998f69
commit a78db17784
31 changed files with 78 additions and 116 deletions
+2 -2
View File
@@ -19,7 +19,7 @@ import sys
import time
from platformio.compat import (
WINDOWS,
IS_WINDOWS,
aio_create_task,
aio_get_running_loop,
get_locale_encoding,
@@ -93,7 +93,7 @@ class DebugBaseProcess:
async def _read_stdin_pipe(self):
loop = aio_get_running_loop()
if WINDOWS:
if IS_WINDOWS:
while True:
self.stdin_data_received(
await loop.run_in_executor(None, sys.stdin.buffer.readline)
+8 -3
View File
@@ -19,9 +19,14 @@ import signal
import tempfile
import time
from platformio import fs, proc, telemetry, util
from platformio import fs, proc, telemetry
from platformio.cache import ContentCache
from platformio.compat import aio_get_running_loop, hashlib_encode_data, is_bytes
from platformio.compat import (
IS_WINDOWS,
aio_get_running_loop,
hashlib_encode_data,
is_bytes,
)
from platformio.debug import helpers
from platformio.debug.process.base import DebugBaseProcess
from platformio.debug.process.server import DebugServerProcess
@@ -230,7 +235,7 @@ class DebugClientProcess(
cc.delete(self._session_id)
if not pid:
return
if "windows" in util.get_systype():
if IS_WINDOWS:
kill = ["Taskkill", "/PID", pid, "/F"]
else:
kill = ["kill", pid]
+4 -5
View File
@@ -13,12 +13,11 @@
# limitations under the License.
import asyncio
import fnmatch
import os
import time
from platformio import fs
from platformio.compat import MACOS, WINDOWS
from platformio.compat import IS_MACOS, IS_WINDOWS
from platformio.debug.exception import DebugInvalidOptionsError
from platformio.debug.helpers import escape_gdbmi_stream, is_gdbmi_mode
from platformio.debug.process.base import DebugBaseProcess
@@ -41,7 +40,7 @@ class DebugServerProcess(DebugBaseProcess):
if server["cwd"]:
server_executable = os.path.join(server["cwd"], server_executable)
if (
WINDOWS
IS_WINDOWS
and not server_executable.endswith(".exe")
and os.path.isfile(server_executable + ".exe")
):
@@ -81,11 +80,11 @@ class DebugServerProcess(DebugBaseProcess):
env = os.environ.copy()
# prepend server "lib" folder to LD path
if (
not WINDOWS
not IS_WINDOWS
and server["cwd"]
and os.path.isdir(os.path.join(server["cwd"], "lib"))
):
ld_key = "DYLD_LIBRARY_PATH" if MACOS else "LD_LIBRARY_PATH"
ld_key = "DYLD_LIBRARY_PATH" if IS_MACOS else "LD_LIBRARY_PATH"
env[ld_key] = os.path.join(server["cwd"], "lib")
if os.environ.get(ld_key):
env[ld_key] = "%s:%s" % (env[ld_key], os.environ.get(ld_key))