From cb31db90f7e0f301f7afc89830956bc90d9af78f Mon Sep 17 00:00:00 2001 From: usmannasir Date: Sat, 28 Jun 2025 17:52:18 +0500 Subject: [PATCH] add support for ubuntu 24 --- CyberCP/settings.py | 19 +++++++++++++++++++ install/install.py | 11 +++++++++++ requirments.txt | 1 + 3 files changed, 31 insertions(+) diff --git a/CyberCP/settings.py b/CyberCP/settings.py index 0226e657c..8958a012f 100644 --- a/CyberCP/settings.py +++ b/CyberCP/settings.py @@ -10,6 +10,25 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.11/ref/settings/ """ +# Fix for botocore.vendored.six.moves import error +import sys +try: + import six +except ImportError: + pass +else: + # Create a compatibility shim for botocore.vendored + if 'botocore' not in sys.modules: + import botocore + if not hasattr(sys.modules.get('botocore', None), 'vendored'): + import types + vendored = types.ModuleType('vendored') + vendored.six = six + sys.modules['botocore'].vendored = vendored + sys.modules['botocore.vendored'] = vendored + sys.modules['botocore.vendored.six'] = six + sys.modules['botocore.vendored.six.moves'] = six.moves + import os from django.utils.translation import gettext_lazy as _ diff --git a/install/install.py b/install/install.py index a0ebf64ff..4adf12372 100644 --- a/install/install.py +++ b/install/install.py @@ -720,6 +720,17 @@ password="%s" os.chdir("/usr/local/CyberCP") + # Clear Python cache to avoid botocore vendored six import errors + command = "find /usr/local/CyberCP -name '*.pyc' -delete" + preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) + + command = "find /usr/local/CyberCP -name '__pycache__' -type d -exec rm -rf {} +" + preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) + + # Ensure six module is installed to fix botocore compatibility + command = "/usr/local/CyberPanel/bin/python -m pip install six==1.16.0" + preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) + command = "/usr/local/CyberPanel/bin/python manage.py makemigrations" preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) diff --git a/requirments.txt b/requirments.txt index 18ab241e5..352f26891 100644 --- a/requirments.txt +++ b/requirments.txt @@ -6,6 +6,7 @@ cloudflare==2.20.0 cryptography==43.0.0 cffi Django==4.2.14 +six==1.16.0 docker==7.1.0 google-api-core==2.19.1 google-api-python-client==2.139.0