1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, python
5, pythonOlder
6, stdenv
7}:
8
9buildPythonPackage rec {
10 pname = "websockets";
11 version = "10.0";
12 disabled = pythonOlder "3.7";
13
14 src = fetchFromGitHub {
15 owner = "aaugustin";
16 repo = pname;
17 rev = version;
18 sha256 = "sha256-F10C8ukjYfbn2X2PMzrdSDqvs51/A9lx8Y3kv8YJ8Cw=";
19 };
20
21 # Tests fail on Darwin with `OSError: AF_UNIX path too long`
22 doCheck = !stdenv.isDarwin;
23
24 # Disable all tests that need to terminate within a predetermined amount of
25 # time. This is nondeterministic.
26 patchPhase = ''
27 sed -i 's/with self.assertCompletesWithin.*:/if True:/' \
28 tests/legacy/test_protocol.py
29 '';
30
31 checkPhase = ''
32 runHook preCheck
33 ${python.interpreter} -m unittest discover
34 runHook postCheck
35 '';
36
37 pythonImportsCheck = [ "websockets" ];
38
39 meta = with lib; {
40 description = "WebSocket implementation in Python";
41 homepage = "https://websockets.readthedocs.io/";
42 license = licenses.bsd3;
43 maintainers = with maintainers; [ fab ];
44 };
45}