Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/run_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Set Version
id: version
run: if ("tag" -eq $Env:GITHUB_REF_TYPE) { echo "::set-output name=version::$Env:GITHUB_REF_NAME" } else { echo "::set-output name=version::$Env:GITHUB_SHA" }
Expand Down Expand Up @@ -67,6 +71,7 @@ jobs:
shell: cmd
- name: Install Emulator
run: |
pip install setuptools
pip install %GITHUB_WORKSPACE%\emulator\
cd %GITHUB_WORKSPACE%
.\emulator\brainflow_emulator\com0com\certmgr.exe /add %GITHUB_WORKSPACE%\emulator\brainflow_emulator\com0com\com0com.cer /s /r localMachine root
Expand Down
20 changes: 8 additions & 12 deletions emulator/brainflow_emulator/cyton_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import sys
import time

from importlib.resources import files
from pathlib import Path
from brainflow_emulator.emulate_common import TestFailureError, Listener, log_multilines
from serial import Serial

Expand All @@ -17,24 +17,20 @@ def read(port, num_bytes):
return port.read(num_bytes)


def get_isntaller():
try:
resource = files(__name__).joinpath('com0com').joinpath('setup_com0com_W7_x64_signed.exe')
return str(resource)
except (TypeError, AttributeError):
# Fallback for:
# 1. Python < 3.9 (importlib.resources.files not available)
# 2. NixOS/packaging edge cases where importlib.resources may not work
import pkg_resources
return pkg_resources.resource_filename(__name__, os.path.join('com0com', 'setup_com0com_W7_x64_signed.exe'))
def get_installer():
return str(
Path(__file__).resolve().parent
/ "com0com"
/ "setup_com0com_W7_x64_signed.exe"
)


def install_com0com():
this_directory = os.path.abspath(os.path.dirname(__file__))
directory = os.path.join(this_directory, 'com0com')
if not os.path.exists(directory):
os.makedirs(directory)
cmds = [get_isntaller(), '/NCRC', '/S', '/D=%s' % directory]
cmds = [get_installer(), '/NCRC', '/S', '/D=%s' % directory]
logging.info('running %s' % ' '.join(cmds))
p = subprocess.Popen(cmds, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
Expand Down
20 changes: 8 additions & 12 deletions emulator/brainflow_emulator/freeeeg32_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import sys
import time

from importlib.resources import files
from pathlib import Path
from brainflow_emulator.emulate_common import TestFailureError, log_multilines
from brainflow_emulator.freeeeg32_emulator import Listener
from serial import Serial
Expand All @@ -18,24 +18,20 @@ def read(port, num_bytes):
return port.read(num_bytes)


def get_isntaller():
try:
resource = files(__name__).joinpath('com0com').joinpath('setup_com0com_W7_x64_signed.exe')
return str(resource)
except (TypeError, AttributeError):
# Fallback for:
# 1. Python < 3.9 (importlib.resources.files not available)
# 2. NixOS/packaging edge cases where importlib.resources may not work
import pkg_resources
return pkg_resources.resource_filename(__name__, os.path.join('com0com', 'setup_com0com_W7_x64_signed.exe'))
def get_installer():
return str(
Path(__file__).resolve().parent
/ "com0com"
/ "setup_com0com_W7_x64_signed.exe"
)


def install_com0com():
this_directory = os.path.abspath(os.path.dirname(__file__))
directory = os.path.join(this_directory, 'com0com')
if not os.path.exists(directory):
os.makedirs(directory)
cmds = [get_isntaller(), '/NCRC', '/S', '/D=%s' % directory]
cmds = [get_installer(), '/NCRC', '/S', '/D=%s' % directory]
logging.info('running %s' % ' '.join(cmds))
p = subprocess.Popen(cmds, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
Expand Down
Loading