From: "Harald van Dijk" <truedfx@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] Locale check in python_pkg_setup()
Date: Mon, 2 Aug 2010 23:40:32 +0200 [thread overview]
Message-ID: <20100802214032.GA1584@boostbox> (raw)
In-Reply-To: <201008022303.20713.Arfrever@gentoo.org>
On Mon, Aug 02, 2010 at 11:02:20PM +0200, Arfrever Frehtes Taifersar Arahesis wrote:
> It would have to be parsed using e.g. grep and sed. It's easier to call Python in this case.
It's even easier not to.
> The call to Python is sufficiently fast:
>
> $ time python -c 'import os; print(os.environ.get("LC_ALL", os.environ.get("LC_CTYPE", os.environ.get("LANG", "POSIX"))))' > /dev/null
>
> real 0m0.062s
> user 0m0.051s
> sys 0m0.011s
Let's compare. On my system:
time python -c 'import os; print(os.environ.get("LC_ALL", os.environ.get("LC_CTYPE", os.environ.get("LANG", "POSIX"))))'
en_GB.UTF-8
real 0m0.020s
user 0m0.016s
sys 0m0.004s
time sh -c 'echo "${LC_ALL:-${LC_CTYPE:-${LANG:-POSIX}}}"'
en_GB.UTF-8
real 0m0.001s
user 0m0.000s
sys 0m0.000s
And that's after several runs for both, so it's not caused by the
initial load of python, which wasn't in memory yet.
Yes, 0.019s is very little, but in this case I see absolutely no benefit
whatsoever in calling python. Plus sh has the advantage of actually
working when LC_ALL is exported as "" (which in LC_* means the same as
having it unset)...
But why exactly are you concerned about LC_* being defined but not
exported anyway? You're checking from an ebuild; locales are going to
get inherited from portage or profile.env anyway, so you can just
assume that if they _are_ set, they're exported. The only way they might
not be is if the user is messing with the locale from the bashrc, and if
the user's doing that, the user really needs to fix the bashrc and
export the vars anyway.
None of this changes the fact that locale checks warns about bugs in packages,
not bugs in the user's configuration.
next prev parent reply other threads:[~2010-08-02 21:39 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100802214032.GA1584@boostbox \
--to=truedfx@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox