1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-13 02:30:11 +01:00

use appdirs to get easy cross-platform standard directories

This is more important to get right now, with `fdroid install`, which
should work easily on all platforms.
This commit is contained in:
Hans-Christoph Steiner 2024-03-13 21:05:04 +01:00 committed by Michael Pöhn
parent f003492574
commit 6781525ddd
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',