From f5fb36bd3e1f6503c33c2d7bec511e29d4b17438 Mon Sep 17 00:00:00 2001 From: "Thomas J. Fan" Date: Thu, 13 Oct 2022 15:17:58 -0400 Subject: [PATCH 1/4] MNT Remove remaining windows 32 references --- .github/workflows/wheels.yml | 6 +- .../github/build_minimal_windows_image.sh | 8 --- build_tools/github/repair_windows_wheels.sh | 3 +- build_tools/github/test_windows_wheels.sh | 1 - build_tools/github/vendor.py | 71 ++++--------------- 5 files changed, 16 insertions(+), 73 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index c5cad72a6d5a5..a8e5a1c937fc1 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -137,11 +137,11 @@ jobs: CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }} CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.manylinux_image }} CIBW_TEST_SKIP: "*-macosx_arm64" - CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: bash build_tools/github/repair_windows_wheels.sh {wheel} {dest_dir} ${{ matrix.bitness }} - CIBW_BEFORE_TEST_WINDOWS: bash build_tools/github/build_minimal_windows_image.sh ${{ matrix.python }} ${{ matrix.bitness }} + CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: bash build_tools/github/repair_windows_wheels.sh {wheel} {dest_dir} + CIBW_BEFORE_TEST_WINDOWS: bash build_tools/github/build_minimal_windows_image.sh ${{ matrix.python }} CIBW_TEST_REQUIRES: pytest pandas threadpoolctl CIBW_TEST_COMMAND: bash {project}/build_tools/github/test_wheels.sh - CIBW_TEST_COMMAND_WINDOWS: bash {project}/build_tools/github/test_windows_wheels.sh ${{ matrix.python }} ${{ matrix.bitness }} + CIBW_TEST_COMMAND_WINDOWS: bash {project}/build_tools/github/test_windows_wheels.sh ${{ matrix.python }} CIBW_BUILD_VERBOSITY: 1 run: bash build_tools/github/build_wheels.sh diff --git a/build_tools/github/build_minimal_windows_image.sh b/build_tools/github/build_minimal_windows_image.sh index af17c7223498d..4399bfa80704e 100755 --- a/build_tools/github/build_minimal_windows_image.sh +++ b/build_tools/github/build_minimal_windows_image.sh @@ -4,14 +4,6 @@ set -e set -x PYTHON_VERSION=$1 -BITNESS=$2 - -if [[ "$BITNESS" == "32" ]]; then - # 32-bit architectures are not supported - # by the official Docker images: Tests will just be run - # on the host (instead of the minimal Docker container). - exit 0 -fi TEMP_FOLDER="$HOME/AppData/Local/Temp" WHEEL_PATH=$(ls -d $TEMP_FOLDER/**/*/repaired_wheel/*) diff --git a/build_tools/github/repair_windows_wheels.sh b/build_tools/github/repair_windows_wheels.sh index de564fc177c89..cdd0c0c79d8c4 100755 --- a/build_tools/github/repair_windows_wheels.sh +++ b/build_tools/github/repair_windows_wheels.sh @@ -5,12 +5,11 @@ set -x WHEEL=$1 DEST_DIR=$2 -BITNESS=$3 # By default, the Windows wheels are not repaired. # In this case, we need to vendor VCRUNTIME140.dll wheel unpack "$WHEEL" WHEEL_DIRNAME=$(ls -d scikit_learn-*) -python build_tools/github/vendor.py "$WHEEL_DIRNAME" "$BITNESS" +python build_tools/github/vendor.py "$WHEEL_DIRNAME" wheel pack "$WHEEL_DIRNAME" -d "$DEST_DIR" rm -rf "$WHEEL_DIRNAME" diff --git a/build_tools/github/test_windows_wheels.sh b/build_tools/github/test_windows_wheels.sh index 38875b159506c..43a1a283e652c 100755 --- a/build_tools/github/test_windows_wheels.sh +++ b/build_tools/github/test_windows_wheels.sh @@ -4,7 +4,6 @@ set -e set -x PYTHON_VERSION=$1 -BITNESS=$2 docker container run \ --rm scikit-learn/minimal-windows \ diff --git a/build_tools/github/vendor.py b/build_tools/github/vendor.py index bbc941d8f25f7..4aca65e8a398f 100644 --- a/build_tools/github/vendor.py +++ b/build_tools/github/vendor.py @@ -19,47 +19,6 @@ VCRUNTIME140_1_SRC_PATH = "C:\\Windows\\System32\\vcruntime140_1.dll" -def make_distributor_init_32_bits( - distributor_init, vcomp140_dll_filename, vcruntime140_dll_filename -): - """Create a _distributor_init.py file for 32-bit architectures. - - This file is imported first when importing the sklearn package - so as to pre-load the vendored vcomp140.dll and vcruntime140.dll. - """ - with open(distributor_init, "wt") as f: - f.write( - textwrap.dedent( - """ - '''Helper to preload vcomp140.dll and vcruntime140.dll to - prevent "not found" errors. - - Once vcomp140.dll and vcruntime140.dll are preloaded, the - namespace is made available to any subsequent vcomp140.dll - and vcruntime140.dll. This is created as part of the scripts - that build the wheel. - ''' - - - import os - import os.path as op - from ctypes import WinDLL - - - if os.name == "nt": - # Load vcomp140.dll and vcruntime140.dll - libs_path = op.join(op.dirname(__file__), ".libs") - vcomp140_dll_filename = op.join(libs_path, "{0}") - vcruntime140_dll_filename = op.join(libs_path, "{1}") - WinDLL(op.abspath(vcomp140_dll_filename)) - WinDLL(op.abspath(vcruntime140_dll_filename)) - """.format( - vcomp140_dll_filename, vcruntime140_dll_filename - ) - ) - ) - - def make_distributor_init_64_bits( distributor_init, vcomp140_dll_filename, @@ -109,7 +68,7 @@ def make_distributor_init_64_bits( ) -def main(wheel_dirname, bitness): +def main(wheel_dirname): """Embed vcomp140.dll, vcruntime140.dll and vcruntime140_1.dll.""" if not op.exists(VCOMP140_SRC_PATH): raise ValueError(f"Could not find {VCOMP140_SRC_PATH}.") @@ -117,7 +76,7 @@ def main(wheel_dirname, bitness): if not op.exists(VCRUNTIME140_SRC_PATH): raise ValueError(f"Could not find {VCRUNTIME140_SRC_PATH}.") - if not op.exists(VCRUNTIME140_1_SRC_PATH) and bitness == "64": + if not op.exists(VCRUNTIME140_1_SRC_PATH): raise ValueError(f"Could not find {VCRUNTIME140_1_SRC_PATH}.") if not op.isdir(wheel_dirname): @@ -140,25 +99,19 @@ def main(wheel_dirname, bitness): print(f"Copying {VCRUNTIME140_SRC_PATH} to {target_folder}.") shutil.copy2(VCRUNTIME140_SRC_PATH, target_folder) - if bitness == "64": - print(f"Copying {VCRUNTIME140_1_SRC_PATH} to {target_folder}.") - shutil.copy2(VCRUNTIME140_1_SRC_PATH, target_folder) + print(f"Copying {VCRUNTIME140_1_SRC_PATH} to {target_folder}.") + shutil.copy2(VCRUNTIME140_1_SRC_PATH, target_folder) # Generate the _distributor_init file in the source tree print("Generating the '_distributor_init.py' file.") - if bitness == "32": - make_distributor_init_32_bits( - distributor_init, vcomp140_dll_filename, vcruntime140_dll_filename - ) - else: - make_distributor_init_64_bits( - distributor_init, - vcomp140_dll_filename, - vcruntime140_dll_filename, - vcruntime140_1_dll_filename, - ) + make_distributor_init_64_bits( + distributor_init, + vcomp140_dll_filename, + vcruntime140_dll_filename, + vcruntime140_1_dll_filename, + ) if __name__ == "__main__": - _, wheel_file, bitness = sys.argv - main(wheel_file, bitness) + _, wheel_file = sys.argv + main(wheel_file) From 79ed3f4db4a6ba62a5698bfbec9f94cb84a9fa59 Mon Sep 17 00:00:00 2001 From: "Thomas J. Fan" Date: Thu, 13 Oct 2022 15:19:32 -0400 Subject: [PATCH 2/4] CI [cd build gh] From ff489b957a8ebe910f5d75c543dccec60022836a Mon Sep 17 00:00:00 2001 From: "Thomas J. Fan" Date: Sat, 15 Oct 2022 10:49:04 -0400 Subject: [PATCH 3/4] CI [cd build gh] From cb4ab0c379eaceeee4063fdb20d428e3cf3ecc96 Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Thu, 20 Oct 2022 11:49:23 +0200 Subject: [PATCH 4/4] Trigger CD for GitHub actions only [cd build gh]