Browse Source

genlink: allow better usage as a tool

calling sys.exit directly is so so ruuude.

I'm not testing every path right now, but this is vastly better already.

Signed-off-by: Karl Palsson <karlp@tweak.au>
pull/1526/head
Karl Palsson 10 months ago
parent
commit
67a5b2af16
  1. 5
      scripts/genlink.py

5
scripts/genlink.py

@ -24,7 +24,7 @@ import re
import os
def get_device_data(data_file_path, device_id):
def get_device_data(data_file_path, device_id, exit_on_fail=True):
device = {
'info': {},
'defs': [],
@ -88,7 +88,10 @@ def get_device_data(data_file_path, device_id):
# device was not found
if len(device['family']) == 0:
if exit_on_fail:
sys.exit(1)
else:
return None
return device

Loading…
Cancel
Save