From 27f6b0f0e54541a333a5160010f86b434356e1ac Mon Sep 17 00:00:00 2001 From: Aaron Heise Date: Fri, 10 Feb 2023 20:46:22 -0600 Subject: [PATCH] Workin on packaging --- pyproject.toml | 19 +++++++++++++++++++ rnsh/rnsh.py | 20 +++++++++----------- 2 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..3eaf55a --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,19 @@ +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "rnsh" +version = "0.0.1" +authors = [{name="acehoss", email="acehoss@acehoss.net" }] +description = "Shell over Reticulum" +readme = "README.md" +dependencies = ["psutil","docopt","RNS"] +requires-python = ">=3.11" + +[project.scripts] +rnsh = "rnsh.rnsh:rnsh_cli" + +[project.urls] +"Homepage" = "https://github.com/acehoss/rnsh" +#"Bug Tracker" = "https://github.com/your_name_here/something/issues" \ No newline at end of file diff --git a/rnsh/rnsh.py b/rnsh/rnsh.py index a64ff56..7725953 100644 --- a/rnsh/rnsh.py +++ b/rnsh/rnsh.py @@ -26,21 +26,18 @@ from __future__ import annotations import functools from typing import Callable, TypeVar import termios -import rnslogging +import rnsh.rnslogging as rnslogging import RNS -import shlex import time import sys import os -import datetime import base64 -import process +import rnsh.process as process import asyncio import threading import signal -import retry -from multiprocessing.pool import ThreadPool -from __version import __version__ +import rnsh.retry as retry +from rnsh.__version import __version__ import logging as __logging module_logger = __logging.getLogger(__name__) @@ -61,7 +58,6 @@ DATA_AVAIL_MSG = "data available" _finished: asyncio.Event | None = None _retry_timer = retry.RetryThread() _destination: RNS.Destination | None = None -_pool: ThreadPool = ThreadPool(10) _loop: asyncio.AbstractEventLoop | None = None async def _check_finished(timeout: float = 0): @@ -545,7 +541,6 @@ def _listen_request(path, data, request_id, link_id, remote_identity, requested_ async def _spin(until: Callable | None = None, timeout: float | None = None) -> bool: - global _pool if timeout is not None: timeout += time.time() @@ -892,7 +887,7 @@ Options: print("") -if __name__ == "__main__": +def rnsh_cli(): return_code = 1 try: return_code = asyncio.run(main()) @@ -902,6 +897,9 @@ if __name__ == "__main__": except: pass _tr.restore() - _pool.close() _retry_timer.close() sys.exit(return_code) + + +if __name__ == "__main__": + rnsh_cli()