forked from platypush/platypush
to_pkg_install_commands
should skip already installed sys packages.
This commit is contained in:
parent
449821673c
commit
f230fa79bb
1 changed files with 19 additions and 13 deletions
|
@ -353,19 +353,25 @@ class Dependencies:
|
||||||
|
|
||||||
wants_sudo = not (self._is_docker or os.getuid() == 0)
|
wants_sudo = not (self._is_docker or os.getuid() == 0)
|
||||||
pkg_manager = self.pkg_manager or PackageManagers.scan()
|
pkg_manager = self.pkg_manager or PackageManagers.scan()
|
||||||
|
|
||||||
if self.packages and pkg_manager:
|
if self.packages and pkg_manager:
|
||||||
|
installed_packages = pkg_manager.value.get_installed()
|
||||||
|
to_install = sorted(
|
||||||
|
pkg
|
||||||
|
for pkg in self.packages # type: ignore
|
||||||
|
if pkg not in installed_packages
|
||||||
|
and not (
|
||||||
|
self.install_context == InstallContext.VENV
|
||||||
|
and self._is_python_pkg(pkg)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
if to_install:
|
||||||
yield ' '.join(
|
yield ' '.join(
|
||||||
[
|
[
|
||||||
*(['sudo'] if wants_sudo else []),
|
*(['sudo'] if wants_sudo else []),
|
||||||
*pkg_manager.value.install,
|
*pkg_manager.value.install,
|
||||||
*sorted(
|
*to_install,
|
||||||
pkg
|
|
||||||
for pkg in self.packages # type: ignore
|
|
||||||
if not (
|
|
||||||
self.install_context == InstallContext.VENV
|
|
||||||
and self._is_python_pkg(pkg)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue