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