Repository navigation
Closed
Description
Issue description
Building pkgsMusl.python27Packages.Babel on latest master fails for me with:
ERROR: test_abort_invalid_po_file (tests.messages.test_pofile.ReadPoTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/build/Babel-2.7.0/tests/messages/test_pofile.py", line 458, in test_abort_invalid_po_file
output = pofile.read_po(buf, locale='fr', abort_invalid=False)
File "/build/Babel-2.7.0/babel/messages/pofile.py", line 377, in read_po
parser.parse(fileobj)
File "/build/Babel-2.7.0/babel/messages/pofile.py", line 310, in parse
self._process_message_line(lineno, line)
File "/build/Babel-2.7.0/babel/messages/pofile.py", line 210, in _process_message_line
self._process_keyword_line(lineno, line, obsolete)
File "/build/Babel-2.7.0/babel/messages/pofile.py", line 222, in _process_keyword_line
self._invalid_pofile(line, lineno, "Start of line didn't match any expected keyword.")
File "/build/Babel-2.7.0/babel/messages/pofile.py", line 325, in _invalid_pofile
print(u"WARNING: Problem on line {0}: {1}".format(lineno + 1, line))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe0' in position 84: ordinal not in range(128)
----------------------------------------------------------------------
Ran 253 tests in 0.432s
FAILED (errors=1)
Relevant code:
nixpkgs/pkgs/development/python-modules/Babel/default.nix
Lines 14 to 20 in e4d1d83
| checkInputs = [ pytest freezegun glibcLocales ]; | |
| doCheck = !stdenv.isDarwin; | |
| preCheck = '' | |
| export LC_ALL="en_US.UTF-8" | |
| ''; |
I think libcLocales is not necessary for musl (see also #43666), but I haven't managed to make that test not fail.
Do locales with Python have to be handled differently with musl somehow?
CC @dtzWill
Metadata
Metadata
Assignees
Labels
No labels
Activity
dtzWill commentedon Dec 3, 2019
Dropping
glibcLocalesand thepreCheckmight be a good idea anyway-- looks like they might not be needed on glibc, at least it seems fine when dropping them locally.I don't have the deps for this handy (using musl), but the usual fix is to drop glibcLocales if possible (or conditionally include it if needed). Right now I'm not remembering why pulling in glibcLocales breaks things (instead of simply being unnecessary), but it's easy enough to test regardless ;).
Can you try dropping glibcLocales and the preCheck, see if that helps or changes things?
FWIW now that we include
C.UTF-8locale in glibc, that's almost always better for things like "generic UTF-8 locale for testing" and avoids hardcoding en_US... all without needing to pull inglibcLocalesfor sake of a reasonable locale.Treewide cleanup of
en_US.UTF-8(andglibcLocaleswhen it is only pulled in to provide that locale) might be a good idea.nh2 commentedon Dec 15, 2019
For me it looks like
glibcLocalesare needed with glibc (normalpython27Packages.Babel) -- but not with Python 3, and Python 3 also works with musl without problems.So it seems to be a Python 2 problem, not a musl problem. I'll make a PR.
nh2 commentedon Dec 15, 2019
PR at #75676.
pythonPackages.Babel: Fix use of glibcLocales, skip musl tests. Fixes N…
jtojnar commentedon Dec 15, 2019
I think the issue might come from the fact that Python 3 defaults to
C.UTF-8, whereas Python 2 toen_US.UTF-8or something. See #20192 (comment)Dropping
glibcLocalesand setting the locale toC.UTF-8for Python 2 might fix it.nh2 commentedon Dec 16, 2019
@jtojnar This does not suffice for me; with this diff on top of #75676
(or commit at nh2@fdf5da6) it still fails with the error on
python27Packages.Babel. So it seemsglibcLocalesis needed on Python 2.7 with glibc.pythonPackages.Babel: Fix use of glibcLocales, skip musl tests. Fixes N…
WIP test for NixOS#74904 (comment)
FRidh commentedon Dec 30, 2019
I pushed d64a456aad9b11628837817d1a64420816bdafcc to
python-unstablewhich hopefully lands in the newstaging-nexttoday. Note I did not test with Musl. I could imagine we would need a change inbuildPythonPackageinstead.pythonPackages.Babel: remove glibcLocales and don't set LC_ALL
pythonPackages.Babel: remove glibcLocales and don't set LC_ALL
nh2 commentedon Jan 28, 2020
Not actually musl related, see #75676 (comment).
Closing.