Skip to content

Commit

Permalink
Tools: Keep making virtual environments with python in the bin directory
Browse files Browse the repository at this point in the history
On Ubuntu 22.04 virtualenv with the latest setuptools produces
environments with Python in "local/bin" instead of "bin" (see
pypa/virtualenv#2350).

Closes #9931
  • Loading branch information
dobairoland committed Oct 14, 2022
1 parent 6e42e60 commit 158df60
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tools/idf_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1393,8 +1393,15 @@ def action_install_python_env(args): # type: ignore
subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--user', 'virtualenv'],
stdout=sys.stdout, stderr=sys.stderr)

env_copy = os.environ.copy()
# Virtualenv with setuptools>=60 produces on recent Debian/Ubuntu systems virtual environments with
# local/bin/python paths. SETUPTOOLS_USE_DISTUTILS=stdlib is a workaround to keep bin/python paths.
# See https://github.com/pypa/setuptools/issues/3278 for more information.
env_copy['SETUPTOOLS_USE_DISTUTILS'] = 'stdlib'
subprocess.check_call([sys.executable, '-m', 'virtualenv', '--seeder', 'pip', idf_python_env_path],
stdout=sys.stdout, stderr=sys.stderr)
stdout=sys.stdout, stderr=sys.stderr,
env=env_copy)

env_copy = os.environ.copy()
if env_copy.get('PIP_USER') == 'yes':
warn('Found PIP_USER="yes" in the environment. Disabling PIP_USER in this shell to install packages into a virtual environment.')
Expand Down

0 comments on commit 158df60

Please sign in to comment.