Skip to content

Fix to retry virtualenv for pypi #250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/fosslight_dependency/package_manager/Pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,23 @@ def create_virtualenv(self):
ret = False
err_msg = e
finally:
try:
if self.platform != const.WINDOWS:
ret = True
create_venv_cmd = f"virtualenv -p python3 {self.venv_tmp_dir}"

cmd_list = [create_venv_cmd, activate_cmd, install_cmd, deactivate_cmd]
cmd = cmd_separator.join(cmd_list)
cmd_ret = subprocess.run(cmd, shell=True, stderr=subprocess.PIPE)
if cmd_ret.returncode != 0:
ret = False
err_msg = f"return code({cmd_ret.returncode})"
elif cmd_ret.stderr.decode('utf-8').rstrip().startswith('ERROR:'):
ret = False
err_msg = f"stderr msg({cmd_ret.stderr})"
except Exception as e:
ret = False
err_msg = e
if ret:
logger.info(f"It created the temporary virtualenv({venv_path}).")
else:
Expand Down
Loading