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