Mercurial > libervia-backend
comparison sat/core/constants.py @ 3144:02325c3141dd
core (constants): parse `sat.conf` from `sat` module dir
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 29 Jan 2020 19:05:41 +0100 |
parents | 559a625a236b |
children | 3f414c897e70 |
comparison
equal
deleted
inserted
replaced
3143:830fce0db15d | 3144:02325c3141dd |
---|---|
21 from xdg import BaseDirectory | 21 from xdg import BaseDirectory |
22 from os.path import expanduser, realpath | 22 from os.path import expanduser, realpath |
23 except ImportError: | 23 except ImportError: |
24 BaseDirectory = None | 24 BaseDirectory = None |
25 import sat | 25 import sat |
26 from pathlib import Path | |
26 | 27 |
27 | 28 |
28 class Const(object): | 29 class Const(object): |
29 | 30 |
30 ## Application ## | 31 ## Application ## |
450 + Const.APP_NAME_FILE | 451 + Const.APP_NAME_FILE |
451 + ".conf" | 452 + ".conf" |
452 ] | 453 ] |
453 else: | 454 else: |
454 import os | 455 import os |
456 root_dir = Path(sat.__file__).parent | |
455 Const.CONFIG_PATHS = ( | 457 Const.CONFIG_PATHS = ( |
456 ["/etc/", "~/", "~/.", "", "."] | 458 ["/etc/", "~/", "~/.", "", root_dir, "."] |
457 + [ | 459 + [ |
458 "%s/" % path | 460 "%s/" % path |
459 for path in list(BaseDirectory.load_config_paths(Const.APP_NAME_FILE)) | 461 for path in list(BaseDirectory.load_config_paths(Const.APP_NAME_FILE)) |
460 ] | 462 ] |
461 ) | 463 ) |