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 14:23:48
Message-Id: 573B296F.7040901@opensource.dyc.edu
In Reply to: Re: [gentoo-portage-dev] [PATCH] pym/portage/util/locale.py: add a C module to check locale by Brian Dolbec
1 On 5/17/16 9:38 AM, Brian Dolbec wrote:
2 > On Tue, 17 May 2016 09:02:55 -0400
3 > "Anthony G. Basile" <basile@××××××××××××××.edu> wrote:
4 >
5 >> On 5/17/16 8:47 AM, Anthony G. Basile wrote:
6 >>> From: "Anthony G. Basile" <blueness@g.o>
7 >>>
8 >>> The current method to check for the system locale is to use python's
9 >>> ctype.util.find_library() to construct a full library path to the
10 >>> system libc.so which is then passed to ctypes.CDLL(). However,
11 >>> this gets bogged down in implementation dependant details and
12 >>> fails with musl.
13 >>>
14 >>> We work around this design flaw in ctypes with a small python module
15 >>> written in C called 'portage_c_check_locale', and only fall back on
16 >>> the current ctype-based check when this module is not available.
17 >>>
18 >>> Since this is the first python module written in C included in
19 >>> portage, as a side effect, we introduce the machinary for future
20 >>> modules in setup.py.
21 >>>
22 >>> X-Gentoo-bug: 571444
23 >>> X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=571444
24 >>> ---
25 >>
26 >> I didn't want to clutter the commit message, but I'd like to add that
27 >> I tested this on glibc, uclibc and musl. I also removed the module to
28 >> make sure the fallback worked.
29 >
30 >
31 > I don't think this clutters the commit message and is good to
32 > and should be included in it.
33
34 *Everything* should be tested. I wanted to reassure people. I can add
35 a comment on revision.
36
37 >
38 >>
39 >> BTW, I made two typos in the commit message where I wrote ctype rather
40 >> than ctypes. I'll fix that on revision (if necessary).
41 >>
42 >>
43 >
44 > Not being familiar with building/testing c code, is this testable in a
45 > checkout by simply running setup.py build and running the build dir
46 > code? I believe snakeoil has something along those lines for it's
47 > compiled code/pkgcore testing.
48
49 You can use PYTHONPATH to aim it to the right module path, but its
50 variable for each arch/python version.
51
52 >
53 > Overall I like it, but I'll let others review the actual code
54 > implementation since I'm not an experienced "C" coder. In 30
55 > years, I never did more than hello world a few times in C. And the
56 > pascal coding I did in College is more like python than c.
57 >
58 >
59
60
61 --
62 Anthony G. Basile, Ph. D.
63 Chair of Information Technology
64 D'Youville College
65 Buffalo, NY 14201
66 (716) 829-8197