update_manager: resolve pip location issues

If the supplied python executable is a symbolic link attempt
to read the location at which it points.   If this is a virtualenv
this should give us the correct pip location.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2022-05-01 11:44:49 -04:00
parent c24fd7d11c
commit b5e7a5ba5a
No known key found for this signature in database
GPG Key ID: 5A1EB336DFB4C71B
1 changed files with 9 additions and 3 deletions

View File

@ -5,6 +5,7 @@
# This file may be distributed under the terms of the GNU GPLv3 license.
from __future__ import annotations
import os
import pathlib
import shutil
import hashlib
@ -72,9 +73,14 @@ class AppDeploy(BaseDeploy):
self.executable = pathlib.Path(executable).expanduser()
self.pip_exe = self.executable.parent.joinpath("pip")
if not self.pip_exe.exists():
self.server.add_warning(
f"Update Manger {self.name}: Unable to locate pip "
"executable")
if self.executable.is_symlink():
self.executable = pathlib.Path(os.readlink(self.executable))
self.pip_exe = self.executable.parent.joinpath("pip")
if not self.pip_exe.exists():
logging.info(
f"Update Manger {self.name}: Unable to locate pip "
"executable")
self.pip_exe = None
self._verify_path(config, 'env', self.executable)
self.venv_args = config.get('venv_args', None)