1{ lib
2, fetchFromGitHub
3, aspellDicts
4, python3
5}:
6
7python3.pkgs.buildPythonApplication rec {
8 pname = "codespell";
9 version = "2.2.4";
10 format = "pyproject";
11
12 src = fetchFromGitHub {
13 owner = "codespell-project";
14 repo = "codespell";
15 rev = "v${version}";
16 sha256 = "sha256-hyTy6zAH5WrW5Jn/g0irH9xGZErnXJMSUYZaNxMvq2Y=";
17 };
18
19 postPatch = ''
20 substituteInPlace pyproject.toml \
21 --replace "--cov=codespell_lib" "" \
22 --replace "--cov-report=" ""
23 '';
24
25 nativeBuildInputs = with python3.pkgs; [
26 setuptools-scm
27 ];
28
29 nativeCheckInputs = with python3.pkgs; [
30 aspell-python
31 chardet
32 pytestCheckHook
33 pytest-dependency
34 ];
35
36 SETUPTOOLS_SCM_PRETEND_VERSION = version;
37
38 preCheck = ''
39 export ASPELL_CONF="dict-dir ${aspellDicts.en}/lib/aspell"
40 '';
41
42 disabledTests = [
43 # tries to run not fully installed script
44 "test_command"
45 # error 'dateset' should not be in aspell dictionaries (en, en_GB, en_US, en_CA, en_AU) for dictionary /build/source/codespell_lib/tests/../data/dictionary.txt
46 "test_dictionary_formatting"
47 ];
48
49 pythonImportsCheck = [ "codespell_lib" ];
50
51 meta = with lib; {
52 description = "Fix common misspellings in source code";
53 homepage = "https://github.com/codespell-project/codespell";
54 license = with licenses; [ gpl2Only cc-by-sa-30 ];
55 maintainers = with maintainers; [ johnazoidberg SuperSandro2000 ];
56 };
57}