about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/editorconfig/default.nix
blob: 32e446d71a3b8e9d4ff906c4c7d6aa6399d24311 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{ lib
, buildPythonPackage
, fetchFromGitHub
, cmake
}:

let
  tests = fetchFromGitHub {
    owner = "editorconfig";
    repo = "editorconfig-core-test";
    rev = "e407c1592df0f8e91664835324dea85146f20189";
    sha256 = "sha256-9WSEkMJOewPqJjB6f7J6Ir0L+U712hkaN+GszjnGw7c=";
  };
in
buildPythonPackage rec {
  pname = "editorconfig";
  version = "0.12.3";

  src = fetchFromGitHub {
    owner = "editorconfig";
    repo = "editorconfig-core-py";
    rev = "v${version}";
    sha256 = "sha256-ZwoTMgk18+BpPNtXKQUMXGcl2Lp+1RQVyPHgk6gHWh8=";
    # workaround until https://github.com/editorconfig/editorconfig-core-py/pull/40 is merged
    # fetchSubmodules = true;
  };

  postUnpack = ''
    cp -r ${tests}/* source/tests
    chmod +w -R source/tests
  '';

  nativeBuildInputs = [
    cmake
  ];

  dontUseCmakeConfigure = true;

  checkPhase = ''
    cmake .
    # utf_8_char fails with Python 3
    ctest -E "utf_8_char" .
  '';

  pythonImportsCheck = [ "editorconfig" ];

  meta = with lib; {
    description = "EditorConfig File Locator and Interpreter for Python";
    homepage = "https://editorconfig.org";
    license = licenses.psfl;
    maintainers = with maintainers; [ ];
  };
}