1{ lib
2, stdenv
3, aiofiles
4, aiosqlite
5, buildPythonPackage
6, cryptography
7, fetchFromGitHub
8, pyopenssl
9, pytest-asyncio
10, pytest-mock
11, pytestCheckHook
12, python-dateutil
13, pythonOlder
14, pytz
15, sortedcontainers
16, typing-extensions
17}:
18
19buildPythonPackage rec {
20 pname = "asyncua";
21 version = "1.0.5";
22 format = "setuptools";
23
24 disabled = pythonOlder "3.8";
25
26 src = fetchFromGitHub {
27 owner = "FreeOpcUa";
28 repo = "opcua-asyncio";
29 rev = "refs/tags/v${version}";
30 hash = "sha256-eDrnDDiijkr5377BVWVAc5QEQCCDBoFynuT4MncCx9g=";
31 fetchSubmodules = true;
32 };
33
34 postPatch = ''
35 # https://github.com/FreeOpcUa/opcua-asyncio/issues/1263
36 substituteInPlace setup.py \
37 --replace ", 'asynctest'" ""
38
39 # Workaround hardcoded paths in test
40 # "test_cli_tools_which_require_sigint"
41 substituteInPlace tests/test_tools.py \
42 --replace "tools/" "$out/bin/"
43 '';
44
45 propagatedBuildInputs = [
46 aiofiles
47 aiosqlite
48 cryptography
49 pyopenssl
50 python-dateutil
51 pytz
52 sortedcontainers
53 typing-extensions
54 ];
55
56 nativeCheckInputs = [
57 pytestCheckHook
58 pytest-asyncio
59 pytest-mock
60 ];
61
62 pythonImportsCheck = [
63 "asyncua"
64 ];
65
66 disabledTests = lib.optionals stdenv.isDarwin [
67 # Failed: DID NOT RAISE <class 'asyncio.exceptions.TimeoutError'>
68 "test_publish"
69 # OSError: [Errno 48] error while attempting to bind on address ('127.0.0.1',...
70 "test_anonymous_rejection"
71 "test_certificate_handling_success"
72 "test_encrypted_private_key_handling_success"
73 "test_encrypted_private_key_handling_success_with_cert_props"
74 "test_encrypted_private_key_handling_failure"
75 ];
76
77 meta = with lib; {
78 description = "OPC UA / IEC 62541 Client and Server for Python";
79 homepage = "https://github.com/FreeOpcUa/opcua-asyncio";
80 changelog = "https://github.com/FreeOpcUa/opcua-asyncio/releases/tag/v${version}";
81 license = licenses.lgpl3Plus;
82 maintainers = with maintainers; [ harvidsen ];
83 };
84}