Files
nixpkgs/pkgs/development/python-modules/asyncua/default.nix
T
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

84 lines
1.9 KiB
Nix

{
lib,
stdenv,
aiofiles,
aiosqlite,
buildPythonPackage,
cryptography,
fetchFromGitHub,
pyopenssl,
pytest-asyncio_0_21,
pytest-mock,
pytestCheckHook,
python-dateutil,
pythonOlder,
pytz,
setuptools,
sortedcontainers,
typing-extensions,
}:
buildPythonPackage rec {
pname = "asyncua";
version = "1.1.5";
pyproject = true;
disabled = pythonOlder "3.8";
src = fetchFromGitHub {
owner = "FreeOpcUa";
repo = "opcua-asyncio";
rev = "refs/tags/v${version}";
hash = "sha256-XXjzYDOEBdA4uk0VCzscHrPCY2Lgin0JBAVDdxmSOio=";
fetchSubmodules = true;
};
postPatch = ''
# Workaround hardcoded paths in test
# "test_cli_tools_which_require_sigint"
substituteInPlace tests/test_tools.py \
--replace-fail "tools/" "$out/bin/"
'';
build-system = [ setuptools ];
dependencies = [
aiofiles
aiosqlite
cryptography
pyopenssl
python-dateutil
pytz
sortedcontainers
typing-extensions
];
nativeCheckInputs = [
pytestCheckHook
pytest-asyncio_0_21
pytest-mock
];
pythonImportsCheck = [ "asyncua" ];
disabledTests = [
# Failed: DID NOT RAISE <class 'asyncio.exceptions.TimeoutError'>
"test_publish"
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
# OSError: [Errno 48] error while attempting to bind on address ('127.0.0.1',...
"test_anonymous_rejection"
"test_certificate_handling_success"
"test_encrypted_private_key_handling_success"
"test_encrypted_private_key_handling_success_with_cert_props"
"test_encrypted_private_key_handling_failure"
];
meta = with lib; {
description = "OPC UA / IEC 62541 Client and Server for Python";
homepage = "https://github.com/FreeOpcUa/opcua-asyncio";
changelog = "https://github.com/FreeOpcUa/opcua-asyncio/releases/tag/v${version}";
license = licenses.lgpl3Plus;
maintainers = with maintainers; [ harvidsen ];
};
}