forked from platformio/platformio-core
Use util.get_systype when checking for system
This commit is contained in:
@ -23,7 +23,6 @@ import sys
|
||||
from glob import glob
|
||||
from os.path import (basename, commonprefix, dirname, isdir, isfile, join,
|
||||
realpath, sep)
|
||||
from platform import system
|
||||
|
||||
import SCons.Scanner
|
||||
from SCons.Script import ARGUMENTS, COMMAND_LINE_TARGETS, DefaultEnvironment
|
||||
@ -82,6 +81,8 @@ class LibBuilderFactory(object):
|
||||
|
||||
class LibBuilderBase(object):
|
||||
|
||||
IS_WINDOWS = "windows" in util.get_systype()
|
||||
|
||||
LDF_MODES = ["off", "chain", "deep", "chain+", "deep+"]
|
||||
LDF_MODE_DEFAULT = "chain"
|
||||
|
||||
@ -119,7 +120,7 @@ class LibBuilderBase(object):
|
||||
def __contains__(self, path):
|
||||
p1 = self.path
|
||||
p2 = path
|
||||
if system() == "Windows":
|
||||
if self.IS_WINDOWS:
|
||||
p1 = p1.lower()
|
||||
p2 = p2.lower()
|
||||
return commonprefix((p1 + sep, p2)) == p1 + sep
|
||||
|
@ -18,7 +18,6 @@ import sys
|
||||
from fnmatch import fnmatch
|
||||
from os import environ
|
||||
from os.path import isfile, join
|
||||
from platform import system
|
||||
from shutil import copyfile
|
||||
from time import sleep
|
||||
|
||||
@ -133,7 +132,7 @@ def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument
|
||||
port = item['port']
|
||||
if upload_protocol.startswith("blackmagic") \
|
||||
and "GDB" in item['description']:
|
||||
return ("\\\\.\\%s" % port if system() == "Windows"
|
||||
return ("\\\\.\\%s" % port if "windows" in util.get_systype()
|
||||
and port.startswith("COM") and len(port) > 4 else port)
|
||||
for hwid in board_hwids:
|
||||
hwid_str = ("%s:%s" % (hwid[0], hwid[1])).replace("0x", "")
|
||||
@ -149,7 +148,7 @@ def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument
|
||||
and not env.subst("$UPLOAD_PROTOCOL"):
|
||||
env.Replace(UPLOAD_PORT=_look_for_mbed_disk())
|
||||
else:
|
||||
if (system() == "Linux" and not any([
|
||||
if ("linux" in util.get_systype() and not any([
|
||||
isfile("/etc/udev/rules.d/99-platformio-udev.rules"),
|
||||
isfile("/lib/udev/rules.d/99-platformio-udev.rules")
|
||||
])):
|
||||
|
@ -431,7 +431,7 @@ def get_serial_ports(filter_hwid=False):
|
||||
for p, d, h in comports():
|
||||
if not p:
|
||||
continue
|
||||
if platform.system() == "Windows":
|
||||
if "windows" in get_systype():
|
||||
try:
|
||||
d = unicode(d, errors="ignore")
|
||||
except TypeError:
|
||||
@ -443,7 +443,7 @@ def get_serial_ports(filter_hwid=False):
|
||||
return result
|
||||
|
||||
# fix for PySerial
|
||||
if not result and platform.system() == "Darwin":
|
||||
if not result and "darwin" in get_systype():
|
||||
for p in glob("/dev/tty.*"):
|
||||
result.append({"port": p, "description": "n/a", "hwid": "n/a"})
|
||||
return result
|
||||
@ -455,7 +455,7 @@ get_serialports = get_serial_ports
|
||||
|
||||
def get_logical_devices():
|
||||
items = []
|
||||
if platform.system() == "Windows":
|
||||
if "windows" in get_systype():
|
||||
try:
|
||||
result = exec_command(
|
||||
["wmic", "logicaldisk", "get", "name,VolumeName"]).get(
|
||||
|
Reference in New Issue
Block a user