Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/gnu/loader.py
- This file was added.
# Copyright (C) 2019 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 os | |||||
from swh.loader.base.loader import BaseLoader | |||||
from swh.loader.base.dowload import compareField | |||||
class GNULoader(BaseLoader, compareField): | |||||
loader_name = 'gnu' | |||||
class_name = 'GNULoader' | |||||
compare_field = 'date' | |||||
anlambert: Here you should add these:
```lang=python
CONFIG_BASE_FILENAME = 'loader/gnu'
ADDITIONAL_CONFIG… | |||||
nahimilegaUnsubmitted Not Done Inline ActionsThis was present in base loader class itself, it would assign config filename and some default config entries on the bases of loader name. but after a discussion with @ardumont in IRC and via these comments(https://forge.softwareheritage.org/D1694?id=5884#inline-11570 ) it was removed.
What should I do? nahimilega: This was present in base loader class itself, it would assign config filename and some default… | |||||
def __init__(self): | |||||
BaseLoader.__init__(self) | |||||
compareField.__init__(self) | |||||
def convert_to_standard_format(self, **kwargs): | |||||
anlambertUnsubmitted Not Done Inline Actionsanlambert: cf https://forge.softwareheritage.org/D1694#inline-11749 | |||||
return { | |||||
'name': kwargs['name'], | |||||
'origin_url': kwargs['origin_url'], | |||||
'tarballs': kwargs['tarballs'], | |||||
} | |||||
def branch_name(self, version): | |||||
"""Find branch name | |||||
Args: | |||||
version (dict): All the data related to a particular version | |||||
Returns: | |||||
Branch name encoded in ascii | |||||
""" | |||||
return os.path.basename(version['url']).encode('ascii') |
Here you should add these:
in order to declare the config filename and some default config entries for the loader.