Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions eng/tools/azure-sdk-tools/ci_tools/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,21 @@ def build_packages(


def create_package(
setup_directory_or_file: str, dest_folder: str, enable_wheel: bool = True, enable_sdist: bool = True
setup_directory_or_file: str,
dest_folder: str,
enable_wheel: bool = True,
enable_sdist: bool = True,
use_cibuildwheel: bool = True,
):
"""
Uses the invoking python executable to build a wheel and sdist file given a setup.py or setup.py directory. Outputs
into a distribution directory and defaults to the value of get_artifact_directory().

When ``use_cibuildwheel`` is False, packages with C extension modules are built with the
invoking Python via ``setup.py bdist_wheel`` instead of ``cibuildwheel``. This is the
appropriate choice when the wheel is only consumed by the current venv (e.g. dev-requirement
installs in CI), since ``cibuildwheel`` otherwise downloads a fresh CPython from nuget.org
which is not reachable from all CI agents.
Comment on lines +231 to +235
"""

dist = get_artifact_directory(dest_folder)
Expand Down Expand Up @@ -263,7 +273,7 @@ def create_package(
)
else:
if enable_wheel:
if setup_parsed.ext_modules:
if setup_parsed.ext_modules and use_cibuildwheel:
run_logged(
[sys.executable, "-m", "cibuildwheel", "--output-dir", dist],
cwd=setup_parsed.folder,
Expand Down
7 changes: 6 additions & 1 deletion eng/tools/azure-sdk-tools/ci_tools/scenario/generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,12 @@ def build_whl_for_req(req: str, package_path: str, wheel_dir: Optional[str]) ->
os.mkdir(temp_dir)

logging.info("Building wheel for package {}".format(parsed.name))
create_package(req_pkg_path, temp_dir, enable_sdist=False)
# ``cibuildwheel`` is intended for producing release artifacts that span multiple
# Python versions; it downloads its own CPython from nuget.org which is not
# reachable from all CI agents. For dev-requirements builds the wheel only needs
# to install into the current venv, so opt out of ``cibuildwheel`` here and let
# ``setup.py bdist_wheel`` run with the invoking Python.
Comment on lines +354 to +357
create_package(req_pkg_path, temp_dir, enable_sdist=False, use_cibuildwheel=False)

whl_path = os.path.join(temp_dir, find_whl(temp_dir, parsed.name, parsed.version))

Expand Down
Loading