aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Arakaki Giovanini <mail@gabrielgio.me>2022-10-14 23:14:19 +0200
committerGabriel Arakaki Giovanini <mail@gabrielgio.me>2022-10-14 23:14:19 +0200
commita43c49511ba01aea3713def375455af3f3c45396 (patch)
tree9adcd7952623760c4e02db4981f137145537e06f
parent808f20882341cfe7c31399cfa20373f1d70f71da (diff)
downloadreddit-nextcloud-importer-a43c49511ba01aea3713def375455af3f3c45396.tar.gz
reddit-nextcloud-importer-a43c49511ba01aea3713def375455af3f3c45396.tar.bz2
reddit-nextcloud-importer-a43c49511ba01aea3713def375455af3f3c45396.zip
fix: Fix the whole package setup
-rw-r--r--pyproject.toml6
-rw-r--r--reddit-nextcloud-importer/__init__.py0
-rw-r--r--reddit_nextcloud_importer/__init__.py (renamed from reddit-nextcloud-importer/__main__.py)2
-rw-r--r--reddit_nextcloud_importer/__main__.py6
4 files changed, 12 insertions, 2 deletions
diff --git a/pyproject.toml b/pyproject.toml
index 48967ff..adde93c 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -7,7 +7,7 @@ repository = "https://git.sr.ht/~gabrielgio/reddit-nextcloud-importer"
description = "Reddit to Nextcloud importer"
authors = ["Gabriel Arakaki Giovanini <mail@gabielgio.me>"]
packages = [
- { include = "reddit-nextcloud-importer" }
+ { include = "reddit_nextcloud_importer" }
]
[tool.poetry.dependencies]
@@ -25,6 +25,10 @@ coverage = "^6.3.2"
pytest-mock = "^3.7.0"
pytest-cov = "^3.0.0"
+
+[tool.poetry.scripts]
+reddit-nextcloud-importer = "reddit_nextcloud_importer:main"
+
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
diff --git a/reddit-nextcloud-importer/__init__.py b/reddit-nextcloud-importer/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/reddit-nextcloud-importer/__init__.py
+++ /dev/null
diff --git a/reddit-nextcloud-importer/__main__.py b/reddit_nextcloud_importer/__init__.py
index abddfdd..6097ef4 100644
--- a/reddit-nextcloud-importer/__main__.py
+++ b/reddit_nextcloud_importer/__init__.py
@@ -100,7 +100,7 @@ def download(url) -> [str]:
return files
-if __name__ == "__main__":
+def main():
args = parser.parse_args()
level = levels.get(args.log_level.lower())
diff --git a/reddit_nextcloud_importer/__main__.py b/reddit_nextcloud_importer/__main__.py
new file mode 100644
index 0000000..8fe4a7f
--- /dev/null
+++ b/reddit_nextcloud_importer/__main__.py
@@ -0,0 +1,6 @@
+import sys
+
+import reddit_nextcloud_importer
+
+if __name__ == "__main__":
+ sys.exit(reddit_nextcloud_importer.main())