1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 setuptools,
6 pyasyncore,
7 pytestCheckHook,
8 pythonOlder,
9}:
10
11buildPythonPackage rec {
12 pname = "pyasynchat";
13 version = "1.0.4";
14 pyproject = true;
15
16 src = fetchFromGitHub {
17 owner = "simonrob";
18 repo = "pyasynchat";
19 rev = "v${version}";
20 hash = "sha256-Cep8tsapLjhPbVhMrC1ZUgd4jZZLOliL4yF0OX2KrYs=";
21 };
22
23 build-system = [
24 setuptools
25 ];
26
27 dependencies = [
28 pyasyncore
29 ];
30
31 nativeCheckInputs = [ pytestCheckHook ];
32
33 preCheck =
34 if (pythonOlder "3.11") then
35 ''
36 substituteInPlace tests/test_asynchat.py \
37 --replace-fail "asynchat = warnings_helper.import_deprecated('asynchat')" 'import asynchat' \
38 --replace-fail "asyncore = warnings_helper.import_deprecated('asyncore')" 'import asyncore' \
39 --replace-fail 'support.requires_working_socket(module=True)' ""
40 ''
41 else
42 null;
43
44 pythonImportsCheck = [
45 "asynchat"
46 ];
47
48 __darwinAllowLocalNetworking = true;
49
50 meta = {
51 description = "Make asynchat available for Python 3.12 onwards";
52 homepage = "https://github.com/simonrob/pyasynchat";
53 license = lib.licenses.psfl;
54 maintainers = with lib.maintainers; [ ];
55 };
56}