@@ -0,0 +1,42 @@
1+{ lib
2+, async-timeout
3+, buildPythonPackage
4+, fetchFromGitHub
5+, psycopg2
6+, pythonOlder
7+}:
8+
9+buildPythonPackage rec {
10+ pname = "aiopg";
11+ version = "1.2.1";
12+ disabled = pythonOlder "3.6";
13+
14+ src = fetchFromGitHub {
15+ owner = "aio-libs";
16+ repo = pname;
17+ rev = "v${version}";
18+ sha256 = "0c6s2p1fjbdk1ygpl6a1s1rbnsk8gw9kj99pf98nxhb9j3iahas4";
19+ };
20+
21+ propagatedBuildInputs = [
22+ async-timeout
23+ psycopg2
24+ ];
25+
26+ postPatch = ''
27+ substituteInPlace setup.py \
28+ --replace "psycopg2-binary" "psycopg2"
29+ '';
30+
31+ # Tests requires a PostgreSQL Docker instance
32+ doCheck = false;
33+
34+ pythonImportsCheck = [ "aiopg" ];
35+
36+ meta = with lib; {
37+ description = "Python library for accessing a PostgreSQL database";
38+ homepage = "https://aiopg.readthedocs.io/";
39+ license = with licenses; [ bsd2 ];
40+ maintainers = with maintainers; [ fab ];
41+ };
42+}