@@ -0,0 +1,41 @@
1+{ lib
2+, buildPythonPackage
3+, fetchPypi
4+, psycopg2
5+, isPy27
6+}:
7+
8+buildPythonPackage rec {
9+ pname = "pq";
10+ version = "1.8.1";
11+ disabled = isPy27;
12+
13+ src = fetchPypi {
14+ inherit pname version;
15+ sha256 = "9e2c0195488263902ebc9da8df6c82bebe4ee32c79d9ecd0cdc2945afbf7ad32";
16+ };
17+
18+ # psycopg2cffi is compatible with psycopg2 and author states that
19+ # module is compatible with psycopg2
20+ postConfigure = ''
21+ substituteInPlace setup.py \
22+ --replace "psycopg2cffi" "psycopg2"
23+
24+ substituteInPlace pq/tests.py \
25+ --replace "psycopg2cffi" "psycopg2"
26+ '';
27+
28+ checkInputs = [
29+ psycopg2
30+ ];
31+
32+ # tests require running postgresql cluster
33+ doCheck = false;
34+
35+ meta = with lib; {
36+ description = "PQ is a transactional queue for PostgreSQL";
37+ homepage = https://github.com/malthe/pq/;
38+ license = licenses.bsd3;
39+ maintainers = [ maintainers.costrouc ];
40+ };
41+}