Add capability for python-venv to use --upgrade

Fixes #27
This commit is contained in:
Olivier 'reivilibre' 2021-07-03 08:41:47 +01:00
parent dc2a127ab4
commit 99d4ff5d6b

View File

@ -51,6 +51,8 @@ class PythonVenv(Recipe):
self.no_apt_install = check_type(args.get("_no_apt_install", False), bool) self.no_apt_install = check_type(args.get("_no_apt_install", False), bool)
self.upgrade = check_type(args.get("upgrade", False), bool)
# TODO(sdists) # TODO(sdists)
def prepare(self, preparation: Preparation, head: Head): def prepare(self, preparation: Preparation, head: Head):
@ -80,6 +82,10 @@ class PythonVenv(Recipe):
await exec_no_fails(kitchen, [self.interpreter, "-m", "venv", self.dir], "/") await exec_no_fails(kitchen, [self.interpreter, "-m", "venv", self.dir], "/")
install_args = [] install_args = []
if self.upgrade:
install_args.append("--upgrade")
for name, flags in self.install: for name, flags in self.install:
if "-r" in flags: if "-r" in flags:
install_args.append("-r") install_args.append("-r")