aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>2015-11-13 22:50:22 +0100
committerArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>2015-11-13 22:50:22 +0100
commitccb1377a18ce8addb21000b0009e360c2641aa8c (patch)
tree4fbe8ff7e993a4497ffdfde0e4f6cf63dc17b505
parentGenChangeLogs: parallelize remaining git calls, scale linearly (bug 565540) (diff)
downloadportage-ccb1377a18ce8addb21000b0009e360c2641aa8c.tar.gz
portage-ccb1377a18ce8addb21000b0009e360c2641aa8c.tar.bz2
portage-ccb1377a18ce8addb21000b0009e360c2641aa8c.zip
_emerge.main.emerge_main(): Make locale variables from configuration files affect locale of emerge process.
-rw-r--r--pym/_emerge/main.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index e75bb0a0d..5a8b93cd3 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1072,7 +1072,7 @@ def emerge_main(args=None):
# Use system locale.
try:
- locale.setlocale(locale.LC_ALL, '')
+ locale.setlocale(locale.LC_ALL, "")
except locale.Error as e:
writemsg_level("setlocale: %s\n" % e, level=logging.WARN)
@@ -1144,6 +1144,19 @@ def emerge_main(args=None):
os.umask(0o22)
emerge_config = load_emerge_config(
action=myaction, args=myfiles, opts=myopts)
+
+ # Make locale variables from configuration files (make.defaults, make.conf) affect locale of emerge process.
+ for locale_var_name in ("LANGUAGE", "LC_ALL", "LC_ADDRESS", "LC_COLLATE", "LC_CTYPE",
+ "LC_IDENTIFICATION", "LC_MEASUREMENT", "LC_MESSAGES", "LC_MONETARY",
+ "LC_NAME", "LC_NUMERIC", "LC_PAPER", "LC_TELEPHONE", "LC_TIME", "LANG"):
+ locale_var_value = emerge_config.running_config.settings.get(locale_var_name)
+ if locale_var_value is not None:
+ os.environ.setdefault(locale_var_name, locale_var_value)
+ try:
+ locale.setlocale(locale.LC_ALL, "")
+ except locale.Error as e:
+ writemsg_level("setlocale: %s\n" % e, level=logging.WARN)
+
rval = profile_check(emerge_config.trees, emerge_config.action)
if rval != os.EX_OK:
return rval