Gentoo Archives: gentoo-portage-dev

From: "Anthony G. Basile" <basile@××××××××××××××.edu>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] pym/portage/util/locale.py: add a C module to check locale
Date: Tue, 17 May 2016 13:03:03
Message-Id: 573B167F.70106@opensource.dyc.edu
In Reply to: [gentoo-portage-dev] [PATCH] pym/portage/util/locale.py: add a C module to check locale by "Anthony G. Basile"
1 On 5/17/16 8:47 AM, Anthony G. Basile wrote:
2 > From: "Anthony G. Basile" <blueness@g.o>
3 >
4 > The current method to check for the system locale is to use python's
5 > ctype.util.find_library() to construct a full library path to the
6 > system libc.so which is then passed to ctypes.CDLL(). However,
7 > this gets bogged down in implementation dependant details and
8 > fails with musl.
9 >
10 > We work around this design flaw in ctypes with a small python module
11 > written in C called 'portage_c_check_locale', and only fall back on
12 > the current ctype-based check when this module is not available.
13 >
14 > Since this is the first python module written in C included in portage,
15 > as a side effect, we introduce the machinary for future modules in
16 > setup.py.
17 >
18 > X-Gentoo-bug: 571444
19 > X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=571444
20 > ---
21
22 I didn't want to clutter the commit message, but I'd like to add that I
23 tested this on glibc, uclibc and musl. I also removed the module to
24 make sure the fallback worked.
25
26 BTW, I made two typos in the commit message where I wrote ctype rather
27 than ctypes. I'll fix that on revision (if necessary).
28
29
30 --
31 Anthony G. Basile, Ph. D.
32 Chair of Information Technology
33 D'Youville College
34 Buffalo, NY 14201
35 (716) 829-8197

Replies