From 46e02cc5b0b3434a00b80aefaa97b26bcb297dfe Mon Sep 17 00:00:00 2001 From: Willem Melching Date: Sun, 15 Feb 2026 20:18:42 +0100 Subject: [PATCH] windows: fix fcntl import (#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 b18043ac767f64dd544582931b7b0d29c4c478f3. --- .github/workflows/test.yaml | 16 ++++++++++++++++ python/spi.py | 8 +++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 82bc23455..175788faa 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -44,6 +44,22 @@ jobs: - uses: actions/checkout@v4 - run: ./test.sh + windows: + name: windows pip package test + runs-on: windows-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + - uses: astral-sh/setup-uv@v5 + - name: Install package with uv + run: uv pip install --system . + - name: Verify importing panda + run: python -c "from panda import Panda" + + misra_linter: name: MISRA C:2012 Linter runs-on: ubuntu-latest diff --git a/python/spi.py b/python/spi.py index 4275017ed..0e31ce1d7 100644 --- a/python/spi.py +++ b/python/spi.py @@ -1,6 +1,5 @@ import binascii import os -import fcntl import math import time import struct @@ -12,6 +11,13 @@ from .base import BaseHandle, BaseSTBootloaderHandle, TIMEOUT from .constants import McuType, MCU_TYPE_BY_IDCODE, USBPACKET_MAX_SIZE from .utils import logger +# No fcntl on Windows +try: + import fcntl +except ImportError: + fcntl = None # type: ignore + +# No spidev on MacOS/Windows try: import spidev except ImportError: