From 0331bd7df712ab1a6260a7a41bda00b0e4d9bd2f Mon Sep 17 00:00:00 2001 From: randogoth Date: Sun, 28 May 2023 22:02:51 +0300 Subject: [PATCH] made package --- README.md | 10 ++++++++-- loratransmit/__init__.py | 1 + loratransmit/loratransmit.py | 2 +- setup.py | 26 ++++++++++++++++++++++++++ 4 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 setup.py diff --git a/README.md b/README.md index afd0591..ebbe7fb 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,12 @@ Simple commandline raw LoRa packet transmitter for [RNode](https://unsigned.io/a It's meant to be complementary to the packet sniffer [LoRaMon](https://github.com/markqvist/LoRaMon) and uses the latest [Python Module](https://github.com/markqvist/RNode_Firmware/tree/master/Python%20Module) that comes with the [RNode Firmware](https://github.com/markqvist/RNode_Firmware). +## Install + +``` +$ pip install loratransmit +``` + ## Usage provide payload as command line argument or via pipe @@ -33,11 +39,11 @@ options: Payload passed as argument ``` -$ /bin/python3 loratransmit.py --freq 917500000 /dev/ttyACM0 "Hello World" +$ loratransmit --freq 917500000 /dev/ttyACM0 "Hello World" ``` Payload passed through pipe ``` -$ echo "Hello World" | /bin/python3 loratransmit.py --freq 917500000 /dev/ttyACM0 +$ echo "Hello World" | loratransmit --freq 917500000 /dev/ttyACM0 ``` \ No newline at end of file diff --git a/loratransmit/__init__.py b/loratransmit/__init__.py index e2830e7..9abde72 100644 --- a/loratransmit/__init__.py +++ b/loratransmit/__init__.py @@ -2,6 +2,7 @@ import os import glob from .loratransmit import * +from .RNode import RNodeInterface modules = glob.glob(os.path.dirname(__file__)+"/*.py") __all__ = [ os.path.basename(f)[:-3] for f in modules if not f.endswith('__init__.py')] \ No newline at end of file diff --git a/loratransmit/loratransmit.py b/loratransmit/loratransmit.py index 02561e2..89b93ba 100644 --- a/loratransmit/loratransmit.py +++ b/loratransmit/loratransmit.py @@ -3,7 +3,7 @@ import sys import select import argparse -from RNode import RNodeInterface +from .RNode import RNodeInterface def packetize(str): utf8_bytes = str.encode('utf-8') diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..4bd92ab --- /dev/null +++ b/setup.py @@ -0,0 +1,26 @@ +import setuptools + +with open("README.md", "r") as fh: + long_description = fh.read() + +setuptools.setup( + name="loratransmit", + version="0.3.2", + author="randogoth", + author_email="randogoth@posteo.org", + description="LoRa packet transmitter for RNode hardware", + long_description=long_description, + long_description_content_type="text/markdown", + url="https://github.com/randogoth/loratransmit", + packages=setuptools.find_packages(), + classifiers=[ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + ], + entry_points= { + 'console_scripts': ['loratransmit=loratransmit:main'] + }, + install_requires=['pyserial'], + python_requires='>=3.6', +) \ No newline at end of file