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