Skip to content

Commit

Permalink
python: Avoid no-build-isolation for 3p deps
Browse files Browse the repository at this point in the history
Pip installs should not use --no-build-isolation for 3rd party Python
packages that have C/C++ extensions.

Change-Id: Ia9744343ff59ed442617a89c612efafd473b3ac3
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/103100
Commit-Queue: Anthony DiGirolamo <[email protected]>
Reviewed-by: Wyatt Hepler <[email protected]>
  • Loading branch information
AnthonyDiGirolamo authored and CQ Bot Account committed Jul 21, 2022
1 parent 06ef7e2 commit 328ae2e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
10 changes: 6 additions & 4 deletions pw_build/python.gni
Original file line number Diff line number Diff line change
Expand Up @@ -517,10 +517,12 @@ template("pw_python_package") {
args = [
"install",

# This speeds up pip installs. At this point in the gn build the
# virtualenv is already activated so build isolation isn't required.
# This requires that pip, setuptools, and wheel packages are
# installed.
# This speeds up pip installs. Build isolation isn't required for
# in-tree packages unless that package includes C/C++ extension
# modules:
# https://setuptools.pypa.io/en/latest/userguide/ext_modules.html
# For packages witout extensions this option requires that pip,
# setuptools, and wheel packages are available.
"--no-build-isolation",
]

Expand Down
10 changes: 5 additions & 5 deletions pw_build/python_venv.gni
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ template("pw_python_venv") {
_skip_installing_external_python_deps = true
args = [
"install",
"--no-build-isolation",
"wheel",
]
inputs = _constraints
Expand All @@ -190,10 +189,11 @@ template("pw_python_venv") {
module = "pip"
_pw_internal_run_in_venv = true
_skip_installing_external_python_deps = true
args = [
"install",
"--no-build-isolation",
]
args = [ "install" ]

# Note: --no-build-isolation should be avoided for installing 3rd party
# Python packages that use C/C++ extension modules.
# https://setuptools.pypa.io/en/latest/userguide/ext_modules.html
inputs = _constraints + _requirements

# Constraints
Expand Down
5 changes: 4 additions & 1 deletion pw_env_setup/py/pw_env_setup/virtualenv_setup/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,10 @@ def pip_install(*args):
requirements = constraints

if requirements:
requirement_args = ['--no-build-isolation']
requirement_args = []
# Note: --no-build-isolation should be avoided for installing 3rd party
# Python packages that use C/C++ extension modules.
# https://setuptools.pypa.io/en/latest/userguide/ext_modules.html
requirement_args.extend('--requirement={}'.format(req)
for req in requirements)
combined_requirement_args = requirement_args + constraint_args
Expand Down

0 comments on commit 328ae2e

Please sign in to comment.