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