diff --git a/doc/use-cases/windows-pytables-wheel.sh b/doc/use-cases/windows-pytables-wheel.sh index f38beb0..9842ce3 100755 --- a/doc/use-cases/windows-pytables-wheel.sh +++ b/doc/use-cases/windows-pytables-wheel.sh @@ -12,53 +12,64 @@ set -e # Install prerequisites. -# Microsoft Visual C++ Build Tools 2015 14.0.25420.1 -# https://community.chocolatey.org/packages/microsoft-visual-cpp-build-tools -# Microsoft Build Tools 2015 (Install) -# https://community.chocolatey.org/packages/microsoft-build-tools-2015 -#choco install --yes microsoft-visual-cpp-build-tools --install-arguments="'/InstallSelectableItems Win81SDK_CppBuildSKUV1;VisualCppBuildTools_ATLMFC_SDK'" -choco install --yes microsoft-visual-cpp-build-tools --install-arguments="'/Full'" - # Miniconda - A minimal installer for Anaconda. # https://conda.io/miniconda.html -# https://community.chocolatey.org/packages/miniconda3 -choco install --yes miniconda3 --package-parameters="'/AddToPath:1'" +scoop bucket add extras +scoop install miniconda3 +#export PATH="$PATH:/c/Users/ContainerAdministrator/scoop/apps/miniconda3/current/condabin" +#alias conda=conda.bat +#/c/Users/ContainerAdministrator/scoop/apps/miniconda3/current/condabin/conda.bat init bash +source /c/Users/ContainerAdministrator/scoop/apps/miniconda3/current/Scripts/activate +conda --version + +# /c/Users/ContainerAdministrator/scoop/apps/miniconda3/4.12.0/Scripts/conda.exe # TODO: `/AddToPath:1` seems to not work, so adjust `$PATH` manually. -export PATH="$PATH:/c/Tools/miniconda3/condabin" +#export PATH="$PATH:/c/Tools/miniconda3/condabin" # TODO: At least within Bash, just addressing `conda` does not work. -export conda="conda.bat" +#export conda="conda.bat" -# cibuildwheel - Build Python wheels for all the platforms on CI with minimal configuration. -# https://cibuildwheel.readthedocs.io/ -pip install --upgrade cibuildwheel # Check prerequisites. -echo $PATH -$conda --version +#echo $PATH +#$conda --version # cibuildwheel --version -# Acquire sources. -mkdir -p /c/src -cd /c/src -test ! -d PyTables && git clone https://github.com/PyTables/PyTables --recursive --depth=1 -cd PyTables - # Pretend to be on a build matrix. export MATRIX_ARCH=win_amd64 # win32 export MATRIX_ARCH_SUBDIR=win-64 # win-32 +# Activate and prepare Anaconda environment for building. +conda create --yes --name=build +conda activate build +conda config --env --set subdir ${MATRIX_ARCH_SUBDIR} + +# Install needed libraries. +conda install --yes blosc bzip2 hdf5 lz4 lzo snappy zstd zlib + +# Install cibuildwheel. +# Build Python wheels for all the platforms on CI with minimal configuration. +# https://cibuildwheel.readthedocs.io/ +pip install --upgrade cibuildwheel + # Configure cibuildwheel. -export CIBW_BUILD="cp36-${MATRIX_ARCH} cp37-${MATRIX_ARCH} cp38-${MATRIX_ARCH} cp39-${MATRIX_ARCH} cp310-${MATRIX_ARCH}" -export CIBW_BEFORE_ALL_WINDOWS="$conda create --yes --name=build && $conda activate build && $conda config --env --set subdir ${MATRIX_ARCH_SUBDIR} && $conda install --yes blosc bzip2 hdf5 lz4 lzo snappy zstd zlib" -export CIBW_ENVIRONMENT_WINDOWS='CONDA_PREFIX="C:\\Miniconda\\envs\\build" PATH="$PATH;C:\\Miniconda\\envs\\build\\Library\\bin"' +#export CIBW_BUILD="cp36-${MATRIX_ARCH} cp37-${MATRIX_ARCH} cp38-${MATRIX_ARCH} cp39-${MATRIX_ARCH} cp310-${MATRIX_ARCH}" +export CIBW_BUILD="cp39-${MATRIX_ARCH}" +#export CIBW_BEFORE_ALL_WINDOWS="conda create --yes --name=build && conda activate build && conda config --env --set subdir ${MATRIX_ARCH_SUBDIR} && conda install --yes blosc bzip2 hdf5 lz4 lzo snappy zstd zlib" +#export CIBW_ENVIRONMENT_WINDOWS='CONDA_PREFIX="C:\\Miniconda\\envs\\build" PATH="$PATH;C:\\Miniconda\\envs\\build\\Library\\bin"' export CIBW_ENVIRONMENT="PYTABLES_NO_EMBEDDED_LIBS=true DISABLE_AVX2=true" -export CIBW_BEFORE_BUILD="pip install -r requirements.txt cython>=0.29.21 delvewheel" +export CIBW_BEFORE_BUILD="echo $PATH; pip install -r requirements.txt cython>=0.29.21 delvewheel" export CIBW_REPAIR_WHEEL_COMMAND_WINDOWS="delvewheel repair -w {dest_dir} {wheel}" # Debugging. # env +# Acquire sources. +mkdir -p /c/src +cd /c/src +test ! -d PyTables && git clone https://github.com/PyTables/PyTables --recursive --depth=1 +cd PyTables + # Build wheel. cibuildwheel --platform=windows --output-dir=wheelhouse diff --git a/doc/winrunner.rst b/doc/winrunner.rst index 010c19d..03baf6f 100644 --- a/doc/winrunner.rst +++ b/doc/winrunner.rst @@ -8,17 +8,18 @@ About ***** Launch an interactive command prompt (cmd, PowerShell, or Bash) within a -Windows environment (2016, 2019, or 2022) or invoke programs +Windows environment (2016, 2019, or 2022), or invoke programs non-interactively. Features ======== - The subsystem is heavily based on the excellent `Windows Docker Machine`_. -- The package manager `Chocolatey`_ is pre-installed on the container images - where PowerShell is available. +- The `Scoop`_ package manager is pre-installed on the container images + where PowerShell is available. The `Chocolatey`_ package manager can be + installed on demand. - Programs like ``busybox``, ``curl``, ``git``, ``nano``, and ``wget`` are - pre-installed on the container images where `Chocolatey`_ is available. + pre-installed on the container images where `Scoop`_ is available. - The `Windows container version compatibility`_ problem is conveniently solved by automatically selecting the right machine matching the requested container image. @@ -190,7 +191,7 @@ Install and run `Winfetch`_:: racker --verbose run --rm \ --platform=windows/amd64 mcr.microsoft.com/windows/servercore:ltsc2022 -- \ - cmd /C 'choco install --yes --force winfetch & refreshenv & winfetch' + cmd /C 'scoop install winfetch & winfetch' .. figure:: https://user-images.githubusercontent.com/453543/173195228-b75c8727-7187-4c38-ae28-f74098dfb450.png :width: 800 @@ -463,6 +464,7 @@ The whole software catalog can be inquired at `Chocolatey community packages`_. .. _Midnight Commander: https://en.wikipedia.org/wiki/Midnight_Commander .. _Overview of System Center release options: https://docs.microsoft.com/en-us/system-center/ltsc-and-sac-overview .. _Python: https://www.python.org/ +.. _Scoop: https://scoop.sh/ .. _Using Racker and Postroj for CrateDB CI: https://github.com/cicerops/racker/blob/main/doc/cratedb.rst .. _Vagrant: https://www.vagrantup.com/ .. _VirtualBox: https://www.virtualbox.org/ diff --git a/postroj/winrunner.Dockerfile b/postroj/winrunner.Dockerfile index 05da7b3..6468d74 100644 --- a/postroj/winrunner.Dockerfile +++ b/postroj/winrunner.Dockerfile @@ -3,22 +3,44 @@ # # Provision a Windows operating system image. # -# - Install the FOSS version of the Chocolatey package manager. -# - Install additional software using Chocolatey. +# - Install the Scoop package manager. +# - Install additional software using Scoop. +# - https://scoop.sh/ # ARG BASE_IMAGE FROM ${BASE_IMAGE} -# Install the Chocolatey package manager. -RUN powershell -Command Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) +# Restore the default Windows shell for correct batch processing. +SHELL ["cmd", "/S", "/C"] + +# Install the Scoop package manager. +# https://github.com/ScoopInstaller/Install#for-admin +RUN powershell -Command irm get.scoop.sh -outfile 'scoop-install.ps1'; .\scoop-install.ps1 -RunAsAdmin + +# Install/update Aria2 and Git first, to speed up downloads and have it up-to-date. +RUN scoop install aria2 git # Install essential and convenience programs. -RUN choco install --yes busybox curl nano wget -RUN choco install --yes git --package-parameters="'/GitAndUnixToolsOnPath /Editor:Nano'" +RUN scoop install msys2 zip unzip + +# Make MSYS2 programs available on the program search path. +# Note: It is not fully installed. In order to complete it, run `msys2` once. +RUN powershell $msys_path = $(scoop prefix msys2); [Environment]::SetEnvironmentVariable('Path', $env:Path + ';' + $msys_path + '\usr\bin', 'Machine') -# Rename Windows-native programs in favor of Chocolatey-installed/FOSS/GNU ones. +# Display the program search path. +#RUN powershell echo (Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' -Name Path).Path + +# Rename Windows-native programs in favor of Scoop-installed/FOSS/GNU ones. # An alternative would be to manipulate `$PATH`, but that is more tedious. RUN sh -c 'test -f /c/Windows/system32/curl && mv /c/Windows/system32/curl /c/Windows/system32/curl-win' RUN sh -c 'test -f /c/Windows/system32/convert && mv /c/Windows/system32/convert /c/Windows/system32/convert-ntfs' + +# TODO: With PowerShell 7, it is possible to remove the corresponding aliases. +#Remove-Alias -Name ls +#Remove-Alias -Name cat +#Remove-Alias -Name mv +#Remove-Alias -Name ps +#Remove-Alias -Name pwd +#Remove-Alias -Name rm