Skip to content

Commit

Permalink
west: bossac: handle stty on macOS better
Browse files Browse the repository at this point in the history
There might be situations where people are running the coreutils version
of stty on macOS, hence the need for being smarter at detecting when
that might be the case

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
  • Loading branch information
kartben committed Sep 19, 2023
1 parent a4de2eb commit d22de42
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scripts/west_commands/runners/bossac.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,19 @@ def get_image_offset(self, supports_offset):

return None

def is_gnu_coreutils_stty():

Check failure on line 152 in scripts/west_commands/runners/bossac.py

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

E0211

scripts/west_commands/runners/bossac.py:152 Method 'is_gnu_coreutils_stty' has no argument (no-method-argument)
try:
result = subprocess.run(['stty', '--version'], capture_output=True, text=True, check=True)
return 'coreutils' in result.stdout
except subprocess.CalledProcessError:
return False

def set_serial_config(self):
if platform.system() == 'Linux' or platform.system() == 'Darwin':
self.require('stty')

# GNU coreutils uses a capital F flag for 'file'
flag = '-F' if platform.system() == 'Linux' else '-f'
flag = '-F' if is_gnu_coreutils_stty() else '-f'

Check failure on line 164 in scripts/west_commands/runners/bossac.py

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

E0602

scripts/west_commands/runners/bossac.py:164 Undefined variable 'is_gnu_coreutils_stty' (undefined-variable)

if self.is_extended_samba_protocol():
self.speed = '1200'
Expand Down

0 comments on commit d22de42

Please sign in to comment.