Merge pull request #169323 from n0emis/netbox-v3.2.1

authored by Martin Weinelt and committed by GitHub 0a0cf3d2 205157b0

+215 -18
+1 -1
nixos/tests/web-apps/netbox.nix
··· 5 5 maintainers = [ n0emis ]; 6 6 }; 7 7 8 - machine = { ... }: { 8 + nodes.machine = { ... }: { 9 9 services.netbox = { 10 10 enable = true; 11 11 secretKeyFile = pkgs.writeText "secret" ''
+7 -3
pkgs/development/python-modules/graphene-django/default.nix
··· 19 19 20 20 buildPythonPackage rec { 21 21 pname = "graphene-django"; 22 - version = "unstable-2021-06-11"; 22 + version = "unstable-2022-03-03"; 23 23 format = "setuptools"; 24 24 disabled = pythonOlder "3.6"; 25 25 26 26 src = fetchFromGitHub { 27 27 owner = "graphql-python"; 28 28 repo = pname; 29 - rev = "e7f7d8da07ba1020f9916153f17e97b0ec037712"; 30 - sha256 = "0b33q1im90ahp3gzy9wx5amfzy6q57ydjpy5rn988gh81hbyqaxv"; 29 + rev = "f6ec0689c18929344c79ae363d2e3d5628fa4a2d"; 30 + hash = "sha256-KTZ5jcoeHYXnlaF47t8jIi6+7NyMyA4hDPv+il3bt+U="; 31 31 }; 32 + 33 + patches = [ 34 + ./graphene-3_2_0.patch 35 + ]; 32 36 33 37 postPatch = '' 34 38 substituteInPlace setup.py \
+150
pkgs/development/python-modules/graphene-django/graphene-3_2_0.patch
··· 1 + diff --git a/graphene_django/filter/tests/test_fields.py b/graphene_django/filter/tests/test_fields.py 2 + index 7d440f4..0aec6e4 100644 3 + --- a/graphene_django/filter/tests/test_fields.py 4 + +++ b/graphene_django/filter/tests/test_fields.py 5 + @@ -1005,7 +1005,7 @@ def test_integer_field_filter_type(): 6 + 7 + schema = Schema(query=Query) 8 + 9 + - assert str(schema) == dedent( 10 + + assert str(schema).rstrip() + "\n" == dedent( 11 + """\ 12 + type Query { 13 + pets(offset: Int = null, before: String = null, after: String = null, first: Int = null, last: Int = null, age: Int = null): PetTypeConnection 14 + @@ -1074,7 +1074,7 @@ def test_other_filter_types(): 15 + 16 + schema = Schema(query=Query) 17 + 18 + - assert str(schema) == dedent( 19 + + assert str(schema).rstrip() + "\n" == dedent( 20 + """\ 21 + type Query { 22 + pets(offset: Int = null, before: String = null, after: String = null, first: Int = null, last: Int = null, age: Int = null, age_Isnull: Boolean = null, age_Lt: Int = null): PetTypeConnection 23 + diff --git a/graphene_django/tests/test_command.py b/graphene_django/tests/test_command.py 24 + index 70116b8..a4ab4db 100644 25 + --- a/graphene_django/tests/test_command.py 26 + +++ b/graphene_django/tests/test_command.py 27 + @@ -49,7 +49,7 @@ def test_generate_graphql_file_on_call_graphql_schema(): 28 + assert handle.write.called_once() 29 + 30 + schema_output = handle.write.call_args[0][0] 31 + - assert schema_output == dedent( 32 + + assert schema_output.rstrip() + "\n" == dedent( 33 + """\ 34 + type Query { 35 + hi: String 36 + diff --git a/graphene_django/tests/test_types.py b/graphene_django/tests/test_types.py 37 + index bde72c7..0b64440 100644 38 + --- a/graphene_django/tests/test_types.py 39 + +++ b/graphene_django/tests/test_types.py 40 + @@ -247,7 +247,7 @@ def test_schema_representation(): 41 + } 42 + """ 43 + ) 44 + - assert str(schema) == expected 45 + + assert str(schema).rstrip() + "\n" == expected 46 + 47 + 48 + def with_local_registry(func): 49 + @@ -515,7 +515,7 @@ class TestDjangoObjectType: 50 + 51 + schema = Schema(query=Query) 52 + 53 + - assert str(schema) == dedent( 54 + + assert str(schema).rstrip() + "\n" == dedent( 55 + """\ 56 + type Query { 57 + pet: Pet 58 + @@ -541,7 +541,7 @@ class TestDjangoObjectType: 59 + 60 + schema = Schema(query=Query) 61 + 62 + - assert str(schema) == dedent( 63 + + assert str(schema).rstrip() + "\n" == dedent( 64 + """\ 65 + type Query { 66 + pet: Pet 67 + @@ -576,7 +576,7 @@ class TestDjangoObjectType: 68 + 69 + schema = Schema(query=Query) 70 + 71 + - assert str(schema) == dedent( 72 + + assert str(schema).rstrip() + "\n" == dedent( 73 + """\ 74 + type Query { 75 + pet: Pet 76 + @@ -603,7 +603,7 @@ class TestDjangoObjectType: 77 + 78 + schema = Schema(query=Query) 79 + 80 + - assert str(schema) == dedent( 81 + + assert str(schema).rstrip() + "\n" == dedent( 82 + """\ 83 + type Query { 84 + pet: PetModelKind 85 + @@ -642,7 +642,7 @@ class TestDjangoObjectType: 86 + 87 + schema = Schema(query=Query) 88 + 89 + - assert str(schema) == dedent( 90 + + assert str(schema).rstrip() + "\n" == dedent( 91 + """\ 92 + type Query { 93 + pet: PetModelKind 94 + diff --git a/graphene_django/tests/test_views.py b/graphene_django/tests/test_views.py 95 + index 945fa87..e2e8b46 100644 96 + --- a/graphene_django/tests/test_views.py 97 + +++ b/graphene_django/tests/test_views.py 98 + @@ -109,12 +109,10 @@ def test_reports_validation_errors(client): 99 + { 100 + "message": "Cannot query field 'unknownOne' on type 'QueryRoot'.", 101 + "locations": [{"line": 1, "column": 9}], 102 + - "path": None, 103 + }, 104 + { 105 + "message": "Cannot query field 'unknownTwo' on type 'QueryRoot'.", 106 + "locations": [{"line": 1, "column": 21}], 107 + - "path": None, 108 + }, 109 + ] 110 + } 111 + @@ -135,8 +133,6 @@ def test_errors_when_missing_operation_name(client): 112 + "errors": [ 113 + { 114 + "message": "Must provide operation name if query contains multiple operations.", 115 + - "locations": None, 116 + - "path": None, 117 + } 118 + ] 119 + } 120 + @@ -476,8 +472,7 @@ def test_handles_syntax_errors_caught_by_graphql(client): 121 + "errors": [ 122 + { 123 + "locations": [{"column": 1, "line": 1}], 124 + - "message": "Syntax Error: Unexpected Name 'syntaxerror'.", 125 + - "path": None, 126 + + "message": "Syntax Error: Unexpected Name 'syntaxerror'." 127 + } 128 + ] 129 + } 130 + diff --git a/graphene_django/views.py b/graphene_django/views.py 131 + index c23b020..f533f70 100644 132 + --- a/graphene_django/views.py 133 + +++ b/graphene_django/views.py 134 + @@ -11,7 +11,6 @@ from django.views.decorators.csrf import ensure_csrf_cookie 135 + from django.views.generic import View 136 + from graphql import OperationType, get_operation_ast, parse, validate 137 + from graphql.error import GraphQLError 138 + -from graphql.error import format_error as format_graphql_error 139 + from graphql.execution import ExecutionResult 140 + 141 + from graphene import Schema 142 + @@ -387,7 +386,7 @@ class GraphQLView(View): 143 + @staticmethod 144 + def format_error(error): 145 + if isinstance(error, GraphQLError): 146 + - return format_graphql_error(error) 147 + + return error.formatted 148 + 149 + return {"message": str(error)} 150 +
+17
pkgs/development/python-modules/graphene/default.nix
··· 1 1 { lib 2 2 , aniso8601 3 3 , buildPythonPackage 4 + , fetchpatch 4 5 , fetchFromGitHub 5 6 , graphql-core 6 7 , graphql-relay ··· 29 30 sha256 = "0qgp3nl6afyz6y27bw175hyqppx75pp1vqwl7nvlpwvgwyyc2mnl"; 30 31 }; 31 32 33 + patches = [ 34 + # Fix graphql-core 3.2.0 support 35 + (fetchpatch { 36 + # https://github.com/graphql-python/graphene/pull/1378 37 + url = "https://github.com/graphql-python/graphene/commit/989970f89341ebb949962d13dcabca8a6ccddad4.patch"; 38 + hash = "sha256-qRxWTqv5XQN7uFjL2uv9NjTvSLi76/MyFSa4jpkb8to="; 39 + }) 40 + (fetchpatch { 41 + # https://github.com/graphql-python/graphene/pull/1417 42 + url = "https://github.com/graphql-python/graphene/commit/4e0e18d1682b7759bdf16499c573f675c7fb51cb.patch"; 43 + hash = "sha256-icdTGDabJouQ3hVpcMkkeabNwdoDxdVVAboTOWFbO94="; 44 + }) 45 + ]; 46 + 32 47 propagatedBuildInputs = [ 33 48 aniso8601 34 49 graphql-core ··· 53 68 # Expects different Exeception classes, but receives none of them 54 69 # https://github.com/graphql-python/graphene/issues/1346 55 70 "test_unexpected_error" 71 + # https://github.com/graphql-python/graphene/pull/1417#issuecomment-1102492138 72 + "test_example_end_to_end" 56 73 ] ++ lib.optionals (pythonAtLeast "3.10") [ 57 74 "test_objecttype_as_container_extra_args" 58 75 "test_objecttype_as_container_invalid_kwargs"
+19 -14
pkgs/servers/web-apps/netbox/default.nix
··· 10 10 py = python3.override { 11 11 packageOverrides = self: super: { 12 12 django = super.django_3; 13 - graphql-core = super.graphql-core.overridePythonAttrs (old: rec { 14 - version = "3.1.7"; 15 - src = fetchFromGitHub { 16 - owner = "graphql-python"; 17 - repo = old.pname; 18 - rev = "v${version}"; 19 - sha256 = "1mwwh55qd5bcpvgy6pyliwn8jkmj4yk4d2pqb6mdkgqhdic2081l"; 20 - }; 21 - }); 22 13 jsonschema = super.jsonschema.overridePythonAttrs (old: rec { 23 14 version = "3.2.0"; 24 15 src = self.fetchPypi { ··· 28 19 }; 29 20 }); 30 21 lxml = super.lxml.overridePythonAttrs (old: rec { 31 - pname = "lxml"; 32 22 version = "4.6.5"; 33 - 34 23 src = self.fetchPypi { 35 - inherit pname version; 24 + pname = old.pname; 25 + inherit version; 36 26 sha256 = "6e84edecc3a82f90d44ddee2ee2a2630d4994b8471816e226d2b771cda7ac4ca"; 37 27 }; 38 28 }); 29 + werkzeug = super.werkzeug.overridePythonAttrs (old: rec { 30 + version = "2.0.3"; 31 + src = self.fetchPypi { 32 + pname = "Werkzeug"; 33 + inherit version; 34 + sha256 = "sha256-uGP4/wV8UiFktgZ8niiwQRYbS+W6TQ2s7qpQoWOCLTw="; 35 + }; 36 + }); 37 + sentry-sdk = super.sentry-sdk.overridePythonAttrs (old: rec { 38 + disabledTestPaths = old.disabledTestPaths ++ [ 39 + "tests/integrations/flask/test_flask.py" 40 + ]; 41 + }); 39 42 }; 40 43 }; 41 44 ··· 43 46 in 44 47 py.pkgs.buildPythonApplication rec { 45 48 pname = "netbox"; 46 - version = "3.1.10"; 49 + version = "3.2.1"; 47 50 48 51 src = fetchFromGitHub { 49 52 owner = "netbox-community"; 50 53 repo = pname; 51 54 rev = "v${version}"; 52 - sha256 = "sha256-qREq4FJHHTA9Vm6f9kSfiYqur2omFmdsoZ4OdaPFcpU="; 55 + sha256 = "sha256-iA0KIgaHQh0OsN/tXmTATIlvnf0aLRdjeQ6VkiR9VJ4="; 53 56 }; 54 57 55 58 format = "other"; ··· 57 60 patches = [ 58 61 # Allow setting the STATIC_ROOT from within the configuration and setting a custom redis URL 59 62 ./config.patch 63 + ./graphql-3_2_0.patch 60 64 ]; 61 65 62 66 propagatedBuildInputs = with py.pkgs; [ ··· 75 79 django-timezone-field 76 80 djangorestframework 77 81 drf-yasg 82 + swagger-spec-validator # from drf-yasg[validation] 78 83 graphene-django 79 84 jinja2 80 85 markdown
+21
pkgs/servers/web-apps/netbox/graphql-3_2_0.patch
··· 1 + diff --git a/netbox/netbox/graphql/scalars.py b/netbox/netbox/graphql/scalars.py 2 + index 7d14189dd..0a18e79d2 100644 3 + --- a/netbox/netbox/graphql/scalars.py 4 + +++ b/netbox/netbox/graphql/scalars.py 5 + @@ -1,6 +1,6 @@ 6 + from graphene import Scalar 7 + from graphql.language import ast 8 + -from graphql.type.scalars import MAX_INT, MIN_INT 9 + +from graphql.type.scalars import GRAPHQL_MAX_INT, GRAPHQL_MIN_INT 10 + 11 + 12 + class BigInt(Scalar): 13 + @@ -10,7 +10,7 @@ class BigInt(Scalar): 14 + @staticmethod 15 + def to_float(value): 16 + num = int(value) 17 + - if num > MAX_INT or num < MIN_INT: 18 + + if num > GRAPHQL_MAX_INT or num < GRAPHQL_MIN_INT: 19 + return float(num) 20 + return num 21 +