From 7d1f309c391fd18a896acf8cb206e6b853a7853f Mon Sep 17 00:00:00 2001 From: David Verdeguer Date: Thu, 15 Oct 2020 11:56:40 +0200 Subject: [PATCH] Address comments --- python-setup/auto_install_packages.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/python-setup/auto_install_packages.py b/python-setup/auto_install_packages.py index 1a7f4358a..f0c102056 100755 --- a/python-setup/auto_install_packages.py +++ b/python-setup/auto_install_packages.py @@ -25,6 +25,8 @@ def _check_output(command): def install_packages_with_poetry(): command = [sys.executable, '-m', 'poetry'] if sys.platform.startswith('win32'): + # In windows the default path were the deps are installed gets wiped out between steps, + # so we have to set it up to a folder that will be kept os.environ['POETRY_VIRTUALENVS_PATH'] = os.path.join(os.environ['RUNNER_WORKSPACE'], 'virtualenvs') try: _check_call(command + ['install', '--no-root']) @@ -40,6 +42,8 @@ def install_packages_with_poetry(): python_executable_path = poetry_out.decode('utf-8').splitlines()[-1] if sys.platform.startswith('win32'): + # Poetry produces a path that starts by /d instead of D:\ and Windows doesn't like that way of specifying the drive letter. + # We completely remove it because it is not needed as everything is in the same drive (We are installing the dependencies in the RUNNER_WORKSPACE) python_executable_path = python_executable_path[2:] return python_executable_path @@ -47,6 +51,8 @@ def install_packages_with_poetry(): def install_packages_with_pipenv(): command = [sys.executable, '-m', 'pipenv'] if sys.platform.startswith('win32'): + # In windows the default path were the deps are installed gets wiped out between steps, + # so we have to set it up to a folder that will be kept os.environ['WORKON_HOME'] = os.path.join(os.environ['RUNNER_WORKSPACE'], 'virtualenvs') try: _check_call(command + ['install', '--keep-outdated', '--ignore-pipfile']) @@ -57,6 +63,8 @@ def install_packages_with_pipenv(): python_executable_path = pipenv_out.decode('utf-8').splitlines()[-1] if sys.platform.startswith('win32'): + # Pipenv produces a path that starts by /d instead of D:\ and Windows doesn't like that way of specifying the drive letter. + # We completely remove it because it is not needed as everything is in the same drive (We are installing the dependencies in the RUNNER_WORKSPACE) python_executable_path = python_executable_path[2:] return python_executable_path @@ -162,11 +170,6 @@ def install_packages(codeql_base_dir) -> Optional[str]: codeql_base_dir = sys.argv[1] - # The binaries for packages installed with `pip install --user` are not available on - # PATH by default, so we need to manually add them. - if sys.platform.startswith('linux'): - os.environ['PATH'] = os.path.expanduser('~/.local/bin') + os.pathsep + os.environ['PATH'] - python_executable_path = install_packages(codeql_base_dir) if python_executable_path is not None: