public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] Locale check in python_pkg_setup()
@ 2010-07-29 23:16 Arfrever Frehtes Taifersar Arahesis
  2010-07-29 23:20 ` "Paweł Hajdan, Jr."
                   ` (6 more replies)
  0 siblings, 7 replies; 30+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2010-07-29 23:16 UTC (permalink / raw
  To: Gentoo Development


[-- Attachment #1.1: Type: Text/Plain, Size: 244 bytes --]

We received too many invalid bugs caused by unsupported locales. python_pkg_setup() needs to check
locale and print error (using eerror(), without die()), when unsupported locale has been detected.

-- 
Arfrever Frehtes Taifersar Arahesis

[-- Attachment #1.2: python.eclass.patch --]
[-- Type: text/x-patch, Size: 1016 bytes --]

--- python.eclass
+++ python.eclass
@@ -355,6 +355,8 @@
 	# Check if phase is pkg_setup().
 	[[ "${EBUILD_PHASE}" != "setup" ]] && die "${FUNCNAME}() can be used only in pkg_setup() phase"
 
+	local locale
+
 	if [[ "$#" -ne 0 ]]; then
 		die "${FUNCNAME}() does not accept arguments"
 	fi
@@ -407,6 +409,16 @@
 		unset -f python_pkg_setup_check_USE_flags
 	fi
 
+	locale="$(python -c 'import os; print(os.environ.get("LC_ALL", os.environ.get("LC_CTYPE", os.environ.get("LANG", "POSIX"))))')"
+	if [[ "${locale}" != *.UTF-8 ]]; then
+		eerror
+		eerror "Currently used locale '${locale}' is unsupported and can cause build-time or run-time"
+		eerror "problems (usually UnicodeDecodeErrors or UnicodeEncodeErrors). Bugs caused by this locale"
+		eerror "will be closed as invalid. It is recommended to use a UTF-8 locale to avoid problems."
+		eerror "See http://www.gentoo.org/doc/en/utf-8.xml for information on how to fix locale."
+		eerror
+	fi
+
 	PYTHON_PKG_SETUP_EXECUTED="1"
 }
 

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2010-08-05 14:01 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-29 23:16 [gentoo-dev] Locale check in python_pkg_setup() Arfrever Frehtes Taifersar Arahesis
2010-07-29 23:20 ` "Paweł Hajdan, Jr."
2010-07-30  2:29   ` Arfrever Frehtes Taifersar Arahesis
2010-07-30  3:05     ` "Paweł Hajdan, Jr."
2010-07-30  0:13 ` [gentoo-dev] " Jonathan Callen
2010-07-30  2:32   ` Arfrever Frehtes Taifersar Arahesis
2010-07-30  2:36 ` [gentoo-dev] " Brian Harring
2010-07-31 14:44   ` Arfrever Frehtes Taifersar Arahesis
2010-07-31 19:49     ` Alec Warner
2010-07-31 20:10       ` Arfrever Frehtes Taifersar Arahesis
2010-07-31 20:25         ` Petteri Räty
2010-08-02 21:02           ` Arfrever Frehtes Taifersar Arahesis
2010-08-02 21:40             ` Harald van Dijk
2010-07-30  3:15 ` Krzysztof Pawlik
2010-07-30  3:48   ` Brian Harring
2010-07-30 16:49     ` "Paweł Hajdan, Jr."
2010-07-30 18:45       ` Brian Harring
2010-07-31 21:39       ` James Cloos
2010-07-31 22:04         ` Mike Frysinger
2010-07-31 22:14           ` James Cloos
2010-07-31 22:53             ` Mike Frysinger
2010-07-31 23:30         ` [gentoo-dev] " Jonathan Callen
2010-08-05 14:00           ` James Cloos
2010-07-30 16:05 ` [gentoo-dev] " Harald van Dijk
2010-07-31  3:37 ` Mike Frysinger
2010-08-02 21:18 ` Arfrever Frehtes Taifersar Arahesis
2010-08-02 21:40   ` Mike Frysinger
2010-08-02 22:08   ` Jeroen Roovers
2010-08-02 22:13   ` Jeroen Roovers
2010-08-03  0:58   ` Brian Harring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox