1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, pymysql
5, pytest
6, isPy27
7, fetchpatch
8}:
9
10buildPythonPackage rec {
11 pname = "aiomysql";
12 version = "0.0.21";
13 disabled = isPy27;
14
15 src = fetchFromGitHub {
16 owner = "aio-libs";
17 repo = pname;
18 rev = "v${version}";
19 sha256 = "1qvy3phbsxp55161dnppjfx2m1kn82v0irc3xzqw0adfd81vaiad";
20 };
21
22 patches = [
23 (fetchpatch {
24 # vendor functions previously provided by pymysql.util
25 url = "https://github.com/aio-libs/aiomysql/pull/554/commits/919b997a9de7f53d721af76762fba425e306531e.patch";
26 sha256 = "V1VYyqr6RwTXoVoGVyMuJst6uqTuuHbpMOpLoVZO1XA=";
27 })
28 ];
29
30 propagatedBuildInputs = [
31 pymysql
32 ];
33
34 checkInputs = [
35 pytest
36 ];
37
38 postPatch = ''
39 substituteInPlace setup.py \
40 --replace "PyMySQL>=0.9,<=0.9.3" "PyMySQL"
41 '';
42
43 checkPhase = ''
44 pytest
45 '';
46
47 # tests require mysql database
48 doCheck = false;
49
50 meta = with lib; {
51 description = "MySQL driver for asyncio";
52 homepage = "https://github.com/aio-libs/aiomysql";
53 license = licenses.mit;
54 maintainers = [ maintainers.costrouc ];
55 };
56}