From d44533740c7084000819f1146537c38738ac9f00 Mon Sep 17 00:00:00 2001 From: aryasadeghi1 Date: Thu, 27 Aug 2026 12:19:42 +1000 Subject: [PATCH] [Build] Update build process to use PEP 517 frontend for wheel and source distribution --- Dockerfile.nanoserver | 5 +++-- scripts/release/pypi/build.sh | 11 +++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Dockerfile.nanoserver b/Dockerfile.nanoserver index b7ac434ebf4..84c4e751dc1 100644 --- a/Dockerfile.nanoserver +++ b/Dockerfile.nanoserver @@ -50,7 +50,8 @@ WORKDIR azure-cli USER ContainerUser RUN python -m pip install --upgrade pip -RUN pip install wheel +# `build` is the PEP 517 frontend used to build the wheels below. +RUN pip install wheel build SHELL ["pwsh.exe", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] @@ -65,7 +66,7 @@ foreach($f in $folder) \ { \ try { \ Push-Location $f; \ - & python.exe setup.py bdist_wheel -d $wheels; \ + & python.exe -m build --wheel --no-isolation --outdir $wheels; \ } \ finally { \ Pop-Location \ diff --git a/scripts/release/pypi/build.sh b/scripts/release/pypi/build.sh index 6ec8ea7ea1b..6857dbc9b70 100755 --- a/scripts/release/pypi/build.sh +++ b/scripts/release/pypi/build.sh @@ -17,8 +17,11 @@ echo "Branch $branch" echo "Search setup files from `pwd`." python --version -# Cap setuptools<81: 81 removes setup.py --dry-run and changes distutils command signatures (82 removes pkg_resources); `python setup.py bdist_wheel` below relies on setup.py. -pip install -U pip "setuptools<81" wheel +# Cap setuptools<81: setuptools 82 removes pkg_resources, which azure-cli still declares as a +# runtime dependency. The builds below go through the PEP 517 frontend, but --no-isolation means +# they use this setuptools too. +# `build` is that frontend. +pip install -U pip "setuptools<81" wheel build pip list script_dir=`cd $(dirname $BASH_SOURCE[0]); pwd` @@ -29,7 +32,7 @@ fi for setup_file in $(find src -name 'setup.py' | grep -v azure-cli-testsdk); do pushd `dirname $setup_file` - python setup.py bdist_wheel -d $BUILD_STAGINGDIRECTORY - python setup.py sdist -d $BUILD_STAGINGDIRECTORY + python -m build --wheel --no-isolation --outdir $BUILD_STAGINGDIRECTORY + python -m build --sdist --no-isolation --outdir $BUILD_STAGINGDIRECTORY popd done