Explorar o código

tools: Add check for PIP_USER variable
Closes https://github.com/espressif/esp-idf/issues/7910

Juraj Sadel %!s(int64=4) %!d(string=hai) anos
pai
achega
e7ee43bdb5
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      tools/idf_tools.py

+ 5 - 1
tools/idf_tools.py

@@ -1247,13 +1247,17 @@ 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]
     if args.extra_wheels_dir:
         run_args += ['--find-links', args.extra_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):