From 0b0faba5dfadef08ec02b6ebfadb738d581cb6f6 Mon Sep 17 00:00:00 2001 From: Michael Clemens Date: Wed, 2 Jun 2021 00:58:01 +0200 Subject: [PATCH] qrzlogger now uses setuptools for packaging and installation --- README.md | 4 +-- pyproject.toml | 6 +++++ setup.cfg | 33 +++++++++++++++++++++++ src/qrzlogger/__init__.py | 1 + qrzlogger.py => src/qrzlogger/__main__.py | 14 +++++++--- 5 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 pyproject.toml create mode 100644 setup.cfg create mode 100644 src/qrzlogger/__init__.py rename qrzlogger.py => src/qrzlogger/__main__.py (99%) diff --git a/README.md b/README.md index f0c6a08..8100957 100644 --- a/README.md +++ b/README.md @@ -22,10 +22,10 @@ qrzlogger needs the following libraries: * prettytable * colored -These libraries can be installed with the following command on Debian Linux based operating systems: +These libraries can be installed with the following commands: ``` -# sudo apt install python3-xmltodict python3-prettytable python3-colored +# sudo pip install xmltodict prettytable colored ``` Furthermore, you need at least the XML subscription from QRZ.com. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..374b58c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,6 @@ +[build-system] +requires = [ + "setuptools>=42", + "wheel" +] +build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..b84a465 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,33 @@ +[metadata] +name = qrzlogger +version = 0.6 +author = Michael Clemens +author_email = qrzlogger@qrz.is +description = A python application to log QSOs directly to QRZ.com from the command line +long_description = file: README.md +long_description_content_type = text/markdown +url = https://github.com/exitnode/qrzlogger +project_urls = + Bug Tracker = https://github.com/exitnode/qrzlogger/issues +classifiers = + Programming Language :: Python :: 3 + License :: OSI Approved :: MIT License + Operating System :: OS Independent + + +[options] +package_dir = + = src +packages = find: +python_requires = >=3.6 +install_requires= + xmltodict + prettytable + colored + +[options.packages.find] +where = src + +[options.entry_points] +console_scripts = + qrzlogger = qrzlogger.__main__:main diff --git a/src/qrzlogger/__init__.py b/src/qrzlogger/__init__.py new file mode 100644 index 0000000..5111553 --- /dev/null +++ b/src/qrzlogger/__init__.py @@ -0,0 +1 @@ +from qrzlogger.__main__ import QRZLogger diff --git a/qrzlogger.py b/src/qrzlogger/__main__.py similarity index 99% rename from qrzlogger.py rename to src/qrzlogger/__main__.py index d498e37..818c51a 100755 --- a/qrzlogger.py +++ b/src/qrzlogger/__main__.py @@ -19,6 +19,7 @@ import urllib import re import datetime import os +import sys import xmltodict from prettytable import PrettyTable from requests.structures import CaseInsensitiveDict @@ -27,7 +28,7 @@ from datetime import timezone import configparser from colored import fore, back, style -class qrzlogger(): +class QRZLogger(): # initialize things @@ -478,7 +479,7 @@ class qrzlogger(): print(" __ _ _ _ __| |___ __ _ __ _ ___ _ _ ") print(" / _` | '_|_ / / _ \/ _` / _` / -_) '_|") print(" \__, |_| /__|_\___/\__, \__, \___|_| ") - print(" |_| |___/|___/ " + style.RESET) + print(" |_| DL6MHC |___/|___/ v0.6 " + style.RESET) @@ -486,9 +487,10 @@ class qrzlogger(): # Main Routine # ##################################################### -if __name__ == '__main__': - q = qrzlogger() +def main(): + + q = QRZLogger() q.printBanner() keeponlogging = True @@ -581,3 +583,7 @@ if __name__ == '__main__': print(q.inputcol) print("73!") print(style.RESET) + + +if __name__ == "__main__": + sys.exit(main())