Browse Source

Merge branch 'master' into Release_2.1

PYADPT-116
heck 4 years ago
parent
commit
e04c8ed1d3
  1. 4
      Makefile.conf
  2. 3
      pyproject.toml
  3. 4
      setup.cfg
  4. 7
      src/pEp/_pEp/pEpmodule.cc
  5. 9
      test/sync_handshake.py
  6. 13
      test/sync_test.py

4
Makefile.conf

@ -11,8 +11,8 @@ PYTHON_ARTIFACTS += ./.pytest_cache
VENV_DIR = ./venv
# Build config Defaults
DEBUG=0
PREFIX=
DEBUG=1
PREFIX=$(HOME)
######### Overrides #########
-include $(HERE)local.conf

3
pyproject.toml

@ -5,7 +5,8 @@
requires =[
"setuptools >=39.2.0",
"setuptools_scm >= 4.1.2",
"wheel >= 0.35.1" ]
"wheel",
]
build-backend = "setuptools.build_meta"

4
setup.cfg

@ -27,14 +27,14 @@ classifiers =
[options]
zip_safe = false
include_package_data = true
python_requires = >=3.8,<3.9
python_requires = >=3.7,<3.9
test_suite = tests
install_requires =
# deprecated/redundant with pyproject.toml, but lets keep both ways around for now
setup_requires =
setuptools >=39.2.0
setuptools_scm >= 4.1.2
wheel >= 0.35.1
wheel
[options.extras_require]
# To install these dependencies, run pip install .[test]
test =

7
src/pEp/_pEp/pEpmodule.cc

@ -161,11 +161,6 @@ namespace pEp {
// Adapter::session(release);
}
void _inject_sync_shutdown() {
pEpLog("injecting null event");
Adapter::_queue_sync_event(nullptr,nullptr);
}
// TODO: Integrate this (currently SEGFAULTING)
void _notifyHandshake_sync_start() {
pEpLog("all targets signal: SYNC_NOTIFY_START");
@ -251,7 +246,7 @@ namespace pEp {
def("_do_protocol_step", _do_protocol_step,
"");
def("_inject_sync_shutdown", _inject_sync_shutdown,
def("_inject_sync_shutdown", Adapter::inject_sync_shutdown,
"");
def("_notifyHandshake_sync_start", _notifyHandshake_sync_start,

9
test/sync_handshake.py

@ -45,6 +45,7 @@ inbox = pathlib.Path("..") / "TestInbox"
device_name = ""
output = print
multithreaded = False
debug_log = False
DONT_TRIGGER_SYNC = 0x200
SYNC_HANDSHAKE_ACCEPTED = 0
@ -151,9 +152,10 @@ def shutdown_sync():
def run(name, color=None, imap=False, own_ident=1, leave=False):
global device_name
device_name = name
pEp.set_debug_log_enabled(debug_log)
pEp.notify_handshake = this_notifyHandshake
if color:
@ -250,7 +252,9 @@ if __name__=="__main__":
dest="leave",
help="after a successful sync run this to make the device leave the "
"device group again")
optParser.add_option("-d", "--debuglog", action="store_true",
dest="debug_log",
help="print extra verbose pEpPythonAdater debug log")
options, args = optParser.parse_args()
if not options.exec_for:
@ -272,4 +276,5 @@ if __name__=="__main__":
raise ValueError("Multiple own identities not supported for imap mode")
multithreaded = options.multithreaded
debug_log = options.debug_log
run(options.exec_for, options.color, options.imap, options.own_ident, options.leave)

13
test/sync_test.py

@ -22,7 +22,7 @@ import shutil
import pathlib
def test_for(path, color=None, end_on=None, mt=False, imap=False, own_ident=1):
def test_for(path, color=None, end_on=None, mt=False, imap=False, debuglog=False, own_ident=1):
cwd = os.getcwd();
os.chdir(path)
@ -33,7 +33,7 @@ def test_for(path, color=None, end_on=None, mt=False, imap=False, own_ident=1):
if end_on:
sync_handshake.end_on = end_on
sync_handshake.multithreaded = mt
sync_handshake.debug_log = debuglog
sync_handshake.run(path, color, imap, own_ident)
@ -105,6 +105,9 @@ if __name__ == "__main__":
optParser.add_option("-A", "--add-account-after-sync", action="store_true",
dest="add_account",
help="after sync add an account")
optParser.add_option("-d", "--debuglog", action="store_true",
dest="debug_log",
help="print extra verbose pEpPythonAdater debug log")
options, args = optParser.parse_args()
@ -211,14 +214,14 @@ if __name__ == "__main__":
# Phone runs with own_ident = 2
Phone = Process(target=test_for, args=("Phone", "red", end_on,
options.multithreaded, options.imap, 2))
options.multithreaded, options.imap, options.debug_log, 2))
# others run with own_ident = 1
Laptop = Process(target=test_for, args=("Laptop", "green", end_on,
options.multithreaded, options.imap))
options.multithreaded, options.imap, options.debug_log))
if options.third:
Pad = Process(target=test_for, args=("Pad", "cyan", end_on,
options.multithreaded, options.imap))
options.multithreaded, options.imap, options.debug_log))
Phone.start()
Laptop.start()

Loading…
Cancel
Save