1{
2 lib,
3 fetchFromGitHub,
4 buildPythonPackage,
5 importlib-metadata,
6 importlib-resources,
7 setuptools,
8 pythonOlder,
9 pytestCheckHook,
10}:
11
12buildPythonPackage rec {
13 pname = "fake-useragent";
14 version = "1.5.1";
15 pyproject = true;
16
17 disabled = pythonOlder "3.7";
18
19 src = fetchFromGitHub {
20 owner = "fake-useragent";
21 repo = "fake-useragent";
22 rev = "refs/tags/${version}";
23 hash = "sha256-BDXJJeT29GWkN9DoVl8sxXFpV/eMqu3mqlvMr2lzJM8=";
24 };
25
26 postPatch = ''
27 sed -i '/addopts/d' pytest.ini
28 '';
29
30 nativeBuildInputs = [ setuptools ];
31
32 propagatedBuildInputs =
33 [ ]
34 ++ lib.optionals (pythonOlder "3.10") [ importlib-resources ]
35 ++ lib.optionals (pythonOlder "3.8") [ importlib-metadata ];
36
37 nativeCheckInputs = [ pytestCheckHook ];
38
39 pythonImportsCheck = [ "fake_useragent" ];
40
41 meta = with lib; {
42 description = "Up to date simple useragent faker with real world database";
43 homepage = "https://github.com/hellysmile/fake-useragent";
44 changelog = "https://github.com/fake-useragent/fake-useragent/releases/tag/${version}";
45 license = licenses.asl20;
46 maintainers = with maintainers; [ evanjs ];
47 };
48}