1{ lib
2, antlr4
3, antlr4-python3-runtime
4, buildPythonPackage
5, fetchFromGitHub
6, jre_minimal
7, pydevd
8, pytest-mock
9, pytestCheckHook
10, pythonOlder
11, pyyaml
12, substituteAll
13}:
14
15buildPythonPackage rec {
16 pname = "omegaconf";
17 version = "2.3.0";
18 format = "setuptools";
19
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
36 postPatch = ''
37 # We substitute the path to the jar with the one from our antlr4
38 # package, so this file becomes unused
39 rm -v build_helpers/bin/antlr*-complete.jar
40
41 sed -i 's/antlr4-python3-runtime==.*/antlr4-python3-runtime/' requirements/base.txt
42 '';
43
44 nativeBuildInputs = [
45 jre_minimal
46 ];
47
48 propagatedBuildInputs = [
49 antlr4-python3-runtime
50 pyyaml
51 ];
52
53 nativeCheckInputs = [
54 pydevd
55 pytest-mock
56 pytestCheckHook
57 ];
58
59 pythonImportsCheck = [
60 "omegaconf"
61 ];
62
63 pytestFlagsArray = [
64 "-W"
65 "ignore::DeprecationWarning"
66 ];
67
68 meta = with lib; {
69 description = "Framework for configuring complex applications";
70 homepage = "https://github.com/omry/omegaconf";
71 changelog = "https://github.com/omry/omegaconf/blob/v${version}/NEWS.md";
72 license = licenses.bsd3;
73 maintainers = with maintainers; [ bcdarwin ];
74 };
75}