1{ lib
2, buildPythonPackage
3, fetchPypi
4, pythonOlder
5, setuptools
6, pytest
7}:
8
9buildPythonPackage rec {
10 pname = "pglast";
11 version = "5.5";
12 format = "setuptools";
13
14 disabled = pythonOlder "3.7";
15
16 src = fetchPypi {
17 inherit pname version;
18 hash = "sha256-yz6Q+Vt7ZuT9NaxuQQA+BH7U6Efaim7No6GJmnOQo1o=";
19 };
20
21 propagatedBuildInputs = [
22 setuptools
23 ];
24
25 postPatch = ''
26 substituteInPlace setup.cfg \
27 --replace "--cov=pglast --cov-report term-missing" ""
28 '';
29
30 nativeCheckInputs = [
31 pytest
32 ];
33
34 # pytestCheckHook doesn't work
35 # ImportError: cannot import name 'parse_sql' from 'pglast'
36 checkPhase = ''
37 pytest
38 '';
39
40 pythonImportsCheck = [
41 "pglast"
42 "pglast.parser"
43 ];
44
45 meta = with lib; {
46 homepage = "https://github.com/lelit/pglast";
47 description = "PostgreSQL Languages AST and statements prettifier";
48 changelog = "https://github.com/lelit/pglast/blob/v${version}/CHANGES.rst";
49 license = licenses.gpl3Plus;
50 maintainers = with maintainers; [ marsam ];
51 mainProgram = "pgpp";
52 };
53}