btrbk: add mainProgram
[NixPkgs.git] / pkgs / by-name / az / azure-cli / python-packages.nix
blob68d452e58046460b92ce93934c79c1ffae48b9f9
2   stdenv,
3   python3,
4   fetchPypi,
5   src,
6   version,
7 }:
9 let
10   buildAzureCliPackage = with py.pkgs; buildPythonPackage;
12   overrideAzureMgmtPackage =
13     package: version: extension: hash:
14     package.overridePythonAttrs (oldAttrs: {
15       inherit version;
17       src = fetchPypi {
18         inherit (oldAttrs) pname;
19         inherit version hash extension;
20       };
21     });
23   py = python3.override {
24     self = py;
25     packageOverrides = self: super: {
26       inherit buildAzureCliPackage;
28       # core and the actual application are highly coupled
29       azure-cli-core = buildAzureCliPackage {
30         pname = "azure-cli-core";
31         inherit version src;
33         sourceRoot = "${src.name}/src/azure-cli-core";
35         patches = [
36           # Adding the possibility to configure an immutable configuration dir via `AZURE_IMMUTABLE_DIR`.
37           # This enables us to place configuration files that alter the behavior of the CLI in the Nix store.
38           #
39           # This is a downstream patch without an commit or PR upstream.
40           # There is an issue to discuss possible solutions upstream:
41           # https://github.com/Azure/azure-cli/issues/28093
42           ./0001-optional-immutable-configuration-dir.patch
43         ];
45         propagatedBuildInputs =
46           with self;
47           [
48             argcomplete
49             azure-cli-telemetry
50             azure-common
51             azure-mgmt-core
52             cryptography
53             distro
54             humanfriendly
55             jmespath
56             knack
57             microsoft-security-utilities-secret-masker
58             msal-extensions
59             msal
60             msrestazure
61             packaging
62             paramiko
63             pkginfo
64             psutil
65             pyjwt
66             pyopenssl
67             requests
68           ]
69           ++ requests.optional-dependencies.socks;
71         nativeCheckInputs = with self; [ pytest ];
73         doCheck = stdenv.hostPlatform.isLinux;
75         # ignore tests that does network call, or assume powershell
76         checkPhase = ''
77           python -c 'import azure.common; print(azure.common)'
79           PYTHONPATH=$PWD:${src}/src/azure-cli-testsdk:$PYTHONPATH HOME=$TMPDIR pytest \
80             azure/cli/core/tests \
81             --ignore=azure/cli/core/tests/test_profile.py \
82             --ignore=azure/cli/core/tests/test_generic_update.py \
83             --ignore=azure/cli/core/tests/test_cloud.py \
84             --ignore=azure/cli/core/tests/test_extension.py \
85             -k 'not metadata_url and not test_send_raw_requests and not test_format_styled_text_legacy_powershell'
86         '';
88         pythonImportsCheck = [
89           "azure.cli.telemetry"
90           "azure.cli.core"
91         ];
93         meta.downloadPage = "https://github.com/Azure/azure-cli/tree/azure-cli-${version}/src/azure-cli-core/";
94       };
96       azure-cli-telemetry = buildAzureCliPackage {
97         pname = "azure-cli-telemetry";
98         version = "1.1.0";
99         inherit src;
101         sourceRoot = "${src.name}/src/azure-cli-telemetry";
103         propagatedBuildInputs = with self; [
104           applicationinsights
105           portalocker
106         ];
108         nativeCheckInputs = with self; [ pytest ];
109         # ignore flaky test
110         checkPhase = ''
111           cd azure
112           HOME=$TMPDIR pytest -k 'not test_create_telemetry_note_file_from_scratch'
113         '';
115         meta.downloadPage = "https://github.com/Azure/azure-cli/blob/azure-cli-${version}/src/azure-cli-telemetry/";
116       };
118       # AttributeError: type object 'WorkspacesOperations' has no attribute 'begin_delete'
119       azure-mgmt-batchai =
120         overrideAzureMgmtPackage super.azure-mgmt-batchai "7.0.0b1" "zip"
121           "sha256-mT6vvjWbq0RWQidugR229E8JeVEiobPD3XA/nDM3I6Y=";
123       azure-mgmt-billing =
124         (overrideAzureMgmtPackage super.azure-mgmt-billing "6.0.0" "zip"
125           "sha256-1PXFpBiKRW/h6zK2xF9VyiBpx0vkHrdpIYQLOfL1wH8="
126         ).overridePythonAttrs
127           (attrs: {
128             propagatedBuildInputs = attrs.propagatedBuildInputs or [ ] ++ [
129               self.msrest
130               self.msrestazure
131             ];
132           });
134       # AttributeError: type object 'CustomDomainsOperations' has no attribute 'disable_custom_https'
135       azure-mgmt-cdn =
136         overrideAzureMgmtPackage super.azure-mgmt-cdn "12.0.0" "zip"
137           "sha256-t8PuIYkjS0r1Gs4pJJJ8X9cz8950imQtbVBABnyMnd0=";
139       # ImportError: cannot import name 'SqlDedicatedGatewayServiceResourceCreateUpdateProperties' from 'azure.mgmt.cosmosdb.models'
140       azure-mgmt-cosmosdb =
141         overrideAzureMgmtPackage super.azure-mgmt-cosmosdb "9.5.1" "tar.gz"
142           "sha256-TlXTlz8RzwLPeoBVruhmFSM9fL47siegfBdrrIvH7wI=";
144       # ValueError: The operation 'azure.mgmt.devtestlabs.operations#VirtualMachinesOperations.delete' is invalid.
145       azure-mgmt-devtestlabs =
146         overrideAzureMgmtPackage super.azure-mgmt-devtestlabs "4.0.0" "zip"
147           "sha256-WVScTEBo8mRmsQl7V0qOUJn7LNbIvgoAOVsG07KeJ40=";
149       # ImportError: cannot import name 'ResourceSku' from 'azure.mgmt.eventgrid.models'
150       azure-mgmt-eventgrid =
151         overrideAzureMgmtPackage super.azure-mgmt-eventgrid "10.2.0b2" "zip"
152           "sha256-QcHY1wCwQyVOEdUi06/wEa4dqJH5Ccd33gJ1Sju0qZA=";
154       # ValueError: The operation 'azure.mgmt.hdinsight.operations#ExtensionsOperations.get_azure_monitor_agent_status' is invalid.
155       azure-mgmt-hdinsight =
156         overrideAzureMgmtPackage super.azure-mgmt-hdinsight "9.0.0b3" "tar.gz"
157           "sha256-clSeCP8+7T1uI4Nec+zhzDK980C9+JGeeJFsNSwgD2Q=";
159       # ValueError: The operation 'azure.mgmt.kusto.operations#ClustersOperations.delete' is invalid.
160       azure-mgmt-kusto =
161         (overrideAzureMgmtPackage super.azure-mgmt-kusto "0.3.0" "zip"
162           "sha256-nri3eB/UQQ7p4gfNDDmDuvnlhBS1tKGISdCYVuNrrN4="
163         ).overridePythonAttrs
164           (attrs: {
165             propagatedBuildInputs = attrs.propagatedBuildInputs or [ ] ++ [
166               self.msrest
167               self.msrestazure
168             ];
169           });
171       # ValueError: The operation 'azure.mgmt.media.operations#MediaservicesOperations.create_or_update' is invalid.
172       azure-mgmt-media =
173         overrideAzureMgmtPackage super.azure-mgmt-media "9.0.0" "zip"
174           "sha256-TI7l8sSQ2QUgPqiE3Cu/F67Wna+KHbQS3fuIjOb95ZM=";
176       # AttributeError: module 'azure.mgmt.rdbms.postgresql_flexibleservers.operations' has no attribute 'BackupsOperations'
177       azure-mgmt-rdbms =
178         overrideAzureMgmtPackage super.azure-mgmt-rdbms "10.2.0b16" "tar.gz"
179           "sha256-HDktzv8MOs5VRQArbS3waMhjbwVgZMmvch7PXen5DjE=";
181       # ModuleNotFoundError: No module named 'azure.mgmt.resource.deploymentstacks'
182       azure-mgmt-resource =
183         overrideAzureMgmtPackage super.azure-mgmt-resource "23.1.1" "tar.gz"
184           "sha256-ILawBrVE/bGWB/P2o4EQViXgu2D78wNvOYhcRkbTND4=";
186       # ImportError: cannot import name 'Replica' from 'azure.mgmt.signalr.models'
187       azure-mgmt-signalr =
188         overrideAzureMgmtPackage super.azure-mgmt-signalr "2.0.0b1" "tar.gz"
189           "sha256-oK2ceBEoQ7gAeG6mye+x8HPzQU9bUNRPVJtRW2GL4xg=";
191       # ImportError: cannot import name 'AdvancedThreatProtectionName' from 'azure.mgmt.sql.models'
192       azure-mgmt-sql =
193         overrideAzureMgmtPackage super.azure-mgmt-sql "4.0.0b17" "tar.gz"
194           "sha256-i9VNbYJ3TgzURbtYYrXw+ez4ubK7BH39/EIL5kqb9Xg=";
196       # ValueError: The operation 'azure.mgmt.sqlvirtualmachine.operations#SqlVirtualMachinesOperations.begin_create_or_update' is invalid.
197       azure-mgmt-sqlvirtualmachine =
198         overrideAzureMgmtPackage super.azure-mgmt-sqlvirtualmachine "1.0.0b5" "zip"
199           "sha256-ZFgJflgynRSxo+B+Vso4eX1JheWlDQjfJ9QmupXypMc=";
201       # ModuleNotFoundError: No module named 'azure.mgmt.synapse.operations._kusto_pool_attached_database_configurations_operations'
202       azure-mgmt-synapse =
203         overrideAzureMgmtPackage super.azure-mgmt-synapse "2.1.0b5" "zip"
204           "sha256-5E6Yf1GgNyNVjd+SeFDbhDxnOA6fOAG6oojxtCP4m+k=";
205     };
206   };