1{ lib, buildPythonPackage, fetchPypi, pythonOlder,
2 # Build inputs
3 dateutil, six, text-unidecode, ipaddress ? null
4 # Test inputs
5 , email_validator
6 , freezegun
7 , mock
8 , more-itertools
9 , pytest
10 , pytestrunner
11 , random2
12 , ukpostcodeparser
13}:
14
15assert pythonOlder "3.3" -> ipaddress != null;
16
17buildPythonPackage rec {
18 pname = "Faker";
19 version = "1.0.7";
20
21 src = fetchPypi {
22 inherit pname version;
23 sha256 = "1jins8jlqyxjwx6i2h2jknwwfpi0bpz1qggvw6xnbxl0g9spyiv0";
24 };
25
26 buildInputs = [ pytestrunner ];
27 checkInputs = [
28 email_validator
29 freezegun
30 pytest
31 random2
32 ukpostcodeparser
33 ]
34 ++ lib.optionals (pythonOlder "3.3") [ mock ]
35 ++ lib.optionals (pythonOlder "3.0") [ more-itertools ];
36
37 propagatedBuildInputs = [
38 dateutil
39 six
40 text-unidecode
41 ] ++ lib.optional (pythonOlder "3.3") ipaddress;
42
43 postPatch = ''
44 substituteInPlace setup.py --replace "pytest>=3.8.0,<3.9" "pytest"
45
46 # see https://github.com/joke2k/faker/pull/911, fine since we pin correct
47 # versions for python2
48 substituteInPlace setup.py --replace "more-itertools<6.0.0" "more-itertools"
49
50 # https://github.com/joke2k/faker/issues/970
51 substituteInPlace setup.py --replace "random2==1.0.1" "random2>=1.0.1"
52 substituteInPlace setup.py --replace "freezegun==0.3.11" "freezegun>=0.3.11"
53 '';
54
55 meta = with lib; {
56 description = "A Python library for generating fake user data";
57 homepage = http://faker.rtfd.org;
58 license = licenses.mit;
59 maintainers = with maintainers; [ lovek323 ];
60 platforms = platforms.unix;
61 };
62}