@@ -99,16 +99,10 @@ def install_package_from_remote_requirements(url, venv=None, **kwargs):
|
||||
utils.exec_cmd(cmd, **kwargs)
|
||||
|
||||
|
||||
def setup_virtualenv(path, sudo_user=None, python_version=2):
|
||||
def setup_virtualenv(path, sudo_user=None):
|
||||
"""Install a virtualenv if needed."""
|
||||
if os.path.exists(path):
|
||||
return
|
||||
if python_version == 2:
|
||||
python_binary = "python"
|
||||
packages = ["python-virtualenv"]
|
||||
if utils.dist_name() == "debian":
|
||||
packages.append("virtualenv")
|
||||
else:
|
||||
if utils.dist_name().startswith("centos"):
|
||||
python_binary = "python3"
|
||||
packages = ["python3"]
|
||||
@@ -117,8 +111,5 @@ def setup_virtualenv(path, sudo_user=None, python_version=2):
|
||||
packages = ["python3-venv"]
|
||||
package.backend.install_many(packages)
|
||||
with utils.settings(sudo_user=sudo_user):
|
||||
if python_version == 2:
|
||||
utils.exec_cmd("virtualenv {}".format(path))
|
||||
else:
|
||||
utils.exec_cmd("{} -m venv {}".format(python_binary, path))
|
||||
install_packages(["pip", "setuptools\<58.0.0"], venv=path, upgrade=True)
|
||||
install_packages(["pip", "setuptools"], venv=path, upgrade=True)
|
||||
|
||||
@@ -56,8 +56,7 @@ class Automx(base.Installer):
|
||||
|
||||
def _setup_venv(self):
|
||||
"""Prepare a python virtualenv."""
|
||||
python.setup_virtualenv(
|
||||
self.venv_path, sudo_user=self.user, python_version=3)
|
||||
python.setup_virtualenv(self.venv_path, sudo_user=self.user)
|
||||
packages = [
|
||||
"future", "lxml", "ipaddress", "sqlalchemy < 2.0", "python-memcached",
|
||||
"python-dateutil", "configparser"
|
||||
|
||||
@@ -78,8 +78,7 @@ class Modoboa(base.Installer):
|
||||
|
||||
def _setup_venv(self):
|
||||
"""Prepare a dedicated virtualenv."""
|
||||
python.setup_virtualenv(
|
||||
self.venv_path, sudo_user=self.user, python_version=3)
|
||||
python.setup_virtualenv(self.venv_path, sudo_user=self.user)
|
||||
packages = ["rrdtool"]
|
||||
version = self.config.get("modoboa", "version")
|
||||
if version == "latest":
|
||||
|
||||
@@ -31,8 +31,7 @@ class Radicale(base.Installer):
|
||||
|
||||
def _setup_venv(self):
|
||||
"""Prepare a dedicated virtualenv."""
|
||||
python.setup_virtualenv(
|
||||
self.venv_path, sudo_user=self.user, python_version=3)
|
||||
python.setup_virtualenv(self.venv_path, sudo_user=self.user)
|
||||
packages = [
|
||||
"Radicale", "radicale-dovecot-auth", "pytz"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user