@@ -9,12 +9,48 @@ set -euo pipefail
99VENV_DIR=" $HOME /.local/share/silice/.venv"
1010SCRIPT_DIR=" $( cd " $( dirname " $0 " ) " && pwd) "
1111REQ_FILE=" $SCRIPT_DIR /requirements.txt"
12- # Create environment director
12+
13+ # Detect MinGW
14+ IS_MINGW=false
15+ case " ${MSYSTEM:- } " in
16+ MINGW32|MINGW64|MSYS|CLANG32|CLANG64|CLANGARM64|UCRT64)
17+ IS_MINGW=true
18+ ;;
19+ esac
20+ if [ " $IS_MINGW " = false ]; then
21+ case " $( uname -s 2> /dev/null) " in
22+ MINGW* |MSYS* |CYGWIN* )
23+ IS_MINGW=true
24+ ;;
25+ esac
26+ fi
27+
28+ # Create environment directory
1329mkdir -p " $( dirname " $VENV_DIR " ) "
30+
1431# Create the python environment
1532if [ ! -d " $VENV_DIR " ]; then
16- echo " Creating venv at $VENV_DIR "
33+ echo " Creating and setting up venv at $VENV_DIR , this can take a few minutes "
1734 python3 -m venv " $VENV_DIR "
1835fi
19- # Install
20- " $VENV_DIR /bin/pip" install --quiet -r " $REQ_FILE "
36+
37+ PIP=" $VENV_DIR /bin/pip"
38+
39+ if [ " $IS_MINGW " = true ]; then
40+ echo " MinGW environment detected — using apycula install workaround to avoid fastcrc and msgspec"
41+
42+ TMP_REQ=" $( mktemp /tmp/silice-req-XXXXXX.txt) "
43+ grep -v -iE ' ^(apycula|yowasp-nextpnr-himbaechel-gowin)' " $REQ_FILE " > " $TMP_REQ " || true
44+ " $PIP " install --quiet -r " $TMP_REQ "
45+ rm -f " $TMP_REQ "
46+
47+ # Pure-Python replacements for the C extensions apycula would normally pull
48+ " $PIP " install --quiet numpy msgpack cattrs
49+ # Install the two packages without dependency resolution so pip never
50+ # attempts to build fastcrc or msgspec from source
51+ " $PIP " install --quiet --no-deps apycula
52+ " $PIP " install --quiet --no-deps yowasp-nextpnr-himbaechel-gowin
53+ else
54+ # Normal install
55+ " $PIP " install --quiet -r " $REQ_FILE "
56+ fi
0 commit comments