1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 requests,
6 requests-toolbelt,
7 requests-oauthlib,
8 six,
9 pytestCheckHook,
10 responses,
11 pythonOlder,
12 setuptools,
13}:
14
15buildPythonPackage rec {
16 pname = "flickrapi";
17 version = "2.4";
18 pyproject = true;
19
20 disabled = pythonOlder "3.7";
21
22 src = fetchFromGitHub {
23 owner = "sybrenstuvel";
24 repo = "flickrapi";
25 rev = "version-${version}";
26 hash = "sha256-vRZrlXKI0UDdmDevh3XUngH4X8G3VlOCSP0z/rxhIgw=";
27 };
28
29 postPatch = ''
30 substituteInPlace tests/test_tokencache.py \
31 --replace-fail "assertEquals" "assertEqual" \
32 --replace-fail "assertNotEquals" "assertNotEqual"
33 '';
34
35 build-system = [ setuptools ];
36
37 dependencies = [
38 requests
39 requests-toolbelt
40 requests-oauthlib
41 six
42 ];
43
44 nativeCheckInputs = [
45 pytestCheckHook
46 responses
47 ];
48
49 preCheck = ''
50 export HOME=$(mktemp -d);
51 '';
52
53 disabledTests = [
54 # Tests require network access
55 "test_default_format"
56 "test_etree_default_format"
57 "test_etree_format_error"
58 "test_etree_format_happy"
59 "test_explicit_format"
60 "test_json_callback_format"
61 "test_json_format"
62 "test_parsed_json_format"
63 "test_walk"
64 "test_xmlnode_format"
65 "test_xmlnode_format_error"
66 "test_upload"
67 ];
68
69 pythonImportsCheck = [ "flickrapi" ];
70
71 meta = with lib; {
72 description = "Python interface to the Flickr API";
73 homepage = "https://stuvel.eu/flickrapi";
74 changelog = "https://github.com/sybrenstuvel/flickrapi/blob/version-${version}/CHANGELOG.md";
75 license = licenses.psfl;
76 maintainers = with maintainers; [ obadz ];
77 };
78}