1{ lib
2, buildPythonPackage
3, fetchPypi
4, isPy3k
5, setuptools
6, pytest
7}:
8
9buildPythonPackage rec {
10 pname = "pglast";
11 version = "3.7";
12
13 src = fetchPypi {
14 inherit pname version;
15 sha256 = "3f0f36cebdb68d5b3aaacb11cbf09db44250194845fbf3b49b0aef93c30991bf";
16 };
17
18 disabled = !isPy3k;
19
20 # ModuleNotFoundError: No module named 'pkg_resources'
21 propagatedBuildInputs = [ setuptools ];
22
23 postPatch = ''
24 substituteInPlace setup.cfg \
25 --replace "--cov=pglast --cov-report term-missing" ""
26 '';
27
28 checkInputs = [ pytest ];
29
30 # pytestCheckHook doesn't work
31 # ImportError: cannot import name 'parse_sql' from 'pglast'
32 checkPhase = ''
33 pytest
34 '';
35
36 meta = with lib; {
37 homepage = "https://github.com/lelit/pglast";
38 description = "PostgreSQL Languages AST and statements prettifier";
39 changelog = "https://github.com/lelit/pglast/raw/v${version}/CHANGES.rst";
40 license = licenses.gpl3Plus;
41 maintainers = [ maintainers.marsam ];
42 };
43}