1{ lib, python3Packages }:
2
3python3Packages.buildPythonApplication rec {
4 pname = "litecli";
5 version = "1.0.0";
6
7 # Python 2 won't have prompt_toolkit 2.x.x
8 # See: https://github.com/NixOS/nixpkgs/blob/f49e2ad3657dede09dc998a4a98fd5033fb52243/pkgs/top-level/python-packages.nix#L3408
9 disabled = python3Packages.isPy27;
10
11 src = python3Packages.fetchPypi {
12 inherit pname version;
13 sha256 = "0s5a6r5q09144cc5169snwis5i2jrh3z2g4mw9wi2fsjxyhgpwq5";
14 };
15
16 # fixes tests https://github.com/dbcli/litecli/pull/53
17 postPatch = ''
18 substituteInPlace litecli/main.py \
19 --replace 'except FileNotFoundError:' 'except (FileNotFoundError, OSError):'
20 '';
21
22 propagatedBuildInputs = with python3Packages; [
23 cli-helpers
24 click
25 configobj
26 prompt_toolkit
27 pygments
28 sqlparse
29 ];
30
31 checkInputs = with python3Packages; [
32 pytest
33 mock
34 ];
35
36 preCheck = ''
37 export XDG_CONFIG_HOME=$TMP
38 # add missing file
39 echo "litecli is awesome!" > tests/test.txt
40 '';
41
42 meta = with lib; {
43 description = "Command-line interface for SQLite";
44 longDescription = ''
45 A command-line client for SQLite databases that has auto-completion and syntax highlighting.
46 '';
47 homepage = https://litecli.com;
48 license = licenses.bsd3;
49 maintainers = with maintainers; [ Scriptkiddi ];
50 };
51}