1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # build-system
8 setuptools,
9
10 # dependencies
11 click,
12 prettytable,
13 prompt-toolkit,
14 ptable,
15 pygments,
16 requests,
17 rich,
18 urllib3,
19
20 # tests
21 mock,
22 pytestCheckHook,
23 sphinx,
24 testtools,
25 tkinter,
26 zeep,
27}:
28
29buildPythonPackage rec {
30 pname = "softlayer";
31 version = "6.2.6";
32 pyproject = true;
33
34 src = fetchFromGitHub {
35 owner = "softlayer";
36 repo = "softlayer-python";
37 tag = "v${version}";
38 hash = "sha256-qBhnHFFlP4pqlN/SETXEqYyre/ap60wHe9eCfyiB+kA=";
39 };
40
41 build-system = [
42 setuptools
43 ];
44
45 pythonRelaxDeps = [
46 "rich"
47 ];
48
49 dependencies = [
50 click
51 prettytable
52 prompt-toolkit
53 ptable
54 pygments
55 requests
56 rich
57 urllib3
58 ];
59
60 __darwinAllowLocalNetworking = true;
61
62 nativeCheckInputs = [
63 mock
64 pytestCheckHook
65 sphinx
66 testtools
67 tkinter
68 zeep
69 ];
70
71 # Otherwise soap_tests.py will fail to create directory
72 # Permission denied: '/homeless-shelter'
73 preCheck = ''
74 export HOME=$(mktemp -d)
75 '';
76
77 pytestFlagsArray = lib.optionals stdenv.hostPlatform.isDarwin [
78 # SoftLayer.exceptions.TransportError: TransportError(0): ('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer'))
79 "--deselect=tests/CLI/modules/hardware/hardware_basic_tests.py::HardwareCLITests"
80 ];
81
82 disabledTestPaths = [
83 # Test fails with ConnectionError trying to connect to api.softlayer.com
84 "tests/transports/soap_tests.py.unstable"
85 ];
86
87 pythonImportsCheck = [ "SoftLayer" ];
88
89 meta = {
90 description = "Python libraries that assist in calling the SoftLayer API";
91 homepage = "https://github.com/softlayer/softlayer-python";
92 changelog = "https://github.com/softlayer/softlayer-python/releases/tag/v${version}";
93 license = lib.licenses.mit;
94 maintainers = with lib.maintainers; [ onny ];
95 };
96}