Workin on packaging

This commit is contained in:
Aaron Heise 2023-02-10 20:46:22 -06:00
parent 6543620985
commit 27f6b0f0e5
2 changed files with 28 additions and 11 deletions

19
pyproject.toml Normal file
View File

@ -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"

View File

@ -26,21 +26,18 @@ from __future__ import annotations
import functools import functools
from typing import Callable, TypeVar from typing import Callable, TypeVar
import termios import termios
import rnslogging import rnsh.rnslogging as rnslogging
import RNS import RNS
import shlex
import time import time
import sys import sys
import os import os
import datetime
import base64 import base64
import process import rnsh.process as process
import asyncio import asyncio
import threading import threading
import signal import signal
import retry import rnsh.retry as retry
from multiprocessing.pool import ThreadPool from rnsh.__version import __version__
from __version import __version__
import logging as __logging import logging as __logging
module_logger = __logging.getLogger(__name__) module_logger = __logging.getLogger(__name__)
@ -61,7 +58,6 @@ DATA_AVAIL_MSG = "data available"
_finished: asyncio.Event | None = None _finished: asyncio.Event | None = None
_retry_timer = retry.RetryThread() _retry_timer = retry.RetryThread()
_destination: RNS.Destination | None = None _destination: RNS.Destination | None = None
_pool: ThreadPool = ThreadPool(10)
_loop: asyncio.AbstractEventLoop | None = None _loop: asyncio.AbstractEventLoop | None = None
async def _check_finished(timeout: float = 0): 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: async def _spin(until: Callable | None = None, timeout: float | None = None) -> bool:
global _pool
if timeout is not None: if timeout is not None:
timeout += time.time() timeout += time.time()
@ -892,7 +887,7 @@ Options:
print("") print("")
if __name__ == "__main__": def rnsh_cli():
return_code = 1 return_code = 1
try: try:
return_code = asyncio.run(main()) return_code = asyncio.run(main())
@ -902,6 +897,9 @@ if __name__ == "__main__":
except: except:
pass pass
_tr.restore() _tr.restore()
_pool.close()
_retry_timer.close() _retry_timer.close()
sys.exit(return_code) sys.exit(return_code)
if __name__ == "__main__":
rnsh_cli()