Skip to content

Commit 7d1f309

Browse files
committed
Address comments
1 parent 2c3dafc commit 7d1f309

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

python-setup/auto_install_packages.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ def _check_output(command):
2525
def install_packages_with_poetry():
2626
command = [sys.executable, '-m', 'poetry']
2727
if sys.platform.startswith('win32'):
28+
# In windows the default path were the deps are installed gets wiped out between steps,
29+
# so we have to set it up to a folder that will be kept
2830
os.environ['POETRY_VIRTUALENVS_PATH'] = os.path.join(os.environ['RUNNER_WORKSPACE'], 'virtualenvs')
2931
try:
3032
_check_call(command + ['install', '--no-root'])
@@ -40,13 +42,17 @@ def install_packages_with_poetry():
4042
python_executable_path = poetry_out.decode('utf-8').splitlines()[-1]
4143

4244
if sys.platform.startswith('win32'):
45+
# Poetry produces a path that starts by /d instead of D:\ and Windows doesn't like that way of specifying the drive letter.
46+
# 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)
4347
python_executable_path = python_executable_path[2:]
4448
return python_executable_path
4549

4650

4751
def install_packages_with_pipenv():
4852
command = [sys.executable, '-m', 'pipenv']
4953
if sys.platform.startswith('win32'):
54+
# In windows the default path were the deps are installed gets wiped out between steps,
55+
# so we have to set it up to a folder that will be kept
5056
os.environ['WORKON_HOME'] = os.path.join(os.environ['RUNNER_WORKSPACE'], 'virtualenvs')
5157
try:
5258
_check_call(command + ['install', '--keep-outdated', '--ignore-pipfile'])
@@ -57,6 +63,8 @@ def install_packages_with_pipenv():
5763
python_executable_path = pipenv_out.decode('utf-8').splitlines()[-1]
5864

5965
if sys.platform.startswith('win32'):
66+
# Pipenv produces a path that starts by /d instead of D:\ and Windows doesn't like that way of specifying the drive letter.
67+
# 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)
6068
python_executable_path = python_executable_path[2:]
6169
return python_executable_path
6270

@@ -162,11 +170,6 @@ def install_packages(codeql_base_dir) -> Optional[str]:
162170

163171
codeql_base_dir = sys.argv[1]
164172

165-
# The binaries for packages installed with `pip install --user` are not available on
166-
# PATH by default, so we need to manually add them.
167-
if sys.platform.startswith('linux'):
168-
os.environ['PATH'] = os.path.expanduser('~/.local/bin') + os.pathsep + os.environ['PATH']
169-
170173
python_executable_path = install_packages(codeql_base_dir)
171174

172175
if python_executable_path is not None:

0 commit comments

Comments
 (0)