66 lines
1.9 KiB
Diff
66 lines
1.9 KiB
Diff
diff --git a/gns3server/controller/__init__.py b/gns3server/controller/__init__.py
|
|
index 5c5236b9..971e3452 100644
|
|
--- a/gns3server/controller/__init__.py
|
|
+++ b/gns3server/controller/__init__.py
|
|
@@ -22,7 +22,11 @@ import uuid
|
|
import socket
|
|
import shutil
|
|
import aiohttp
|
|
-import importlib_resources
|
|
+
|
|
+try:
|
|
+ from importlib import resources as importlib_resources
|
|
+except ImportError:
|
|
+ import importlib_resources
|
|
|
|
from ..config import Config
|
|
from .project import Project
|
|
diff --git a/gns3server/controller/appliance_manager.py b/gns3server/controller/appliance_manager.py
|
|
index d15fc69b..41b73104 100644
|
|
--- a/gns3server/controller/appliance_manager.py
|
|
+++ b/gns3server/controller/appliance_manager.py
|
|
@@ -21,9 +21,13 @@ import json
|
|
import uuid
|
|
import asyncio
|
|
import aiohttp
|
|
-import importlib_resources
|
|
import shutil
|
|
|
|
+try:
|
|
+ from importlib import resources as importlib_resources
|
|
+except ImportError:
|
|
+ import importlib_resources
|
|
+
|
|
from .appliance import Appliance
|
|
from ..config import Config
|
|
from ..utils.asyncio import locking
|
|
diff --git a/gns3server/utils/get_resource.py b/gns3server/utils/get_resource.py
|
|
index b4b599bd..f4054cd3 100644
|
|
--- a/gns3server/utils/get_resource.py
|
|
+++ b/gns3server/utils/get_resource.py
|
|
@@ -19,7 +19,11 @@ import atexit
|
|
import logging
|
|
import os
|
|
import sys
|
|
-import importlib_resources
|
|
+
|
|
+try:
|
|
+ from importlib import resources as importlib_resources
|
|
+except ImportError:
|
|
+ import importlib_resources
|
|
|
|
from contextlib import ExitStack
|
|
resource_manager = ExitStack()
|
|
diff --git a/requirements.txt b/requirements.txt
|
|
index 53f1200d..5eda661b 100644
|
|
--- a/requirements.txt
|
|
+++ b/requirements.txt
|
|
@@ -11,6 +11,6 @@ psutil==5.9.2
|
|
async-timeout>=4.0.2,<4.1
|
|
distro>=1.7.0
|
|
py-cpuinfo>=9.0.0,<10.0
|
|
-importlib-resources>=1.3
|
|
+importlib-resources>=1.3; python_version < '3.9'
|
|
setuptools>=60.8.1; python_version >= '3.7'
|
|
setuptools==59.6.0; python_version < '3.7' # v59.6.0 is the last version to support Python 3.6
|