Blob Blame History Raw
From 30290f021b58d381ce2baaa393a4902fb69e624a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Sun, 10 Mar 2019 11:54:59 +0100
Subject: [PATCH] Suppress errors when setting LC_COLLATE, the problem is not
 fatal

Fixes https://github.com/rpm-software-management/rpmlint/issues/198
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1668400
---
 rpmlint | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/rpmlint b/rpmlint
index dd835ba..cc8f327 100755
--- a/rpmlint
+++ b/rpmlint
@@ -9,6 +9,7 @@
 #                 the checks.
 #############################################################################
 
+import contextlib
 import getopt
 import glob
 import locale
@@ -89,7 +90,9 @@ def loadCheck(name):
 #############################################################################
 def main():
 
-    locale.setlocale(locale.LC_COLLATE, '')
+    # we'll try to sort with locale settings, but we don't fail if not possible
+    with contextlib.suppress(locale.Error):
+        locale.setlocale(locale.LC_COLLATE, '')
 
     # Add check dirs to the front of load path
     sys.path[0:0] = Config.checkDirs()
-- 
2.20.1