1{ stdenv
2, lib
3, buildPythonPackage
4, fetchPypi
5, bash
6, coreutils
7, eventlet
8, fasteners
9, fixtures
10, iana-etc
11, libredirect
12, oslo-config
13, oslo-utils
14, oslotest
15, pbr
16, stestr
17}:
18
19buildPythonPackage rec {
20 pname = "oslo-concurrency";
21 version = "5.1.1";
22
23 src = fetchPypi {
24 pname = "oslo.concurrency";
25 inherit version;
26 hash = "sha256-EQ+2Adgi3UsI7qJ5d9cNAfnxzR6vbezQQqIfQ78/KyU=";
27 };
28
29 postPatch = ''
30 # only a small portion of the listed packages are actually needed for running the tests
31 # so instead of removing them one by one remove everything
32 rm test-requirements.txt
33
34 substituteInPlace oslo_concurrency/tests/unit/test_processutils.py \
35 --replace "/bin/bash" "${bash}/bin/bash" \
36 --replace "/bin/true" "${coreutils}/bin/true" \
37 --replace "/usr/bin/env" "${coreutils}/bin/env" \
38 --replace "/usr/bin/true" "${coreutils}/bin/true"
39 '';
40
41 propagatedBuildInputs = [
42 fasteners
43 oslo-config
44 oslo-utils
45 pbr
46 ];
47
48 # tests hang for unknown reason and time the build out
49 doCheck = false;
50
51 nativeCheckInputs = [
52 eventlet
53 fixtures
54 oslotest
55 stestr
56 ];
57
58 checkPhase = ''
59 echo "nameserver 127.0.0.1" > resolv.conf
60 export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols:/etc/resolv.conf=$(realpath resolv.conf)
61 export LD_PRELOAD=${libredirect}/lib/libredirect.so
62
63 stestr run -e <(echo "
64 oslo_concurrency.tests.unit.test_lockutils_eventlet.TestInternalLock.test_fair_lock_with_spawn
65 oslo_concurrency.tests.unit.test_lockutils_eventlet.TestInternalLock.test_fair_lock_with_spawn_n
66 ")
67 '';
68
69 pythonImportsCheck = [ "oslo_concurrency" ];
70
71 meta = with lib; {
72 broken = stdenv.isDarwin;
73 description = "Oslo Concurrency library";
74 homepage = "https://github.com/openstack/oslo.concurrency";
75 license = licenses.asl20;
76 maintainers = teams.openstack.members;
77 };
78}