tools: Add check for PIP_USER variable

Closes https://github.com/espressif/esp-idf/issues/7910
This commit is contained in:
Juraj Sadel
2021-11-29 14:03:21 +01:00
parent bd650062ca
commit 1e39970e91

View File

@ -1523,6 +1523,10 @@ def action_install_python_env(args): # type: ignore
subprocess.check_call([sys.executable, '-m', 'virtualenv', '--seeder', 'pip', idf_python_env_path],
stdout=sys.stdout, stderr=sys.stderr)
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.')
env_copy['PIP_USER'] = 'no'
run_args = [virtualenv_python, '-m', 'pip', 'install', '--no-warn-script-location']
requirements_txt = os.path.join(global_idf_path, 'requirements.txt')
run_args += ['-r', requirements_txt]
@ -1538,7 +1542,7 @@ def action_install_python_env(args): # type: ignore
run_args += ['--find-links', wheels_dir]
info('Installing Python packages from {}'.format(requirements_txt))
subprocess.check_call(run_args, stdout=sys.stdout, stderr=sys.stderr)
subprocess.check_call(run_args, stdout=sys.stdout, stderr=sys.stderr, env=env_copy)
def action_add_version(args): # type: ignore