convert to setuptools pkg

This commit is contained in:
Mirek Kratochvil 2025-10-13 17:54:54 +02:00
parent 3b1c98e1a5
commit f256ed31ca
3 changed files with 36 additions and 9 deletions

29
setup.py Normal file
View file

@ -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",
],
)

12
patchodon → src/patchodon/__init__.py Executable file → Normal file
View file

@ -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()

View file

@ -0,0 +1,4 @@
if __name__ == "__main__":
from .patchodon import main
main()