mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-11-16 16:54:51 +02:00
Only use platformdirs with Python >= '3.7'
This commit is contained in:
parent
df2f96828e
commit
090d1c8c84
@ -21,7 +21,6 @@ import uuid
|
||||
import asyncio
|
||||
import aiohttp
|
||||
import shutil
|
||||
import platformdirs
|
||||
|
||||
|
||||
try:
|
||||
@ -87,8 +86,14 @@ class ApplianceManager:
|
||||
Get the built-in appliance storage directory
|
||||
"""
|
||||
|
||||
appname = vendor = "GNS3"
|
||||
appliances_dir = os.path.join(platformdirs.user_data_dir(appname, vendor, roaming=True), "appliances")
|
||||
try:
|
||||
import platformdirs
|
||||
appname = vendor = "GNS3"
|
||||
appliances_dir = os.path.join(platformdirs.user_data_dir(appname, vendor, roaming=True), "appliances")
|
||||
except ImportError:
|
||||
# platformdirs is not available on Python 3.6, use the old method
|
||||
config = Config.instance()
|
||||
appliances_dir = os.path.join(config.config_dir, "appliances")
|
||||
if delete_first:
|
||||
shutil.rmtree(appliances_dir, ignore_errors=True)
|
||||
os.makedirs(appliances_dir, exist_ok=True)
|
||||
|
@ -11,7 +11,7 @@ psutil==5.9.5
|
||||
async-timeout>=4.0.2,<4.1
|
||||
distro>=1.8.0
|
||||
py-cpuinfo>=9.0.0,<10.0
|
||||
platformdirs>=3.10.0
|
||||
platformdirs>=3.10.0; python_version >= '3.7'
|
||||
importlib-resources>=1.3; python_version <= '3.9'
|
||||
truststore>=0.7.0; python_version >= '3.10'
|
||||
setuptools>=60.8.1; python_version >= '3.7'
|
||||
|
Loading…
Reference in New Issue
Block a user