mirror of
https://github.com/GNS3/gns3-server
synced 2025-01-23 06:20:59 +00: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 asyncio
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import shutil
|
import shutil
|
||||||
import platformdirs
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -87,8 +86,14 @@ class ApplianceManager:
|
|||||||
Get the built-in appliance storage directory
|
Get the built-in appliance storage directory
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
try:
|
||||||
|
import platformdirs
|
||||||
appname = vendor = "GNS3"
|
appname = vendor = "GNS3"
|
||||||
appliances_dir = os.path.join(platformdirs.user_data_dir(appname, vendor, roaming=True), "appliances")
|
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:
|
if delete_first:
|
||||||
shutil.rmtree(appliances_dir, ignore_errors=True)
|
shutil.rmtree(appliances_dir, ignore_errors=True)
|
||||||
os.makedirs(appliances_dir, exist_ok=True)
|
os.makedirs(appliances_dir, exist_ok=True)
|
||||||
|
@ -11,7 +11,7 @@ psutil==5.9.5
|
|||||||
async-timeout>=4.0.2,<4.1
|
async-timeout>=4.0.2,<4.1
|
||||||
distro>=1.8.0
|
distro>=1.8.0
|
||||||
py-cpuinfo>=9.0.0,<10.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'
|
importlib-resources>=1.3; python_version <= '3.9'
|
||||||
truststore>=0.7.0; python_version >= '3.10'
|
truststore>=0.7.0; python_version >= '3.10'
|
||||||
setuptools>=60.8.1; python_version >= '3.7'
|
setuptools>=60.8.1; python_version >= '3.7'
|
||||||
|
Loading…
Reference in New Issue
Block a user