1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 cryptography,
6 fetchFromGitHub,
7 keyring,
8 pytestCheckHook,
9 pythonOlder,
10 pythonRelaxDepsHook,
11 playwright,
12 setuptools,
13 setuptools-scm,
14}:
15
16buildPythonPackage rec {
17 pname = "pycookiecheat";
18 version = "0.7.0";
19 pyproject = true;
20
21 disabled = pythonOlder "3.8";
22
23 src = fetchFromGitHub {
24 owner = "n8henrie";
25 repo = "pycookiecheat";
26 rev = "refs/tags/v${version}";
27 hash = "sha256-x568e4M7fz93hq0y06Grz9GlrjGV38GxWd+PhNiAyBY=";
28 };
29
30 pythonRelaxDeps = [
31 "cryptography"
32 "keyring"
33 ];
34
35 build-system = [
36 setuptools
37 setuptools-scm
38 ];
39
40 nativeBuildInputs = [ pythonRelaxDepsHook ];
41
42 dependencies = [
43 cryptography
44 keyring
45 ];
46
47 nativeCheckInputs = [
48 playwright
49 pytestCheckHook
50 ];
51
52 pythonImportsCheck = [ "pycookiecheat" ];
53
54 preCheck = ''
55 export HOME=$(mktemp -d)
56 '';
57
58 disabledTests = [
59 # Tests want to use playwright executable
60 "test_fake_cookie"
61 "test_firefox_cookies"
62 "test_firefox_get_default_profile"
63 "test_firefox_no_cookies"
64 "test_load_firefox_cookie_db"
65 "test_no_cookies"
66 "test_warns_for_string_browser"
67 ] ++ lib.optionals stdenv.isDarwin [ "test_slack_config" ];
68
69 meta = with lib; {
70 description = "Borrow cookies from your browser's authenticated session for use in Python scripts";
71 homepage = "https://github.com/n8henrie/pycookiecheat";
72 changelog = "https://github.com/n8henrie/pycookiecheat/blob/v${version}/CHANGELOG.md";
73 license = licenses.mit;
74 maintainers = with maintainers; [ fab ];
75 };
76}