1{
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 setuptools,
17 stestr,
18}:
19
20buildPythonPackage rec {
21 pname = "oslo-concurrency";
22 version = "6.1.0";
23 pyproject = true;
24
25 src = fetchPypi {
26 pname = "oslo.concurrency";
27 inherit version;
28 hash = "sha256-tWSuCvLuV3DztuYw3yakuGdsf+Qih/GIPiWaUard8Jc=";
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-fail "/bin/bash" "${bash}/bin/bash" \
38 --replace-fail "/usr/bin/true" "${coreutils}/bin/true" \
39 --replace-fail "/bin/true" "${coreutils}/bin/true" \
40 --replace-fail "/usr/bin/env" "${coreutils}/bin/env"
41 '';
42
43 build-system = [ setuptools ];
44
45 dependencies = [
46 fasteners
47 oslo-config
48 oslo-utils
49 pbr
50 ];
51
52 # tests hang for unknown reason and time the build out
53 doCheck = false;
54
55 nativeCheckInputs = [
56 eventlet
57 fixtures
58 oslotest
59 stestr
60 ];
61
62 checkPhase = ''
63 echo "nameserver 127.0.0.1" > resolv.conf
64 export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols:/etc/resolv.conf=$(realpath resolv.conf)
65 export LD_PRELOAD=${libredirect}/lib/libredirect.so
66
67 stestr run -e <(echo "
68 oslo_concurrency.tests.unit.test_lockutils_eventlet.TestInternalLock.test_fair_lock_with_spawn
69 oslo_concurrency.tests.unit.test_lockutils_eventlet.TestInternalLock.test_fair_lock_with_spawn_n
70 ")
71 '';
72
73 pythonImportsCheck = [ "oslo_concurrency" ];
74
75 meta = with lib; {
76 description = "Oslo Concurrency library";
77 mainProgram = "lockutils-wrapper";
78 homepage = "https://github.com/openstack/oslo.concurrency";
79 license = licenses.asl20;
80 maintainers = teams.openstack.members;
81 };
82}