|
5 | 5 |
|
6 | 6 | PYTHON_VERSION=$1
|
7 | 7 |
|
8 |
| -TEMP_FOLDER="$HOME/AppData/Local/Temp" |
9 |
| -WHEEL_PATH=$(ls -d $TEMP_FOLDER/**/*/repaired_wheel/*) |
10 |
| -WHEEL_NAME=$(basename $WHEEL_PATH) |
11 |
| - |
12 |
| -cp $WHEEL_PATH $WHEEL_NAME |
13 |
| - |
14 |
| -# Dot the Python version for identifying the base Docker image |
15 |
| -PYTHON_DOCKER_IMAGE_PART=$(echo ${PYTHON_VERSION:0:1}.${PYTHON_VERSION:1:2}) |
16 |
| - |
17 |
| -if [[ "$CIBW_PRERELEASE_PYTHONS" =~ [tT]rue ]]; then |
18 |
| - PYTHON_DOCKER_IMAGE_PART="${PYTHON_DOCKER_IMAGE_PART}-rc" |
| 8 | +FREE_THREADED_BUILD="$(python -c"import sysconfig; print(bool(sysconfig.get_config_var('Py_GIL_DISABLED')))")" |
| 9 | + |
| 10 | +if [[ $FREE_THREADED_BUILD == "False" ]]; then |
| 11 | + # Prepare a minimal Windows environement without any developer runtime libraries |
| 12 | + # installed to check that the scikit-learn wheel does not implicitly rely on |
| 13 | + # external DLLs when running the tests. |
| 14 | + TEMP_FOLDER="$HOME/AppData/Local/Temp" |
| 15 | + WHEEL_PATH=$(ls -d $TEMP_FOLDER/**/*/repaired_wheel/*) |
| 16 | + WHEEL_NAME=$(basename $WHEEL_PATH) |
| 17 | + |
| 18 | + cp $WHEEL_PATH $WHEEL_NAME |
| 19 | + |
| 20 | + # Dot the Python version for identifying the base Docker image |
| 21 | + PYTHON_DOCKER_IMAGE_PART=$(echo ${PYTHON_VERSION:0:1}.${PYTHON_VERSION:1:2}) |
| 22 | + |
| 23 | + if [[ "$CIBW_PRERELEASE_PYTHONS" =~ [tT]rue ]]; then |
| 24 | + PYTHON_DOCKER_IMAGE_PART="${PYTHON_DOCKER_IMAGE_PART}-rc" |
| 25 | + fi |
| 26 | + |
| 27 | + # We could have all of the following logic in a Dockerfile but it's a lot |
| 28 | + # easier to do it in bash rather than figure out how to do it in Powershell |
| 29 | + # inside the Dockerfile ... |
| 30 | + DOCKER_IMAGE="winamd64/python:${PYTHON_DOCKER_IMAGE_PART}-windowsservercore" |
| 31 | + MNT_FOLDER="C:/mnt" |
| 32 | + CONTAINER_ID=$(docker run -it -v "$(cygpath -w $PWD):$MNT_FOLDER" -d $DOCKER_IMAGE) |
| 33 | + |
| 34 | + function exec_inside_container() { |
| 35 | + docker exec $CONTAINER_ID powershell -Command $1 |
| 36 | + } |
| 37 | + |
| 38 | + exec_inside_container "python -m pip install $MNT_FOLDER/$WHEEL_NAME" |
| 39 | + exec_inside_container "python -m pip install $CIBW_TEST_REQUIRES" |
| 40 | + |
| 41 | + # Save container state to scikit-learn/minimal-windows image. On Windows the |
| 42 | + # container needs to be stopped first. |
| 43 | + docker stop $CONTAINER_ID |
| 44 | + docker commit $CONTAINER_ID scikit-learn/minimal-windows |
| 45 | +else |
| 46 | + # This is too cumbersome to use a Docker image in the free-threaded case |
| 47 | + # TODO Remove the next three lines when scipy and pandas each have a release |
| 48 | + # with a Windows free-threaded wheel. |
| 49 | + python -m pip install numpy |
| 50 | + dev_anaconda_url=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple |
| 51 | + python -m pip install --pre --upgrade --timeout=60 --extra-index $dev_anaconda_url scipy pandas --only-binary :all: |
| 52 | + python -m pip install $CIBW_TEST_REQUIRES |
19 | 53 | fi
|
20 |
| - |
21 |
| -# We could have all of the following logic in a Dockerfile but it's a lot |
22 |
| -# easier to do it in bash rather than figure out how to do it in Powershell |
23 |
| -# inside the Dockerfile ... |
24 |
| -DOCKER_IMAGE="winamd64/python:${PYTHON_DOCKER_IMAGE_PART}-windowsservercore" |
25 |
| -MNT_FOLDER="C:/mnt" |
26 |
| -CONTAINER_ID=$(docker run -it -v "$(cygpath -w $PWD):$MNT_FOLDER" -d $DOCKER_IMAGE) |
27 |
| - |
28 |
| -function exec_inside_container() { |
29 |
| - docker exec $CONTAINER_ID powershell -Command $1 |
30 |
| -} |
31 |
| - |
32 |
| -exec_inside_container "python -m pip install $MNT_FOLDER/$WHEEL_NAME" |
33 |
| -exec_inside_container "python -m pip install $CIBW_TEST_REQUIRES" |
34 |
| - |
35 |
| -# Save container state to scikit-learn/minimal-windows image. On Windows the |
36 |
| -# container needs to be stopped first. |
37 |
| -docker stop $CONTAINER_ID |
38 |
| -docker commit $CONTAINER_ID scikit-learn/minimal-windows |
|
0 commit comments