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