Add assert_locale.patch to warn about wrong locale.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-distro?expand=0&rev=13
This commit is contained in:
Matej Cepl 2019-02-05 10:56:20 +00:00 committed by Git OBS Bridge
parent 1e406ccb9d
commit 9689d35fcd
3 changed files with 17 additions and 4 deletions

7
assert_locale.patch Normal file
View File

@ -0,0 +1,7 @@
--- /dev/null
+++ b/tests/__init__.py
@@ -0,0 +1,4 @@
+import locale
+enc = locale.getpreferredencoding()
+assert enc is not None and enc.lower() != "ansi_x3.4-1968", \
+ "Tests don't work with locale encoding set to {}".format(enc)

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Feb 5 11:48:38 CET 2019 - Matej Cepl <mcepl@suse.com>
- Add assert_locale.patch to warn about wrong locale.
-------------------------------------------------------------------
Wed Jun 13 16:52:25 UTC 2018 - mcepl@suse.com

View File

@ -1,7 +1,7 @@
#
# spec file for package python-distro
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -12,7 +12,7 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
@ -27,6 +27,7 @@ License: Apache-2.0
Group: Development/Languages/Python
URL: https://github.com/nir0s/distro
Source: https://files.pythonhosted.org/packages/source/d/distro/distro-%{version}.tar.gz
Patch0: assert_locale.patch
BuildRequires: %{python_module setuptools}
BuildRequires: python-rpm-macros
BuildArch: noarch
@ -47,6 +48,7 @@ It is a renewed alternative implementation for Python's original platform.linux_
%prep
%setup -q -n distro-%{version}
%patch0 -p1
%build
%python_build
@ -56,8 +58,7 @@ It is a renewed alternative implementation for Python's original platform.linux_
%if %{with test}
%check
# Explicit settings of locale is necessary
# https://github.com/nir0s/distro/issues/223
# Explicit settings of locale is necessary gh#nir0s/distro#223
LANG=en_US.utf8 %python_exec setup.py pytest
%endif