1{
2 lib,
3 antlr4,
4 antlr4-python3-runtime,
5 attrs,
6 buildPythonPackage,
7 fetchFromGitHub,
8 setuptools,
9 jre_minimal,
10 pydevd,
11 pytest-mock,
12 pytestCheckHook,
13 pythonOlder,
14 pyyaml,
15 substituteAll,
16}:
17
18buildPythonPackage rec {
19 pname = "omegaconf";
20 version = "2.3.0";
21 pyproject = true;
22
23 disabled = pythonOlder "3.6";
24
25 src = fetchFromGitHub {
26 owner = "omry";
27 repo = "omegaconf";
28 rev = "refs/tags/v${version}";
29 hash = "sha256-Qxa4uIiX5TAyQ5rFkizdev60S4iVAJ08ES6FpNqf8zI=";
30 };
31
32 patches = [
33 (substituteAll {
34 src = ./antlr4.patch;
35 antlr_jar = "${antlr4.out}/share/java/antlr-${antlr4.version}-complete.jar";
36 })
37
38 # https://github.com/omry/omegaconf/pull/1137
39 ./0000-add-support-for-dataclasses_missing_type.patch
40 ];
41
42 postPatch = ''
43 # We substitute the path to the jar with the one from our antlr4
44 # package, so this file becomes unused
45 rm -v build_helpers/bin/antlr*-complete.jar
46
47 sed -i 's/antlr4-python3-runtime==.*/antlr4-python3-runtime/' requirements/base.txt
48 '';
49
50 build-system = [ setuptools ];
51
52 nativeBuildInputs = [ jre_minimal ];
53
54 dependencies = [
55 antlr4-python3-runtime
56 pyyaml
57 ];
58
59 nativeCheckInputs = [
60 attrs
61 pydevd
62 pytest-mock
63 pytestCheckHook
64 ];
65
66 pythonImportsCheck = [ "omegaconf" ];
67
68 pytestFlagsArray = [
69 "-W"
70 "ignore::DeprecationWarning"
71 ];
72
73 disabledTests = [ "test_eq" ];
74
75 meta = with lib; {
76 description = "Framework for configuring complex applications";
77 homepage = "https://github.com/omry/omegaconf";
78 changelog = "https://github.com/omry/omegaconf/blob/v${version}/NEWS.md";
79 license = licenses.bsd3;
80 maintainers = with maintainers; [ bcdarwin ];
81 };
82}