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 setuptools,
19 stdenv,
20 stestr,
21}:
22
23buildPythonPackage rec {
24 pname = "oslo-concurrency";
25 version = "7.2.0";
26 pyproject = true;
27
28 src = fetchFromGitHub {
29 owner = "openstack";
30 repo = "oslo.concurrency";
31 tag = version;
32 hash = "sha256-72KatSWTCx4hyUel2Fu5yiqrdYveRGruvJDWWo1hkIk=";
33 };
34
35 postPatch = ''
36 substituteInPlace oslo_concurrency/tests/unit/test_processutils.py \
37 --replace-fail "/usr" "" \
38 --replace-fail "/bin/bash" "${bash}/bin/bash" \
39 --replace-fail "/bin/true" "${coreutils}/bin/true" \
40 --replace-fail "/bin/env" "${coreutils}/bin/env"
41 '';
42
43 env.PBR_VERSION = version;
44
45 build-system = [ setuptools ];
46
47 dependencies = [
48 debtcollector
49 fasteners
50 oslo-config
51 oslo-i18n
52 oslo-utils
53 pbr
54 ];
55
56 nativeCheckInputs = [
57 eventlet
58 fixtures
59 libredirect.hook
60 oslotest
61 stestr
62 ];
63
64 checkPhase = ''
65 echo "nameserver 127.0.0.1" > resolv.conf
66 export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols:/etc/resolv.conf=$(realpath resolv.conf)
67
68 stestr run -e <(echo "
69 oslo_concurrency.tests.unit.test_lockutils_eventlet.TestInternalLock.test_fair_lock_with_spawn
70 oslo_concurrency.tests.unit.test_lockutils_eventlet.TestInternalLock.test_fair_lock_with_spawn_n
71 oslo_concurrency.tests.unit.test_lockutils_eventlet.TestInternalLock.test_lock_with_spawn
72 oslo_concurrency.tests.unit.test_lockutils_eventlet.TestInternalLock.test_lock_with_spawn_n
73 ${lib.optionalString stdenv.hostPlatform.isDarwin ''
74 oslo_concurrency.tests.unit.test_lockutils.FileBasedLockingTestCase.test_interprocess_nonblocking_external_lock
75 oslo_concurrency.tests.unit.test_lockutils.LockTestCase.test_lock_externally
76 oslo_concurrency.tests.unit.test_lockutils.LockTestCase.test_lock_externally_lock_dir_not_exist
77 oslo_concurrency.tests.unit.test_processutils.PrlimitTestCase.test_stack_size
78 ''}")
79 '';
80
81 pythonImportsCheck = [ "oslo_concurrency" ];
82
83 meta = with lib; {
84 description = "Oslo Concurrency library";
85 mainProgram = "lockutils-wrapper";
86 homepage = "https://github.com/openstack/oslo.concurrency";
87 license = licenses.asl20;
88 teams = [ teams.openstack ];
89 };
90}