[Dependencies] Forced pip -U to behave in a consistent way

- Debian patches pip/distutils in a way that "pip -U" behaves
  differently when executed by root. Instead of installing to
  site.USER_BASE it installs to /usr/local.
  So now we send -U to pip, but we also send site.USER_BASE
  using --root and --prefix
  This makes pip to install in the same way for regular users
  and root. This allows running the CI/CD tests in a consisten
  way.
This commit is contained in:
Salvador E. Tropea 2022-07-08 07:48:02 -03:00
parent 314989cd1b
commit 98ac2f2335
1 changed files with 4 additions and 1 deletions

View File

@ -235,7 +235,10 @@ def check_pip():
def pip_install(pip_command, dest=None, name='.'):
cmd = [pip_command, 'install', '-U', '--no-warn-script-location', name]
cmd = [pip_command, 'install', '-U', '--no-warn-script-location',
# This is what -U (--user) means, but Debian's pip installs to /usr/local when used by root
'--root', os.path.dirname(site.USER_BASE), '--prefix', os.path.basename(site.USER_BASE),
name]
logger.debug('- Running: {}'.format(cmd))
try:
res_run = subprocess.run(cmd, check=True, capture_output=True, cwd=dest)