Merge branch 'appdirs' into 'master'

use appdirs to get easy cross-platform standard directories

See merge request fdroid/fdroidserver!1457
This commit is contained in:
Michael Pöhn 2024-03-14 12:44:10 +00:00
commit f7ca36a66b
2 changed files with 18 additions and 1 deletions

View File

@ -134,11 +134,27 @@ env = None
orig_path = None
def get_default_cachedir():
"""Get a cachedir, using appdirs for cross-platform, but works without.
Once appdirs is installed everywhere, this function can be
removed.
"""
appname = __name__.split('.')[0]
try:
import appdirs
return appdirs.user_cache_dir(appname, 'F-Droid')
except ImportError:
return str(Path.home() / '.cache' / appname)
# All paths in the config must be strings, never pathlib.Path instances
default_config = {
'sdk_path': "$ANDROID_HOME",
'ndk_paths': {},
'cachedir': str(Path.home() / '.cache/fdroidserver'),
'cachedir': get_default_cachedir(),
'java_paths': None,
'scan_binary': False,
'ant': "ant",

View File

@ -91,6 +91,7 @@ setup(
'babel',
],
install_requires=[
'appdirs',
'androguard >= 3.1.0, != 3.3.0, != 3.3.1, != 3.3.2, <4',
'clint',
'defusedxml',