diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2024-06-02 13:24:45 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2024-06-02 13:32:31 +0200 |
commit | d25c8b8b60fbfabf7544a3a5a44c105f0bc5b4da (patch) | |
tree | d585855351e9d31efe071b0cb569038de026f3dd /common.py | |
parent | e3e32f7f39e168139cb987ef98d05ab09d0419f5 (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.py | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -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 |