forked from platformio/platformio-core
Fix PyLint's "misplaced-comparison-constant"
This commit is contained in:
@ -283,9 +283,9 @@ def exec_command(*args, **kwargs):
|
|||||||
def get_serialports(use_grep=False):
|
def get_serialports(use_grep=False):
|
||||||
|
|
||||||
def _grep_serial_ports():
|
def _grep_serial_ports():
|
||||||
assert "Windows" != system()
|
assert system() != "Windows"
|
||||||
result = []
|
result = []
|
||||||
if "Linux" == system():
|
if system() == "Linux":
|
||||||
patterns = ["/dev/%s*" % p for p in (
|
patterns = ["/dev/%s*" % p for p in (
|
||||||
"ttyS", "ttyUSB", "ttyACM", "ttyAMA", "rfcomm", "ttyO")]
|
"ttyS", "ttyUSB", "ttyACM", "ttyAMA", "rfcomm", "ttyO")]
|
||||||
else:
|
else:
|
||||||
@ -295,7 +295,7 @@ def get_serialports(use_grep=False):
|
|||||||
result.append({"port": port, "description": "", "hwid": ""})
|
result.append({"port": port, "description": "", "hwid": ""})
|
||||||
return result
|
return result
|
||||||
|
|
||||||
if use_grep and "Windows" != system():
|
if use_grep and system() != "Windows":
|
||||||
return _grep_serial_ports()
|
return _grep_serial_ports()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -307,7 +307,7 @@ def get_serialports(use_grep=False):
|
|||||||
for p, d, h in comports():
|
for p, d, h in comports():
|
||||||
if not p:
|
if not p:
|
||||||
continue
|
continue
|
||||||
if "Windows" == system():
|
if system() == "Windows":
|
||||||
try:
|
try:
|
||||||
d = unicode(d, errors="ignore")
|
d = unicode(d, errors="ignore")
|
||||||
except TypeError:
|
except TypeError:
|
||||||
@ -315,7 +315,7 @@ def get_serialports(use_grep=False):
|
|||||||
result.append({"port": p, "description": d, "hwid": h})
|
result.append({"port": p, "description": d, "hwid": h})
|
||||||
|
|
||||||
# fix for PySerial
|
# fix for PySerial
|
||||||
if not result and "Windows" != system():
|
if not result and system() != "Windows":
|
||||||
result = _grep_serial_ports()
|
result = _grep_serial_ports()
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
Reference in New Issue
Block a user