From f07693fcb968f16566955d4b31f0749766a7c5b6c569b300e50879772b8cc939 Mon Sep 17 00:00:00 2001 From: Nico Krapp Date: Wed, 30 Apr 2025 10:42:25 +0000 Subject: [PATCH] needed by Weblate OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-drf-standardized-errors?expand=0&rev=1 --- .gitattributes | 23 +++++++ .gitignore | 1 + drf_standardized_errors-0.14.1.tar.gz | 3 + fix-test.patch | 37 ++++++++++++ python-drf-standardized-errors.changes | 5 ++ python-drf-standardized-errors.spec | 84 ++++++++++++++++++++++++++ 6 files changed, 153 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 drf_standardized_errors-0.14.1.tar.gz create mode 100644 fix-test.patch create mode 100644 python-drf-standardized-errors.changes create mode 100644 python-drf-standardized-errors.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/drf_standardized_errors-0.14.1.tar.gz b/drf_standardized_errors-0.14.1.tar.gz new file mode 100644 index 0000000..4865b30 --- /dev/null +++ b/drf_standardized_errors-0.14.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0610dcd0096b75365102d276022a22e59a1f8db8825bb0bff05e1b7194ba145d +size 58730 diff --git a/fix-test.patch b/fix-test.patch new file mode 100644 index 0000000..1e9ed2f --- /dev/null +++ b/fix-test.patch @@ -0,0 +1,37 @@ +From dbc37d4228bdefa858ab299517097d6e52a0b698 Mon Sep 17 00:00:00 2001 +From: Kerstin Humm +Date: Sat, 15 Feb 2025 15:47:34 +0100 +Subject: [PATCH 1/2] fix test_openapi_utils + +--- + tests/test_openapi_utils.py | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +Index: drf_standardized_errors-0.14.1/tests/test_openapi_utils.py +=================================================================== +--- drf_standardized_errors-0.14.1.orig/tests/test_openapi_utils.py ++++ drf_standardized_errors-0.14.1/tests/test_openapi_utils.py +@@ -1,6 +1,7 @@ + import sys + from unittest import mock + ++import django + import pytest + from django import forms + from django.contrib.auth.models import User +@@ -515,7 +516,14 @@ def test_char_fields_with_error_codes(): + assert slug.error_codes == {"invalid", "null_characters_not_allowed"} + assert regex.error_codes == {"invalid", "required", "null_characters_not_allowed"} + assert uuid.error_codes == {"invalid", "required", "null_characters_not_allowed"} +- assert ip.error_codes == {"invalid", "null_characters_not_allowed"} ++ if django.VERSION >= (4, 2): ++ assert ip.error_codes == { ++ "invalid", ++ "null_characters_not_allowed", ++ "max_length", ++ } ++ else: ++ assert ip.error_codes == {"invalid", "null_characters_not_allowed"} + + + class NumberForm(forms.Form): diff --git a/python-drf-standardized-errors.changes b/python-drf-standardized-errors.changes new file mode 100644 index 0000000..5751801 --- /dev/null +++ b/python-drf-standardized-errors.changes @@ -0,0 +1,5 @@ +------------------------------------------------------------------- +Tue Apr 29 12:58:45 UTC 2025 - Markéta Machová + +- Initial packaging (v0.14.1), needed by Weblate +- Packaged with upstream fix-test.patch to fix tests diff --git a/python-drf-standardized-errors.spec b/python-drf-standardized-errors.spec new file mode 100644 index 0000000..517dbc7 --- /dev/null +++ b/python-drf-standardized-errors.spec @@ -0,0 +1,84 @@ +# +# spec file for package python-drf-standardized-errors +# +# Copyright (c) 2025 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +Name: python-drf-standardized-errors +Version: 0.14.1 +Release: 0 +Summary: Standardize your API error responses +License: MIT +URL: https://github.com/ghazi-git/drf-standardized-errors +Source: https://files.pythonhosted.org/packages/source/d/drf-standardized-errors/drf_standardized_errors-%{version}.tar.gz +# PATCH-FIX-UPSTREAM https://github.com/ghazi-git/drf-standardized-errors/pull/96 fix test_openapi_utils +Patch: fix-test.patch +BuildRequires: python-rpm-macros +BuildRequires: %{python_module flit-core >= 3.2} +BuildRequires: %{python_module pip} +# SECTION test requirements +BuildRequires: %{python_module Django >= 3.2} +BuildRequires: %{python_module django-filter} +BuildRequires: %{python_module djangorestframework >= 3.12} +BuildRequires: %{python_module drf-spectacular >= 0.27.0} +BuildRequires: %{python_module pytest-django} +BuildRequires: %{python_module pytest} +# /SECTION +BuildRequires: fdupes +Requires: python-Django >= 3.2 +Requires: python-djangorestframework >= 3.12 +Suggests: python-pre-commit +Suggests: python-sphinx +Suggests: python-sphinx-autobuild +Suggests: python-sphinx_rtd_theme >= 1.1.0 +Suggests: python-myst-parser +Suggests: python-flit +Suggests: python-keyring +Suggests: python-tbump +Suggests: python-drf-spectacular >= 0.27.0 +Suggests: python-inflection +BuildArch: noarch +%python_subpackages + +%description +# DRF Standardized Errors + +Standardize your DRF API error responses. + +- Highly customizable: gives you flexibility to define your own standardized error responses and override +specific aspects the exception handling process without having to rewrite everything. +- Supports nested serializers and ListSerializer errors +- Plays nicely with error monitoring tools (like Sentry, ...) + +%prep +%autosetup -p1 -n drf_standardized_errors-%{version} + +%build +%pyproject_wheel + +%install +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +export PYTHONPATH=. +export DJANGO_SETTINGS_MODULE=tests.settings +%pytest + +%files %{python_files} +%{python_sitelib}/drf_standardized_errors +%{python_sitelib}/drf_standardized_errors-%{version}.dist-info + +%changelog