1 |
--- |
2 |
pym/portage/eapi.py | 9 +++++++-- |
3 |
pym/portage/package/ebuild/config.py | 5 +++++ |
4 |
pym/portage/package/ebuild/doebuild.py | 2 +- |
5 |
pym/portage/util/locale.py | 21 +++++++++++++++++++++ |
6 |
4 files changed, 34 insertions(+), 3 deletions(-) |
7 |
|
8 |
diff --git a/pym/portage/eapi.py b/pym/portage/eapi.py |
9 |
index 4f77910..1709026 100644 |
10 |
--- a/pym/portage/eapi.py |
11 |
+++ b/pym/portage/eapi.py |
12 |
@@ -1,4 +1,4 @@ |
13 |
-# Copyright 2010-2012 Gentoo Foundation |
14 |
+# Copyright 2010-2015 Gentoo Foundation |
15 |
# Distributed under the terms of the GNU General Public License v2 |
16 |
|
17 |
import collections |
18 |
@@ -68,6 +68,10 @@ def eapi_has_required_use_at_most_one_of(eapi): |
19 |
def eapi_has_use_dep_defaults(eapi): |
20 |
return eapi not in ("0", "1", "2", "3") |
21 |
|
22 |
+def eapi_requires_posixish_locale(eapi): |
23 |
+ return eapi not in ("0", "1", "2", "3", "4", "4-python", "4-slot-abi", |
24 |
+ "5", "5-progress", "5-hdepend") |
25 |
+ |
26 |
def eapi_has_repo_deps(eapi): |
27 |
return eapi in ("4-python", "5-progress") |
28 |
|
29 |
@@ -98,7 +102,7 @@ def eapi_has_targetroot(eapi): |
30 |
_eapi_attrs = collections.namedtuple('_eapi_attrs', |
31 |
'dots_in_PN dots_in_use_flags exports_EBUILD_PHASE_FUNC ' |
32 |
'feature_flag_test feature_flag_targetroot ' |
33 |
- 'hdepend iuse_defaults iuse_effective ' |
34 |
+ 'hdepend iuse_defaults iuse_effective posixish_locale ' |
35 |
'repo_deps required_use required_use_at_most_one_of slot_operator slot_deps ' |
36 |
'src_uri_arrows strong_blocks use_deps use_dep_defaults') |
37 |
|
38 |
@@ -129,6 +133,7 @@ def _get_eapi_attrs(eapi): |
39 |
hdepend = (eapi is not None and eapi_has_hdepend(eapi)), |
40 |
iuse_defaults = (eapi is None or eapi_has_iuse_defaults(eapi)), |
41 |
iuse_effective = (eapi is not None and eapi_has_iuse_effective(eapi)), |
42 |
+ posixish_locale = (eapi is not None and eapi_requires_posixish_locale(eapi)), |
43 |
repo_deps = (eapi is None or eapi_has_repo_deps(eapi)), |
44 |
required_use = (eapi is None or eapi_has_required_use(eapi)), |
45 |
required_use_at_most_one_of = (eapi is None or eapi_has_required_use_at_most_one_of(eapi)), |
46 |
diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py |
47 |
index 40aa99d..4d07638 100644 |
48 |
--- a/pym/portage/package/ebuild/config.py |
49 |
+++ b/pym/portage/package/ebuild/config.py |
50 |
@@ -24,6 +24,7 @@ portage.proxy.lazyimport.lazyimport(globals(), |
51 |
'portage.dep.soname.SonameAtom:SonameAtom', |
52 |
'portage.dbapi.vartree:vartree', |
53 |
'portage.package.ebuild.doebuild:_phase_func_map', |
54 |
+ 'portage.util.locale:split_LC_ALL', |
55 |
) |
56 |
from portage import bsd_chflags, \ |
57 |
load_mod, os, selinux, _unicode_decode |
58 |
@@ -2769,6 +2770,10 @@ class config(object): |
59 |
if phase_func is not None: |
60 |
mydict["EBUILD_PHASE_FUNC"] = phase_func |
61 |
|
62 |
+ if eapi_attrs.requires_posixish_locale: |
63 |
+ split_LC_ALL(mydict) |
64 |
+ mysettings["LC_COLLATE"] = "C" |
65 |
+ |
66 |
return mydict |
67 |
|
68 |
def thirdpartymirrors(self): |
69 |
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py |
70 |
index ff8958e..6f7d25b 100644 |
71 |
--- a/pym/portage/package/ebuild/doebuild.py |
72 |
+++ b/pym/portage/package/ebuild/doebuild.py |
73 |
@@ -42,7 +42,7 @@ portage.proxy.lazyimport.lazyimport(globals(), |
74 |
'portage.util._async.SchedulerInterface:SchedulerInterface', |
75 |
'portage.util._eventloop.EventLoop:EventLoop', |
76 |
'portage.util._eventloop.global_event_loop:global_event_loop', |
77 |
- 'portage.util.ExtractKernelVersion:ExtractKernelVersion' |
78 |
+ 'portage.util.ExtractKernelVersion:ExtractKernelVersion', |
79 |
) |
80 |
|
81 |
from portage import bsd_chflags, \ |
82 |
diff --git a/pym/portage/util/locale.py b/pym/portage/util/locale.py |
83 |
index 6919ceb..570f6f0 100644 |
84 |
--- a/pym/portage/util/locale.py |
85 |
+++ b/pym/portage/util/locale.py |
86 |
@@ -16,6 +16,15 @@ from portage.util import writemsg_level |
87 |
from portage.util._ctypes import find_library, LoadLibrary |
88 |
|
89 |
|
90 |
+locale_categories = ( |
91 |
+ 'LC_COLLATE', 'LC_CTYPE', 'LC_MONETARY', 'LC_MESSAGES', |
92 |
+ 'LC_NUMERIC', 'LC_TIME', |
93 |
+ # GNU extensions |
94 |
+ 'LC_ADDRESS', 'LC_IDENTIFICATION', 'LC_MEASUREMENT', 'LC_NAME', |
95 |
+ 'LC_PAPER', 'LC_TELEPHONE', |
96 |
+) |
97 |
+ |
98 |
+ |
99 |
def check_locale(): |
100 |
""" |
101 |
Check whether the locale is sane. Returns True if it is, prints |
102 |
@@ -61,3 +70,15 @@ def check_locale(): |
103 |
return False |
104 |
|
105 |
return True |
106 |
+ |
107 |
+ |
108 |
+def split_LC_ALL(env): |
109 |
+ """ |
110 |
+ Replace LC_ALL with split-up LC_* variables if it is defined. |
111 |
+ Works on the passed environment (or settings instance). |
112 |
+ """ |
113 |
+ lc_all = env.get("LC_ALL") |
114 |
+ if lc_all is not None: |
115 |
+ for c in locale_categories: |
116 |
+ env[c] = lc_all |
117 |
+ del env["LC_ALL"] |
118 |
-- |
119 |
2.6.3 |