pyproject.toml
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled

This commit is contained in:
emdee@spm.plastiras.org 2024-01-13 15:59:22 +00:00
parent 054e9ce8ce
commit 6aca75d2cb
19 changed files with 88 additions and 10 deletions

View File

@ -14,5 +14,9 @@ python = ">=3.6;<3.12"
# [tool.poetry.dev-dependencies]
[build-system]
requires = ["setuptools"]
requires = ["setuptools >= 61.0"]
build-backend = "setuptools.build_meta"
[tool.setuptools.packages.find]
where = "src"

67
setup.cfg Normal file
View File

@ -0,0 +1,67 @@
[metadata]
classifiers =
License :: OSI Approved
License :: OSI Approved :: BSD 1-clause
Intended Audience :: Web Developers
Operating System :: Microsoft :: Windows
Operating System :: POSIX :: BSD :: FreeBSD
Operating System :: POSIX :: Linux
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: Implementation :: CPython
Framework :: AsyncIO
description='Tox ctypes wrapping into Python',
long_description='Tox ctypes wrapping of c-toxcore into Python3',
url='https://git.plastiras.org/emdee/toxygen_wrapper/',
keywords='ctypes Tox messenger',
author='Ingvar',
[options]
zip_safe = false
python_requires = ~=3.6
include_package_data = false
install_requires =
ctypes
package_dir=
=src
packages=find:
[options.packages.find]
where=src
[options.entry_points]
console_scripts =
tox_wrapper_tests = tox_wrapper.tests_wrapper:main
[easy_install]
zip_ok = false
[flake8]
jobs = 1
max-line-length = 88
ignore =
E111
E114
E128
E225
E261
E302
E305
E402
E501
E502
E541
E701
E702
E704
E722
E741
F508
F541
W503
W601

View File

@ -192,6 +192,7 @@ def clean_booleans(oArgs) -> None:
else:
setattr(oArgs, key, True)
import traceback
def toxygen_log_cb(_, level: int, source, line: int, func, message, userdata=None):
"""
* @param level The severity of the log message.
@ -202,20 +203,23 @@ def toxygen_log_cb(_, level: int, source, line: int, func, message, userdata=Non
* @param user_data The user data pointer passed to tox_new in options.
"""
try:
source = str(source, 'UTF-8')
if type(source) == bytes:
source = str(source, 'UTF-8')
if type(func) == bytes:
func = str(func, 'UTF-8')
if type(message) == bytes:
message = str(message, 'UTF-8')
if source == 'network.c':
squelch='network family 10 (probably IPv6) on IPv4 socket'
if message.find(squelch) > 0: return
if message.find('07 = GET_NODES') > 0: return
if source == 'TCP_common.c':
elif source == 'TCP_common.c':
squelch='read_tcp_packet recv buffer has'
if message.find(squelch) > 0: return
return
func = str(func, 'UTF-8')
message = str(message, 'UTF-8')
LOG_LOG(f"{source}#{line}:{func} {message}")
except Exception as e:
LOG_WARN(f"toxygen_log_cb EXCEPTION {e}")
LOG_WARN(f"toxygen_log_cb EXCEPTION {e}\n{traceback.format_exc()}")
def on_log(iTox, level, filename, line, func, message, *data) -> None:
# LOG.debug(repr((level, filename, line, func, message,)))
@ -328,9 +332,9 @@ def oMainArgparser(_=None, iMode=0):
choices=lIpV6Choices,
help=f"En/Disable ipv6 - default {bIpV6}")
parser.add_argument('--trace_enabled',type=str,
default='True' if os.environ.get('DEBUG') else 'False',
default='False',
choices=['True','False'],
help='Debugging from toxcore logger_trace or env DEBUG=1')
help='Debugging from toxcore logger_trace')
parser.add_argument('--download_nodes_list', type=str, default='False',
choices=['True', 'False'],
help='Download nodes list')

View File

@ -264,6 +264,9 @@ def prepare(self):
alice.callback_self_connection_status(alices_on_self_connection_status)
# only bob logs trace_enabled
if oTOX_OARGS.trace_enabled:
LOG.warning(f"oTOX_OARGS.trace_enabled={oTOX_OARGS.trace_enabled}")
oTOX_OARGS.trace_enabled = False
if oTOX_OARGS.trace_enabled:
LOG.info(f"toxcore trace_enabled")
ts.vAddLoggerCallback(opts)
@ -2248,7 +2251,7 @@ def oArgparse(lArgv):
def main(lArgs=None) -> int:
global oTOX_OARGS
if lArgs is None: lArgs = []
if lArgs is None: lArgs = sys.argv[1:]
oArgs = oArgparse(lArgs)
global bIS_LOCAL
bIS_LOCAL = oArgs.network in ['newlocal', 'localnew', 'local']
@ -2272,4 +2275,4 @@ def main(lArgs=None) -> int:
return iMain(oArgs)
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))
sys.exit(main(sys.argv[1:] ))