From 98ac2f2335e5b6ac384379650f3ff90bda3ac048 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Fri, 8 Jul 2022 07:48:02 -0300 Subject: [PATCH] [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. --- kibot/dep_downloader.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kibot/dep_downloader.py b/kibot/dep_downloader.py index 73a68cff..89cde6af 100644 --- a/kibot/dep_downloader.py +++ b/kibot/dep_downloader.py @@ -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)