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