Added install_cmds to the JSON representation of a manifest.

This commit is contained in:
Fabio Manganiello 2023-10-17 02:11:13 +02:00
parent 9769520e88
commit e40a74f11c
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -279,6 +279,7 @@ class Dependencies:
'packages': list(self.packages), 'packages': list(self.packages),
'pip': self.pip, 'pip': self.pip,
'after': self.after, 'after': self.after,
'install_cmd': list(self.to_install_commands()),
} }
@property @property
@ -418,7 +419,6 @@ class Dependencies:
dependencies on the system. dependencies on the system.
""" """
wants_sudo = not (self._is_docker or is_root())
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:
@ -436,9 +436,9 @@ class Dependencies:
if to_install: if to_install:
yield ' '.join( yield ' '.join(
[ [
*(['sudo'] if wants_sudo else []), *(['sudo'] if self._wants_sudo else []),
*pkg_manager.value.install, *pkg_manager.value.install,
*to_install, '\\\n '.join(to_install),
] ]
) )
@ -466,13 +466,14 @@ class Dependencies:
deps = sorted(self.pip) deps = sorted(self.pip)
if full_command: if full_command:
yield ( yield (
'pip install -U --no-input --no-cache-dir ' 'pip install -U --no-input '
+ ('--no-cache-dir ' if self._is_docker else '')
+ ( + (
'--break-system-packages ' '--break-system-packages '
if wants_break_system_packages if wants_break_system_packages
else '' else ''
) )
+ ' '.join(deps) + ' \\\n '.join(deps)
) )
else: else:
for dep in deps: for dep in deps: