Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI Remove remaining windows 32 references #24657

Merged
merged 7 commits into from Oct 20, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/wheels.yml
Expand Up @@ -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
Expand Down
8 changes: 0 additions & 8 deletions build_tools/github/build_minimal_windows_image.sh
Expand Up @@ -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/*)
Expand Down
3 changes: 1 addition & 2 deletions build_tools/github/repair_windows_wheels.sh
Expand Up @@ -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"
1 change: 0 additions & 1 deletion build_tools/github/test_windows_wheels.sh
Expand Up @@ -4,7 +4,6 @@ set -e
set -x

PYTHON_VERSION=$1
BITNESS=$2

docker container run \
--rm scikit-learn/minimal-windows \
Expand Down
80 changes: 16 additions & 64 deletions build_tools/github/vendor.py
Expand Up @@ -20,47 +20,6 @@
MSVCP140_SRC_PATH = "C:\\Windows\\System32\\msvcp140.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,
Expand Down Expand Up @@ -114,18 +73,18 @@ 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}.")

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.exists(MSVCP140_SRC_PATH) and bitness == "64":
if not op.exists(MSVCP140_SRC_PATH):
raise ValueError(f"Could not find {MSVCP140_SRC_PATH}.")

if not op.isdir(wheel_dirname):
Expand All @@ -149,29 +108,22 @@ 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)

print(f"Copying {MSVCP140_SRC_PATH} to {target_folder}.")
shutil.copy2(MSVCP140_SRC_PATH, target_folder)
print(f"Copying {MSVCP140_SRC_PATH} to {target_folder}.")
shutil.copy2(MSVCP140_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,
msvcp140_dll_filename,
)
make_distributor_init_64_bits(
ogrisel marked this conversation as resolved.
Show resolved Hide resolved
distributor_init,
vcomp140_dll_filename,
vcruntime140_dll_filename,
vcruntime140_1_dll_filename,
msvcp140_dll_filename,
)


if __name__ == "__main__":
_, wheel_file, bitness = sys.argv
main(wheel_file, bitness)
_, wheel_file = sys.argv
main(wheel_file)