Skip to content

Commit 46e02cc

Browse files
authored
windows: fix fcntl import (commaai#2329)
* windows: fix fcntl import * fix indentation * add windows ci * make sure CI catches import error * Revert "make sure CI catches import error" This reverts commit b18043a.
1 parent 0ef2c72 commit 46e02cc

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

.github/workflows/test.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,22 @@ jobs:
4444
- uses: actions/checkout@v4
4545
- run: ./test.sh
4646

47+
windows:
48+
name: windows pip package test
49+
runs-on: windows-latest
50+
timeout-minutes: 10
51+
steps:
52+
- uses: actions/checkout@v4
53+
- uses: actions/setup-python@v5
54+
with:
55+
python-version: "3.12"
56+
- uses: astral-sh/setup-uv@v5
57+
- name: Install package with uv
58+
run: uv pip install --system .
59+
- name: Verify importing panda
60+
run: python -c "from panda import Panda"
61+
62+
4763
misra_linter:
4864
name: MISRA C:2012 Linter
4965
runs-on: ubuntu-latest

python/spi.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import binascii
22
import os
3-
import fcntl
43
import math
54
import time
65
import struct
@@ -12,6 +11,13 @@
1211
from .constants import McuType, MCU_TYPE_BY_IDCODE, USBPACKET_MAX_SIZE
1312
from .utils import logger
1413

14+
# No fcntl on Windows
15+
try:
16+
import fcntl
17+
except ImportError:
18+
fcntl = None # type: ignore
19+
20+
# No spidev on MacOS/Windows
1521
try:
1622
import spidev
1723
except ImportError:

0 commit comments

Comments
 (0)