diff --git a/bin/swh-loader-dir b/bin/swh-loader-dir deleted file mode 100755 index 2d681fc..0000000 --- a/bin/swh-loader-dir +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env python3 - -# NOT FOR PRODUCTION - -# Copyright (C) 2015 The Software Heritage developers -# See the AUTHORS file at the top-level directory of this distribution -# License: GNU General Public License version 3, or any later version -# See top-level LICENSE file for more information - -import logging -import sys - - -from swh.loader.dir.loader import DirLoader -from swh.core import config - -config_filename = sys.argv[1] - -logging.basicConfig( - level=logging.DEBUG, - format='%(asctime)s %(name)s %(levelname)s %(message)s', - handlers=[ - logging.StreamHandler() - ], -) - -requests_log = logging.getLogger("requests") -requests_log.setLevel(logging.CRITICAL) - - -def load_keys_from_properties(conf, key_pattern): - """Load keys from the dictionary conf which match the key_pattern. - - """ - m = { - key[len(key_pattern):]: value - for key, value in conf.items() - if key.startswith(key_pattern) - } - return m - - -# full configuration needed to instantiate misc objects (release, -# revision, etc...) -simple_config = config.read(config_filename) - -dir_path = simple_config['dir_path'] - -origin = load_keys_from_properties(simple_config, 'origin_') - -release = load_keys_from_properties(simple_config, 'release_') -release['date'] = int(release['date']) # hackish - -revision = load_keys_from_properties(simple_config, 'revision_') -revision['committer_date'] = int(revision['committer_date']) # hackish -revision['author_date'] = int(revision['author_date']) # hackish - -occurrence_2 = load_keys_from_properties(simple_config, 'occurrence2_') -occurrence = load_keys_from_properties(simple_config, 'occurrence_') - -dir_loader_config = DirLoader.parse_config_file(config_filename) -loader = DirLoader(dir_loader_config) -loader.process(dir_path, origin, revision, release, [occurrence, occurrence_2])