Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compat. with Ubuntu 24.04 #557

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 8 additions & 17 deletions modoboa_installer/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,26 +99,17 @@ 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")
if utils.dist_name().startswith("centos"):
python_binary = "python3"
packages = ["python3"]
else:
if utils.dist_name().startswith("centos"):
python_binary = "python3"
packages = ["python3"]
else:
python_binary = "python3"
packages = ["python3-venv"]
python_binary = "python3"
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)
utils.exec_cmd("{} -m venv {}".format(python_binary, path))
install_packages(["pip", "setuptools"], venv=path, upgrade=True)
3 changes: 1 addition & 2 deletions modoboa_installer/scripts/automx.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ def get_template_context(self):

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"
Expand Down
3 changes: 1 addition & 2 deletions modoboa_installer/scripts/modoboa.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ def is_extension_ok_for_version(self, extension, version):

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":
Expand Down
3 changes: 1 addition & 2 deletions modoboa_installer/scripts/radicale.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ def __init__(self, *args, **kwargs):

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"
]
Expand Down