Re: [gentoo-dev] Re: Locale check in python_pkg_setup()
JC == Jonathan Callen a...@gentoo.org writes: JC You can create a POSIX.UTF-8 locale right now, using the same JC /etc/locale.gen mechanism that is used for generating other locales JC (localedef will output a few warnings, but the generated locale JC works just fine from what I can see). JC If there are any issues with those locales besides the warnings that JC localedef outputs, I haven't seen them yet. There will be more errors, such as: , | Cannot open the message catalog man for locale POSIX.UTF-8 | (NLSPATH=none) ` But it is a useful tip. Thanks. -JimC -- James Cloos cl...@jhcloos.com OpenPGP: 1024D/ED7DAEA6
[gentoo-dev] Re: Locale check in python_pkg_setup()
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 07/31/2010 05:39 PM, James Cloos wrote: PH == Paweł Hajdan, phajdan...@gentoo.org writes: PH Another thing we can consider is making UTF8 the default setup in PH Gentoo. I think most people (including me) don't care whether it's PH C or UTF8 as long as it works. Forcing utf-8 will only be reasonable when there is a C.UTF-8 and/or a POSIX.UTF-8 locale. That should be done upstream in glibc, but were they to refuse then Gentoo should add it to the glibc ebuild. The language_country locales are just wrong for root. They are often broken (locales like en_US force case-insensitive colation, meaning that a command such as 'rm [a-z]*' will unlink(2) 'Makefile' and similar files which one would not expect to match) and cause bugs. In fact, glibc's insistance that C and POSIX are ascii rather than raw unspecified eight bit is itself a bug. Utf8 is nice, but forcing the lang_country locales on root is not. -JimC You can create a POSIX.UTF-8 locale right now, using the same /etc/locale.gen mechanism that is used for generating other locales (localedef will output a few warnings, but the generated locale works just fine from what I can see). If you want a C.UTF-8 locale, then you just need to symlink /usr/share/i18n/locales/C to POSIX (or call localedef directly as localedef --add-to-archive -i POSIX -f UTF-8 C.UTF-8). If there are any issues with those locales besides the warnings that localedef outputs, I haven't seen them yet. - -- Jonathan Callen -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.16 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBCAAGBQJMVLH7AAoJELHSF2kinlg4+VYQAIB/Qc3Oq6lmK6tgiXADjk1Y ICMCTbxyuCRNkfllwVqqIKEMUE/UmkqIjkY2/1m2uHp3kIm8tErSa1AohdSoJncc 7LIH17daM7T9XylA7DoqX7et3E3mtl8SerGHFMQ7ae0qYMUkbnNeyeUq4mVhH35G IazjLFCIn0KlLmsim+8ILh8OQ4NWGK1JQlqXDluxHb3BVK37XDLWmvz5gG1+CTmS KrmL3ek+BujiHOfAuvc86jFi9rWMP/yPh8OMIOsG41e/4hdNnhhhwiF0MHRs6bpO Ql3FLsQjS5J7o6MC5690r/Ov/qHj/PAVITXft5cEQhq/gK17sg5TM5zs1JZxNMpH T5z8LuSJenB6hF/+Gk0aew0XKig52539KZRnYShyl9z0QlLUlmwj0L3t8cFnm1in 2ttaeVttc4P2gwaF5Uf4ljEPFJ5w3lVIsXtRJklcPOjDUlCwnpYU0y5GS7RtAXJG l/4Ax2/yW8P070dg7AoYh1WVTY1ChsyRNTECFYfge8ra5OnXT9HJPVBm7FFTof+L IYXJ8zOGnDm32xsiov0LsrYC5KiD+FixkqTiPUHnbZm9KmI/HCyvnODm3cD+k8ts Ht4JXxdVPEjv37bpDgdSbrI2vFb3sfpdH/wY1LMoAU00p9f/xwM2d9R1i+Q08CBV 74aYdVDpAQi5Kqevehw8 =7bB7 -END PGP SIGNATURE-
[gentoo-dev] Re: Locale check in python_pkg_setup()
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 07/29/2010 07:16 PM, Arfrever Frehtes Taifersar Arahesis wrote: + locale=$(python -c 'import os; print(os.environ.get(LC_ALL, os.environ.get(LC_CTYPE, os.environ.get(LANG, POSIX') + if [[ ${locale} != *.UTF-8 ]]; then Shouldn't you be checking the output of `locale charmap` instead of the actual contents of the LC_ALL/LC_CTYPE/LANG variables? You currently are reporting an error if someone is using the en_US.utf8 locale (which *is* a legal UTF-8 locale, and should not be an error). - -- Jonathan Callen -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.16 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBCAAGBQJMUhkgAAoJELHSF2kinlg4dwYQAKkGNSIQJR+2If0c97MSTWZz hj5UAUrj+hYsxdg4rjOt/J6rGdh/iG+v1OwzaGZy0GZpb3O/KKajrfbYDaarGXMp RwHviKOh+jVZqnaCKF63Iz4F80BaEJpvuQBfU0zrwRVlvl5nVS9HaOuwXslFKFJr ge4ygrsRkKWqenaVZbjvWnYWeFWxMHF3iGH77uWrAci04cDArJjNX6puCKiwCMEt F/+aXro7DqkyZws084L1xjovfWs9HcbdkGPMsQ5TR48MqRIDRDuxKiNoRhRQoDjM qSUKR8FpZtTcrXyIsPrZw85f2XAAsXXdW6aMwVcpj9rS7JxNeM8/383Z5A+i/za2 iyynZcBhZj1jYOWtghCvfOeKHdO+s6iBPRg/yN7WAashiS6cCa+hBwXeHT1YDw1V iXSKfSKQnPcT1sqXqtZ7IkLKvXxG0PTNIrpIJya7SXCKTlZP97E6uVZcJeYYOT3Y sN0FqCxJ7F7SIRndfC4Q9fxU6wxcNICoB6VF1jkpyYccO7XyjFqL9zNfd9+2Pe6u hqAVZpae7GbE5NJJnkWvb7fQj0PVdhlk54dUdr9p5cinKnfV2hPW+23lSInpkgdw Oa1ZMUy1G9+lEUsCN2ve/l3gfuUAWXeZx/Nuo6ieuJ/HJLFkAn9Cbbpy9C+VlkxN K2S4CEu16mDy9zgrrbq+ =w5tr -END PGP SIGNATURE-
Re: [gentoo-dev] Re: Locale check in python_pkg_setup()
2010-07-30 02:13:20 Jonathan Callen napisał(a): On 07/29/2010 07:16 PM, Arfrever Frehtes Taifersar Arahesis wrote: + locale=$(python -c 'import os; print(os.environ.get(LC_ALL, os.environ.get(LC_CTYPE, os.environ.get(LANG, POSIX') + if [[ ${locale} != *.UTF-8 ]]; then Shouldn't you be checking the output of `locale charmap` instead of the actual contents of the LC_ALL/LC_CTYPE/LANG variables? You currently are reporting an error if someone is using the en_US.utf8 locale (which *is* a legal UTF-8 locale, and should not be an error). OK. I will check output of `locale charmap`, but the actual locale is more useful in error message. -- Arfrever Frehtes Taifersar Arahesis --- python.eclass +++ python.eclass @@ -355,6 +355,8 @@ # Check if phase is pkg_setup(). [[ ${EBUILD_PHASE} != setup ]] die ${FUNCNAME}() can be used only in pkg_setup() phase + local locale + if [[ $# -ne 0 ]]; then die ${FUNCNAME}() does not accept arguments fi @@ -407,6 +409,16 @@ unset -f python_pkg_setup_check_USE_flags fi + if [[ $(locale charmap) != UTF-8 ]]; then + locale=$(python -c 'import os; print(os.environ.get(LC_ALL, os.environ.get(LC_CTYPE, os.environ.get(LANG, POSIX') + eerror + eerror Currently used locale '${locale}' is unsupported and can cause build-time or run-time + eerror problems (usually UnicodeDecodeErrors or UnicodeEncodeErrors). Bugs caused by this locale + eerror will be closed as invalid. It is recommended to use a UTF-8 locale to avoid problems. + eerror See http://www.gentoo.org/doc/en/utf-8.xml for information on how to fix locale. + eerror + fi + PYTHON_PKG_SETUP_EXECUTED=1 } signature.asc Description: This is a digitally signed message part.