aboutsummaryrefslogtreecommitdiffstats
path: root/common.py
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2024-06-02 13:24:45 +0200
committerGuilhem Moulin <guilhem@fripost.org>2024-06-02 13:32:31 +0200
commitd25c8b8b60fbfabf7544a3a5a44c105f0bc5b4da (patch)
treed585855351e9d31efe071b0cb569038de026f3dd /common.py
parente3e32f7f39e168139cb987ef98d05ab09d0419f5 (diff)
Rename script into module and run module.download().
Instead of using a dedicated executable. There is too much code duplicate otherwise.
Diffstat (limited to 'common.py')
-rw-r--r--common.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/common.py b/common.py
index e4456af..44c8a53 100644
--- a/common.py
+++ b/common.py
@@ -7,10 +7,8 @@ from stat import S_ISDIR
from xdg.BaseDirectory import xdg_config_home
import logging
import yaml
-import __main__ as main
def load_config(path=None, groupnames=None):
- main_script = os.path.basename(main.__file__)
if path is None:
for p in [Path(),
Path(xdg_config_home).joinpath('webmap'),
@@ -36,14 +34,14 @@ def load_config(path=None, groupnames=None):
download = source.get('download', None)
if download is None:
url = None
- script = None
+ dl_module = None
elif isinstance(download, str):
url = download
- script = None
+ dl_module = None
source['download'] = download = { 'url': url }
else:
url = download.get('url', None)
- script = download.get('script', None)
+ dl_module = download.get('module', None)
if url is None:
urlp = None
else:
@@ -73,9 +71,9 @@ def load_config(path=None, groupnames=None):
cache = Path(cache)
source['cache']['path'] = cache
- v = { 'url': urlp, 'script': main_script if script is None else script }
+ v = { 'url': urlp, 'module': dl_module }
if cache in destinations and destinations[cache] != v:
- # allow destination conflicts, but only when the source URL and script match
+ # allow destination conflicts, but only when the source URL and module match
raise Exception(f'Destination conflict for layer "{name}"')
destinations[cache] = v