1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, cmake
5}:
6
7let
8 tests = fetchFromGitHub {
9 owner = "editorconfig";
10 repo = "editorconfig-core-test";
11 rev = "e407c1592df0f8e91664835324dea85146f20189";
12 sha256 = "sha256-9WSEkMJOewPqJjB6f7J6Ir0L+U712hkaN+GszjnGw7c=";
13 };
14in
15buildPythonPackage rec {
16 pname = "editorconfig";
17 version = "0.12.3";
18
19 src = fetchFromGitHub {
20 owner = "editorconfig";
21 repo = "editorconfig-core-py";
22 rev = "v${version}";
23 sha256 = "sha256-ZwoTMgk18+BpPNtXKQUMXGcl2Lp+1RQVyPHgk6gHWh8=";
24 # workaround until https://github.com/editorconfig/editorconfig-core-py/pull/40 is merged
25 # fetchSubmodules = true;
26 };
27
28 postUnpack = ''
29 cp -r ${tests}/* source/tests
30 chmod +w -R source/tests
31 '';
32
33 checkInputs = [
34 cmake
35 ];
36
37 dontUseCmakeConfigure = true;
38
39 checkPhase = ''
40 cmake .
41 # utf_8_char fails with Python 3
42 ctest -E "utf_8_char" .
43 '';
44
45 pythonImportsCheck = [ "editorconfig" ];
46
47 meta = with lib; {
48 description = "EditorConfig File Locator and Interpreter for Python";
49 homepage = "https://github.com/editorconfig/editorconfig-core-py";
50 license = licenses.psfl;
51 maintainers = with maintainers; [ SuperSandro2000 ];
52 };
53}