Skip to content

Commit 1f8442f

Browse files
docs: detailed fallback comments for NixOS/Python<3.9 compatibility
1 parent e178596 commit 1f8442f

6 files changed

Lines changed: 19 additions & 1 deletion

File tree

emulator/brainflow_emulator/cyton_windows.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ def get_isntaller():
2222
resource = files(__name__).joinpath('com0com').joinpath('setup_com0com_W7_x64_signed.exe')
2323
return str(resource)
2424
except (TypeError, AttributeError):
25+
# Fallback for:
26+
# 1. Python < 3.9 (importlib.resources.files not available)
27+
# 2. NixOS/packaging edge cases where importlib.resources may not work
2528
import pkg_resources
2629
return pkg_resources.resource_filename(__name__, os.path.join('com0com', 'setup_com0com_W7_x64_signed.exe'))
2730

emulator/brainflow_emulator/freeeeg32_windows.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ def get_isntaller():
2323
resource = files(__name__).joinpath('com0com').joinpath('setup_com0com_W7_x64_signed.exe')
2424
return str(resource)
2525
except (TypeError, AttributeError):
26+
# Fallback for:
27+
# 1. Python < 3.9 (importlib.resources.files not available)
28+
# 2. NixOS/packaging edge cases where importlib.resources may not work
2629
import pkg_resources
2730
return pkg_resources.resource_filename(__name__, os.path.join('com0com', 'setup_com0com_W7_x64_signed.exe'))
2831

emulator/brainflow_emulator/knightboard_windows.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ def get_isntaller():
2323
resource = files(__name__).joinpath('com0com').joinpath('setup_com0com_W7_x64_signed.exe')
2424
return str(resource)
2525
except (TypeError, AttributeError):
26+
# Fallback for:
27+
# 1. Python < 3.9 (importlib.resources.files not available)
28+
# 2. NixOS/packaging edge cases where importlib.resources may not work
2629
import pkg_resources
2730
return pkg_resources.resource_filename(__name__, os.path.join('com0com', 'setup_com0com_W7_x64_signed.exe'))
2831

python_package/brainflow/board_shim.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class BoardIds(enum.IntEnum):
2121
STREAMING_BOARD = -2 #:
2222
SYNTHETIC_BOARD = -1 #:
2323
CYTON_BOARD = 0 #:
24-
GANGLION_BOARD = 1 #:
24+
GANGLION_BOARD = 1 #:
2525
CYTON_DAISY_BOARD = 2 #:
2626
GALEA_BOARD = 3 #:
2727
GANGLION_WIFI_BOARD = 4 #:
@@ -177,6 +177,9 @@ def __init__(self):
177177
resource = files(__name__).joinpath(dll_path)
178178
full_path = str(resource)
179179
except (TypeError, AttributeError):
180+
# Fallback for:
181+
# 1. Python < 3.9 (importlib.resources.files not available)
182+
# 2. NixOS/packaging edge cases where importlib.resources may not work
180183
import pkg_resources
181184
full_path = pkg_resources.resource_filename(__name__, dll_path)
182185
if os.path.isfile(full_path):

python_package/brainflow/data_filter.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ def __init__(self):
157157
resource = files(__name__).joinpath(dll_path)
158158
full_path = str(resource)
159159
except (TypeError, AttributeError):
160+
# Fallback for:
161+
# 1. Python < 3.9 (importlib.resources.files not available)
162+
# 2. NixOS/packaging edge cases where importlib.resources may not work
160163
import pkg_resources
161164
full_path = pkg_resources.resource_filename(__name__, dll_path)
162165
if os.path.isfile(full_path):

python_package/brainflow/ml_model.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ def __init__(self):
8282
resource = files(__name__).joinpath(dll_path)
8383
full_path = str(resource)
8484
except (TypeError, AttributeError):
85+
# Fallback for:
86+
# 1. Python < 3.9 (importlib.resources.files not available)
87+
# 2. NixOS/packaging edge cases where importlib.resources may not work
8588
import pkg_resources
8689
full_path = pkg_resources.resource_filename(__name__, dll_path)
8790
if os.path.isfile(full_path):

0 commit comments

Comments
 (0)