1{ stdenv, lib, buildPythonPackage, fetchPypi, fetchpatch, pytz, pytest, freezegun, glibcLocales }:
2
3buildPythonPackage rec {
4 pname = "Babel";
5 version = "2.7.0";
6
7 src = fetchPypi {
8 inherit pname version;
9 sha256 = "e86135ae101e31e2c8ec20a4e0c5220f4eed12487d5cf3f78be7e98d3a57fc28";
10 };
11
12 patches = [
13 # The following 2 patches fix the test suite failing on nix < 2.3 with
14 # Python < 3 because those nix versions do not run in a pseudoterminal,
15 # which makes Python 2 not set the default encoding to UTF-8, and the
16 # Babel code crashes when printing a warning in that case.
17 # See #75676 and https://github.com/python-babel/babel/pull/691.
18 # It is important to fix this because otherwise Babel is not buildable
19 # with older nix versions (e.g. on machines used as --builders).
20 # TODO: Remove at release > 2.8.0.
21 (fetchpatch {
22 name = "Babel-Introduce-invariant-that-invalid_pofile-takes-unicode-line.patch";
23 url = "https://github.com/python-babel/babel/commit/f4f6653e6aa053724d2c6dc0ee71dcb928013352.patch";
24 sha256 = "1kyknwn9blspcf9yxmgdiaxdii1dnkblyhcflqwhxyl1mss1dxv5";
25 })
26 (fetchpatch {
27 name = "Babel-Fix-unicode-printing-error-on-Python-2-without-TTY.patch";
28 url = "https://github.com/python-babel/babel/commit/da7f31143847659b6b74d802618b03438aceb350.patch";
29 sha256 = "09yny8614knr8ngrrddmqzkxk70am135rccv2ncc6dji4xbqbfln";
30 })
31 ];
32
33 propagatedBuildInputs = [ pytz ];
34
35 checkInputs = [ pytest freezegun ];
36
37 doCheck = !stdenv.isDarwin;
38
39 meta = with lib; {
40 homepage = http://babel.edgewall.org;
41 description = "A collection of tools for internationalizing Python applications";
42 license = licenses.bsd3;
43 maintainers = with maintainers; [ ];
44 };
45}