1{ lib
2, brotli
3, buildPythonPackage
4, fetchFromGitHub
5, fetchpatch
6, httpretty
7, ijson
8, poetry-core
9, python-magic
10, pytz
11, pytestCheckHook
12, requests-oauthlib
13}:
14
15buildPythonPackage rec {
16 pname = "pysnow";
17 version = "0.7.16";
18 format = "pyproject";
19
20
21 src = fetchFromGitHub {
22 owner = "rbw";
23 repo = pname;
24 rev = version;
25 hash = "sha256-nKOPCkS2b3ObmBnk/7FTv4o4vwUX+tOtZI5OQQ4HSTY=";
26 };
27
28 nativeBuildInputs = [
29 poetry-core
30 ];
31
32 propagatedBuildInputs = [
33 brotli
34 ijson
35 python-magic
36 pytz
37 requests-oauthlib
38 ];
39
40 nativeCheckInputs = [
41 httpretty
42 pytestCheckHook
43 ];
44
45 patches = [
46 # Switch to peotry-core, https://github.com/rbw/pysnow/pull/183
47 (fetchpatch {
48 name = "switch-to-poetry-core.patch";
49 url = "https://github.com/rbw/pysnow/commit/f214a203432b329df5317f3a25b2c0d9b55a9029.patch";
50 hash = "sha256-ViRR+9WStlaQwyrLGk/tMOUAcEMY+kB61ZEKGMQJ30o=";
51 })
52 ];
53
54 postPatch = ''
55 substituteInPlace pyproject.toml \
56 --replace 'ijson = "^2.5.1"' 'ijson = "*"' \
57 --replace 'pytz = "^2019.3"' 'pytz = "*"' \
58 --replace 'oauthlib = "^3.1.0"' 'oauthlib = "*"'
59 '';
60
61 pythonImportsCheck = [
62 "pysnow"
63 ];
64
65 meta = with lib; {
66 description = "ServiceNow HTTP client library written in Python";
67 homepage = "https://github.com/rbw/pysnow";
68 license = licenses.mit;
69 maintainers = with maintainers; [ almac ];
70 };
71
72}