Update README
This commit is contained in:
parent
e7ef810508
commit
2187568ef8
31
README.md
31
README.md
@ -1,25 +1,36 @@
|
|||||||
# toxygen_wrapper
|
# toxygen_wrapper
|
||||||
|
|
||||||
ctypes wrapping of [Tox](https://tox.chat/) libtoxcore
|
[ctypes](https://docs.python.org/3/library/ctypes.html)
|
||||||
|
wrapping of [Tox](https://tox.chat/) ```libtoxcore```
|
||||||
<https://github.com/TokTok/c-toxcore> into Python.
|
<https://github.com/TokTok/c-toxcore> into Python.
|
||||||
Taken from the wrapper directory of the now abandoned
|
Taken from the ```wrapper``` directory of the now abandoned
|
||||||
<https://github.com/toxygen-project/toxygen> `next_gen` branch
|
<https://github.com/toxygen-project/toxygen> `next_gen` branch
|
||||||
by Ingvar.
|
by Ingvar.
|
||||||
|
|
||||||
The basics of NGC groups are supported, as well as AV and toxencryptsave.
|
The basics of NGC groups are supported, as well as AV and toxencryptsave.
|
||||||
There is no coverage of conferences as they are not supported in ```toxygen```
|
There is no coverage of conferences as they are not used in ```toxygen```
|
||||||
and the list of still unwrapped calls as of Sept. 2022 can be found in
|
and the list of still unwrapped calls as of Sept. 2022 can be found in
|
||||||
```tox.c-toxcore.missing```.
|
```tox.c-toxcore.missing```. The code still needs double-checking
|
||||||
|
that every call in ```tox.py``` has the right signature, but it runs
|
||||||
|
```toxygen``` with apparent issues.
|
||||||
|
|
||||||
It has been tested with UDP and TCP proxy (Tor). It has ***not*** been
|
It has been tested with UDP and TCP proxy (Tor). It has ***not*** been
|
||||||
tested on Windows, and there may be some breakage, which should be
|
tested on Windows, and there may be some minor breakage, which should be
|
||||||
easy to fix.
|
easy to fix. There is a good coverage integration testsuite in ```tests```.
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
Put the parent of the wrapper directory on your PYTHONPATH and
|
Put the parent of the wrapper directory on your PYTHONPATH and
|
||||||
touch a file called `__init__.py` in its parent directory.
|
touch a file called `__init__.py` in its parent directory.
|
||||||
|
|
||||||
|
Then you need a ```libs``` directory beside the `wrapper` directory
|
||||||
|
and you need to link your ```libtoxcore.so``` and ```libtoxav.so```
|
||||||
|
and ```libtoxencryptsave.so``` into it. Link all 3 filenames
|
||||||
|
to ```libtoxcore.so``` if you have only ```libtoxcore.so```
|
||||||
|
(which is usually the case if you built ```c-toxcore``` with ```cmake```
|
||||||
|
rather than ```autogen/configure```). If you want to be different,
|
||||||
|
then just straighten out the filenames in ```libtox.py```.
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
No prerequisites in Python3.
|
No prerequisites in Python3.
|
||||||
@ -27,8 +38,12 @@ No prerequisites in Python3.
|
|||||||
## Other wrappers
|
## Other wrappers
|
||||||
|
|
||||||
There are a number of other wrappings into Python of Tox core.
|
There are a number of other wrappings into Python of Tox core.
|
||||||
This one uses CTYPES which has its merits - there is no need to
|
This one uses [ctypes](https://docs.python.org/3/library/ctypes.html)
|
||||||
recompile anything as with Cython - change the Python file and it's done.
|
which has its merits - there is no need to recompile anything as with
|
||||||
|
Cython - change the Python file and it's done. And you can follow things
|
||||||
|
in a Python debugger, or with the utterly stupendous Python feature of
|
||||||
|
```gdb`` (```gdb -ex r --args /usr/bin/python3.9 <pyfile>```).
|
||||||
|
|
||||||
CTYPES code can be brittle, segfaulting if you've got things wrong,
|
CTYPES code can be brittle, segfaulting if you've got things wrong,
|
||||||
but if your wrapping is right, it is very efficient and easy to work on.
|
but if your wrapping is right, it is very efficient and easy to work on.
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
|
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from ctypes import CDLL
|
from ctypes import CDLL
|
||||||
@ -41,11 +40,11 @@ class LibToxCore:
|
|||||||
class LibToxAV:
|
class LibToxAV:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
platform = sys.platform
|
platform = util.get_platform()
|
||||||
if platform == 'win32':
|
if platform == 'Windows':
|
||||||
# on Windows av api is in libtox.dll
|
# on Windows av api is in libtox.dll
|
||||||
self._libtoxav = CDLL(os.path.join(sLIBS_DIR, 'libtox.dll'))
|
self._libtoxav = CDLL(os.path.join(sLIBS_DIR, 'libtox.dll'))
|
||||||
elif platform == 'darwin':
|
elif platform == 'Darwin':
|
||||||
self._libtoxav = CDLL('libtoxcore.dylib')
|
self._libtoxav = CDLL('libtoxcore.dylib')
|
||||||
else:
|
else:
|
||||||
libFile = os.path.join(sLIBS_DIR, 'libtoxav.so')
|
libFile = os.path.join(sLIBS_DIR, 'libtoxav.so')
|
||||||
|
Loading…
Reference in New Issue
Block a user