aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--setup.py29
-rw-r--r--[-rwxr-xr-x]src/patchodon/__init__.py (renamed from patchodon)12
-rw-r--r--src/patchodon/__main__.py4
3 files changed, 36 insertions, 9 deletions
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..5da755b
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,29 @@
+from setuptools import setup
+
+setup(
+ name="patchodon",
+ version="0.1.0",
+ description="Send and receive git patchsets via Mastodon",
+ url="https://gitlab.com/exaexa/patchodon",
+ author="Mirek Kratochvil",
+ author_email="exa.exa@gmail.com",
+ license="GPLv3+",
+ packages=["patchodon"],
+ install_requires=[
+ "requests>=2.25",
+ "html2text>=2025",
+ ],
+ classifiers=[
+ "Development Status :: 4 - BetaIntended Audience :: Science/Research",
+ (
+ "License :: OSI Approved :: GNU General Public License v3 or later"
+ " (GPLv3+)"
+ ),
+ "Operating System :: POSIX",
+ "Operating System :: Unix",
+ "Programming Language :: Python :: 3",
+ "Topic :: Communications",
+ "Topic :: Software Development :: Version Control :: Git",
+ "Topic :: Utilities",
+ ],
+)
diff --git a/patchodon b/src/patchodon/__init__.py
index bd668fa..894c071 100755..100644
--- a/patchodon
+++ b/src/patchodon/__init__.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+__version__ = "0.1.0"
import argparse
import hashlib
@@ -15,8 +15,6 @@ from pathlib import Path
# should specify next hash to provide some kind of a filter
# visibility public+unlisted, all unlisted, all private, all direct
-VERSION = "0.1.0"
-
DPASTE_URL = "https://dpaste.com" # TODO any good way to parametrize this?
STATUS_LENGTH_LIMIT = 400 # TODO obtain from instance
@@ -84,7 +82,7 @@ def do_pastebin_file(file):
"title": os.path.basename(file),
"expiry_days": 1, # TODO remove after testing
},
- headers={"User-agent": f"patchodon v{VERSION}"},
+ headers={"User-agent": f"patchodon v{__version__}"},
)
time.sleep(1.1)
if r.status_code != 201:
@@ -275,7 +273,7 @@ def do_get(args):
def main():
ap = argparse.ArgumentParser(
prog=sys.argv[0],
- epilog="patchodon.py version " + VERSION + " is a free software.",
+ epilog="patchodon.py version " + __version__ + " is a free software.",
description="Publicly send and receive git patch series via Mastodon.",
)
@@ -381,7 +379,3 @@ def main():
do_get(args)
else:
raise ("fatal: args borked")
-
-
-if __name__ == "__main__":
- main()
diff --git a/src/patchodon/__main__.py b/src/patchodon/__main__.py
new file mode 100644
index 0000000..9cba653
--- /dev/null
+++ b/src/patchodon/__main__.py
@@ -0,0 +1,4 @@
+if __name__ == "__main__":
+ from .patchodon import main
+
+ main()