From 9689d35fcdf5847c2d15a6035e92871f4a8431ed46310bc37c84814f19dd1824 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Tue, 5 Feb 2019 10:56:20 +0000 Subject: [PATCH] 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 --- assert_locale.patch | 7 +++++++ python-distro.changes | 5 +++++ python-distro.spec | 9 +++++---- 3 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 assert_locale.patch diff --git a/assert_locale.patch b/assert_locale.patch new file mode 100644 index 0000000..bb4fcff --- /dev/null +++ b/assert_locale.patch @@ -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) diff --git a/python-distro.changes b/python-distro.changes index b761186..90b2697 100644 --- a/python-distro.changes +++ b/python-distro.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Feb 5 11:48:38 CET 2019 - Matej Cepl + +- Add assert_locale.patch to warn about wrong locale. + ------------------------------------------------------------------- Wed Jun 13 16:52:25 UTC 2018 - mcepl@suse.com diff --git a/python-distro.spec b/python-distro.spec index 23b84ba..409db75 100644 --- a/python-distro.spec +++ b/python-distro.spec @@ -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