Merge remote-tracking branch 'origin/main'

This commit is contained in:
Timothyxxx
2024-05-09 02:05:22 +08:00

View File

@@ -7,6 +7,9 @@ import threading
import uuid
import zipfile
from time import sleep
import logging
logger = logging.getLogger("desktopenv.envinit")
import psutil
import requests
@@ -190,10 +193,12 @@ def _install_virtual_machine(vm_name, working_dir="./vm_data", downloaded_file_n
def __download_and_unzip_vm():
# Determine the platform and CPU architecture to decide the correct VM image to download
if platform.system() == 'Darwin': # macOS
if os.uname().machine == 'arm64': # Apple Silicon
url = UBUNTU_ARM_URL
else:
url = UBUNTU_X86_URL
#if os.uname().machine == 'arm64': # Apple Silicon
#url = UBUNTU_ARM_URL
#else:
#url = UBUNTU_X86_URL
url = UBUNTU_ARM_URL # a workout as most new macs are using apple silicon and they are frequently misrecognized as x86_64
logger.warning("Your platform is temporarily considered to be ARM. If this is a mistake, please manually replace the downloaded VM under ./vm_data with the VM of x86 version from %s", UBUNTU_X86_URL)
elif platform.machine().lower() in ['amd64', 'x86_64']:
url = UBUNTU_X86_URL
else: