Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7124397
D4470.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D4470.diff
View Options
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -54,6 +54,7 @@
entry_points="""
[swh.workers]
loader.git=swh.loader.git:register
+ loader.git_disk=swh.loader.git:register_from_disk
""",
classifiers=[
"Programming Language :: Python :: 3",
diff --git a/swh/loader/git/__init__.py b/swh/loader/git/__init__.py
--- a/swh/loader/git/__init__.py
+++ b/swh/loader/git/__init__.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2019 The Software Heritage developers
+# Copyright (C) 2019-2020 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
@@ -13,3 +13,12 @@
"task_modules": ["%s.tasks" % __name__],
"loader": GitLoader,
}
+
+
+def register_from_disk() -> Dict[str, Any]:
+ from swh.loader.git.from_disk import GitLoaderFromDisk
+
+ return {
+ "task_modules": [],
+ "loader": GitLoaderFromDisk,
+ }
diff --git a/swh/loader/git/from_disk.py b/swh/loader/git/from_disk.py
--- a/swh/loader/git/from_disk.py
+++ b/swh/loader/git/from_disk.py
@@ -5,7 +5,6 @@
from collections import defaultdict
-import datetime
import os
import shutil
from typing import Any, Dict, Optional
@@ -390,25 +389,3 @@
self.log.info(
"Project %s - Done injecting %s" % (self.origin_url, self.repo_path)
)
-
-
-if __name__ == "__main__":
- import logging
-
- import click
-
- logging.basicConfig(
- level=logging.DEBUG, format="%(asctime)s %(process)d %(message)s"
- )
-
- @click.command()
- @click.option("--origin-url", help="origin url")
- @click.option("--git-directory", help="Path to git repository to load")
- @click.option("--visit-date", default=None, help="Visit date")
- def main(origin_url, git_directory, visit_date):
- if not visit_date:
- visit_date = datetime.datetime.now(tz=datetime.timezone.utc)
-
- return GitLoaderFromDisk().load(origin_url, git_directory, visit_date)
-
- main()
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Dec 21 2024, 10:07 AM (11 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3219990
Attached To
D4470: loader.git.from_disk: Register loader in `swh loader run` cli
Event Timeline
Log In to Comment