nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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 pytest7CheckHook,
13 pythonAtLeast,
14 pyyaml,
15 replaceVars,
16}:
17
18buildPythonPackage rec {
19 pname = "omegaconf";
20 version = "2.3.0";
21 pyproject = true;
22
23 src = fetchFromGitHub {
24 owner = "omry";
25 repo = "omegaconf";
26 tag = "v${version}";
27 hash = "sha256-Qxa4uIiX5TAyQ5rFkizdev60S4iVAJ08ES6FpNqf8zI=";
28 };
29
30 patches = [
31 (replaceVars ./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 build-system = [ setuptools ];
48
49 nativeBuildInputs = [ jre_minimal ];
50
51 dependencies = [
52 antlr4-python3-runtime
53 pyyaml
54 ];
55
56 nativeCheckInputs = [
57 attrs
58 pydevd
59 pytest-mock
60 pytest7CheckHook
61 ];
62
63 pythonImportsCheck = [ "omegaconf" ];
64
65 pytestFlags = [
66 "-Wignore::DeprecationWarning"
67 "-Wignore::UserWarning"
68 ];
69
70 disabledTests = [
71 # assert (1560791320562868035 == 1560791320562868035) == False
72 "test_eq"
73 ]
74 ++ lib.optionals (pythonAtLeast "3.13") [
75 # pathlib._local.Path != pathlib.Path type check mismatch
76 "test_errors"
77 "test_to_yaml"
78 "test_type_str"
79 ];
80
81 meta = {
82 description = "Framework for configuring complex applications";
83 homepage = "https://github.com/omry/omegaconf";
84 changelog = "https://github.com/omry/omegaconf/blob/v${version}/NEWS.md";
85 license = lib.licenses.bsd3;
86 maintainers = with lib.maintainers; [ bcdarwin ];
87 };
88}