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