nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 bash,
6 coreutils,
7 debtcollector,
8 eventlet,
9 fasteners,
10 fixtures,
11 iana-etc,
12 libredirect,
13 oslo-config,
14 oslo-i18n,
15 oslo-utils,
16 oslotest,
17 pbr,
18 pythonAtLeast,
19 setuptools,
20 stdenv,
21 stestr,
22 writeText,
23}:
24
25buildPythonPackage rec {
26 pname = "oslo-concurrency";
27 version = "7.4.0";
28 pyproject = true;
29
30 src = fetchFromGitHub {
31 owner = "openstack";
32 repo = "oslo.concurrency";
33 tag = version;
34 hash = "sha256-i2w3c5/Xuhjc7cAaIiuRNtz5JTG9tjXsrn4IUhuMLxA=";
35 };
36
37 postPatch = ''
38 substituteInPlace oslo_concurrency/tests/unit/test_processutils.py \
39 --replace-fail "/usr" "" \
40 --replace-fail "/bin/bash" "${bash}/bin/bash" \
41 --replace-fail "/bin/true" "${coreutils}/bin/true" \
42 --replace-fail "/bin/env" "${coreutils}/bin/env"
43
44 substituteInPlace pyproject.toml \
45 --replace-fail '"oslo_concurrency"' '"oslo_concurrency", "oslo_concurrency.fixture", "oslo_concurrency.tests"'
46 '';
47
48 env.PBR_VERSION = version;
49
50 build-system = [ setuptools ];
51
52 dependencies = [
53 debtcollector
54 fasteners
55 oslo-config
56 oslo-i18n
57 oslo-utils
58 pbr
59 ];
60
61 nativeCheckInputs = [
62 eventlet
63 fixtures
64 libredirect.hook
65 oslotest
66 stestr
67 ];
68
69 checkPhase =
70 let
71 disabledTests = [
72 "oslo_concurrency.tests.unit.test_lockutils_eventlet.TestInternalLock.test_fair_lock_with_spawn"
73 "oslo_concurrency.tests.unit.test_lockutils_eventlet.TestInternalLock.test_fair_lock_with_spawn_n"
74 "oslo_concurrency.tests.unit.test_lockutils_eventlet.TestInternalLock.test_lock_with_spawn"
75 "oslo_concurrency.tests.unit.test_lockutils_eventlet.TestInternalLock.test_lock_with_spawn_n"
76 ]
77 ++ lib.optionals stdenv.hostPlatform.isDarwin [
78 "oslo_concurrency.tests.unit.test_lockutils.FileBasedLockingTestCase.test_interprocess_nonblocking_external_lock"
79 "oslo_concurrency.tests.unit.test_lockutils.LockTestCase.test_lock_externally"
80 "oslo_concurrency.tests.unit.test_lockutils.LockTestCase.test_lock_externally_lock_dir_not_exist"
81 "oslo_concurrency.tests.unit.test_processutils.PrlimitTestCase.test_stack_size"
82 ]
83 ++ lib.optionals (pythonAtLeast "3.14") [
84 # Disable test incompatible with Python 3.14+
85 # See proposed change upstream: https://review.opendev.org/c/openstack/oslo.concurrency/+/971765
86 "oslo_concurrency.tests.unit.test_lockutils"
87 ];
88 in
89 ''
90 runHook preCheck
91
92 echo "nameserver 127.0.0.1" > resolv.conf
93 export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols:/etc/resolv.conf=$(realpath resolv.conf)
94
95 stestr run -e <(echo "${lib.concatStringsSep "\n" disabledTests}")
96
97 runHook postCheck
98 '';
99
100 pythonImportsCheck = [ "oslo_concurrency" ];
101
102 meta = {
103 description = "Oslo Concurrency library";
104 mainProgram = "lockutils-wrapper";
105 homepage = "https://github.com/openstack/oslo.concurrency";
106 license = lib.licenses.asl20;
107 teams = [ lib.teams.openstack ];
108 };
109}