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