Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 229 lines 8.9 kB view raw
1{ 2 stdenv, 3 python3, 4 fetchPypi, 5 src, 6 version, 7}: 8 9let 10 buildAzureCliPackage = with py.pkgs; buildPythonPackage; 11 12 overrideAzureMgmtPackage = 13 package: version: extension: hash: 14 package.overridePythonAttrs (oldAttrs: { 15 inherit version; 16 17 src = fetchPypi { 18 inherit (oldAttrs) pname; 19 inherit version hash extension; 20 }; 21 }); 22 23 py = python3.override { 24 self = py; 25 packageOverrides = self: super: { 26 inherit buildAzureCliPackage; 27 28 # core and the actual application are highly coupled 29 azure-cli-core = buildAzureCliPackage { 30 pname = "azure-cli-core"; 31 format = "setuptools"; 32 inherit version src; 33 34 sourceRoot = "${src.name}/src/azure-cli-core"; 35 36 patches = [ 37 # Adding the possibility to configure an immutable configuration dir via `AZURE_IMMUTABLE_DIR`. 38 # This enables us to place configuration files that alter the behavior of the CLI in the Nix store. 39 # 40 # This is a downstream patch without an commit or PR upstream. 41 # There is an issue to discuss possible solutions upstream: 42 # https://github.com/Azure/azure-cli/issues/28093 43 ./0001-optional-immutable-configuration-dir.patch 44 ]; 45 46 propagatedBuildInputs = 47 with self; 48 [ 49 argcomplete 50 azure-cli-telemetry 51 azure-common 52 azure-mgmt-core 53 cryptography 54 distro 55 humanfriendly 56 jmespath 57 knack 58 microsoft-security-utilities-secret-masker 59 msal-extensions 60 msal 61 msrestazure 62 packaging 63 paramiko 64 pkginfo 65 psutil 66 py-deviceid 67 pyjwt 68 pyopenssl 69 requests 70 ] 71 ++ requests.optional-dependencies.socks; 72 73 nativeCheckInputs = with self; [ pytest ]; 74 75 doCheck = stdenv.hostPlatform.isLinux; 76 77 # ignore tests that does network call, or assume powershell 78 checkPhase = '' 79 python -c 'import azure.common; print(azure.common)' 80 81 PYTHONPATH=$PWD:${src}/src/azure-cli-testsdk:$PYTHONPATH HOME=$TMPDIR pytest \ 82 azure/cli/core/tests \ 83 --ignore=azure/cli/core/tests/test_profile.py \ 84 --ignore=azure/cli/core/tests/test_generic_update.py \ 85 --ignore=azure/cli/core/tests/test_cloud.py \ 86 --ignore=azure/cli/core/tests/test_extension.py \ 87 --ignore=azure/cli/core/tests/test_util.py \ 88 --ignore=azure/cli/core/tests/test_argcomplete.py \ 89 -k 'not metadata_url and not test_send_raw_requests and not test_format_styled_text_legacy_powershell' 90 ''; 91 92 pythonImportsCheck = [ 93 "azure.cli.telemetry" 94 "azure.cli.core" 95 ]; 96 97 meta.downloadPage = "https://github.com/Azure/azure-cli/tree/azure-cli-${version}/src/azure-cli-core/"; 98 }; 99 100 azure-cli-telemetry = buildAzureCliPackage { 101 pname = "azure-cli-telemetry"; 102 version = "1.1.0"; 103 format = "setuptools"; 104 inherit src; 105 106 sourceRoot = "${src.name}/src/azure-cli-telemetry"; 107 108 propagatedBuildInputs = with self; [ 109 applicationinsights 110 portalocker 111 ]; 112 113 nativeCheckInputs = with self; [ pytest ]; 114 # ignore flaky test 115 checkPhase = '' 116 cd azure 117 HOME=$TMPDIR pytest -k 'not test_create_telemetry_note_file_from_scratch' 118 ''; 119 120 meta.downloadPage = "https://github.com/Azure/azure-cli/blob/azure-cli-${version}/src/azure-cli-telemetry/"; 121 }; 122 123 # Error loading command module 'batch': No module named 'azure.batch._model_base' 124 azure-batch = super.azure-batch.overridePythonAttrs (attrs: rec { 125 version = "15.0.0b1"; 126 src = fetchPypi { 127 pname = "azure_batch"; # Different from src.pname in the original package. 128 inherit version; 129 hash = "sha256-373dFY/63lIZPj5NhsmW6nI2/9JpWkNzT65eBal04u0="; 130 }; 131 }); 132 133 azure-mgmt-billing = 134 (overrideAzureMgmtPackage super.azure-mgmt-billing "6.0.0" "zip" 135 "sha256-1PXFpBiKRW/h6zK2xF9VyiBpx0vkHrdpIYQLOfL1wH8=" 136 ).overridePythonAttrs 137 (attrs: { 138 propagatedBuildInputs = attrs.propagatedBuildInputs or [ ] ++ [ 139 self.msrest 140 self.msrestazure 141 ]; 142 }); 143 144 # AttributeError: type object 'CustomDomainsOperations' has no attribute 'disable_custom_https' 145 azure-mgmt-cdn = 146 overrideAzureMgmtPackage super.azure-mgmt-cdn "12.0.0" "zip" 147 "sha256-t8PuIYkjS0r1Gs4pJJJ8X9cz8950imQtbVBABnyMnd0="; 148 149 # ImportError: cannot import name 'ConfigMap' from 'azure.mgmt.containerinstance.models' 150 azure-mgmt-containerinstance = super.azure-mgmt-containerinstance.overridePythonAttrs (attrs: rec { 151 version = "10.2.0b1"; 152 src = fetchPypi { 153 pname = "azure_mgmt_containerinstance"; # Different from src.pname in the original package. 154 inherit version; 155 hash = "sha256-v0u3e9ZoEnDdCnM6o6fD7N+suo5hbTqMO5jM6cSMx8A="; 156 }; 157 }); 158 159 # ImportError: cannot import name 'ResourceSku' from 'azure.mgmt.eventgrid.models' 160 azure-mgmt-eventgrid = 161 overrideAzureMgmtPackage super.azure-mgmt-eventgrid "10.2.0b2" "zip" 162 "sha256-QcHY1wCwQyVOEdUi06/wEa4dqJH5Ccd33gJ1Sju0qZA="; 163 164 # ValueError: The operation 'azure.mgmt.hdinsight.operations#ExtensionsOperations.get_azure_monitor_agent_status' is invalid. 165 azure-mgmt-hdinsight = 166 overrideAzureMgmtPackage super.azure-mgmt-hdinsight "9.0.0b3" "tar.gz" 167 "sha256-clSeCP8+7T1uI4Nec+zhzDK980C9+JGeeJFsNSwgD2Q="; 168 169 # ValueError: The operation 'azure.mgmt.media.operations#MediaservicesOperations.create_or_update' is invalid. 170 azure-mgmt-media = 171 overrideAzureMgmtPackage super.azure-mgmt-media "9.0.0" "zip" 172 "sha256-TI7l8sSQ2QUgPqiE3Cu/F67Wna+KHbQS3fuIjOb95ZM="; 173 174 # ModuleNotFoundError: No module named 'azure.mgmt.monitor.operations' 175 azure-mgmt-monitor = super.azure-mgmt-monitor.overridePythonAttrs (attrs: rec { 176 version = "7.0.0b1"; 177 src = fetchPypi { 178 pname = "azure_mgmt_monitor"; # Different from src.pname in the original package. 179 inherit version; 180 hash = "sha256-WR4YZMw4njklpARkujsRnd6nwTZ8M5vXFcy9AfL9oj4="; 181 }; 182 }); 183 184 # AttributeError: module 'azure.mgmt.rdbms.postgresql_flexibleservers.operations' has no attribute 'BackupsOperations' 185 azure-mgmt-rdbms = 186 overrideAzureMgmtPackage super.azure-mgmt-rdbms "10.2.0b17" "tar.gz" 187 "sha256-1nnRkyr4Im79B7DDqGz/FOrPAToFaGhE+a7r5bZMuOQ="; 188 189 # ModuleNotFoundError: No module named 'azure.mgmt.redhatopenshift.v2023_11_22' 190 azure-mgmt-redhatopenshift = 191 overrideAzureMgmtPackage super.azure-mgmt-redhatopenshift "1.5.0" "tar.gz" 192 "sha256-Uft0KcOciKzJ+ic9n4nxkwNSBmKZam19jhEiqY9fJSc="; 193 194 # ImportError: cannot import name 'IPRule' from 'azure.mgmt.signalr.models' 195 azure-mgmt-signalr = 196 overrideAzureMgmtPackage super.azure-mgmt-signalr "2.0.0b2" "tar.gz" 197 "sha256-05PUV8ouAKq/xhGxVEWIzDop0a7WDTV5mGVSC4sv9P4="; 198 199 # ImportError: cannot import name 'AdvancedThreatProtectionName' from 'azure.mgmt.sql.models' 200 azure-mgmt-sql = super.azure-mgmt-sql.overridePythonAttrs (attrs: rec { 201 version = "4.0.0b20"; 202 src = fetchPypi { 203 pname = "azure_mgmt_sql"; # Different from src.pname in the original package. 204 inherit version; 205 hash = "sha256-mphqHUet4AhmL8aUoRbrGOjbookCHR3Ex+unpOq7aQM="; 206 }; 207 }); 208 209 # ValueError: The operation 'azure.mgmt.sqlvirtualmachine.operations#SqlVirtualMachinesOperations.begin_create_or_update' is invalid. 210 azure-mgmt-sqlvirtualmachine = 211 overrideAzureMgmtPackage super.azure-mgmt-sqlvirtualmachine "1.0.0b5" "zip" 212 "sha256-ZFgJflgynRSxo+B+Vso4eX1JheWlDQjfJ9QmupXypMc="; 213 214 # ModuleNotFoundError: No module named 'azure.mgmt.synapse.operations._kusto_pool_attached_database_configurations_operations' 215 azure-mgmt-synapse = 216 overrideAzureMgmtPackage super.azure-mgmt-synapse "2.1.0b5" "zip" 217 "sha256-5E6Yf1GgNyNVjd+SeFDbhDxnOA6fOAG6oojxtCP4m+k="; 218 219 # Observed error during runtime: 220 # AttributeError: Can't get attribute 'NormalizedResponse' on <module 'msal.throttled_http_client' from 221 # '/nix/store/xxx-python3.12-msal-1.32.0/lib/python3.12/site-packages/msal/throttled_http_client.py'>. 222 # Did you mean: '_msal_public_app_kwargs'? 223 msal = 224 overrideAzureMgmtPackage super.msal "1.32.3" "tar.gz" 225 "sha256-XuoDhonHilpwyo7L4SRUWLVahXvQlu+2mJxpuhWYXTU="; 226 }; 227 }; 228in 229py