From 0cab13765164c5d0c3fb40531e5ff14c2a0b2d70 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 15 Oct 2018 14:18:53 -0700 Subject: [PATCH] [AutoPR network/resource-manager] Remove error code from swagger (#3507) * Generated from 82c4e9010292ed02c88fd64f6d3b7e17bd417eb9 Remove error code from swagger * Packaging update of azure-mgmt-network --- azure-mgmt-network/MANIFEST.in | 1 - azure-mgmt-network/azure/__init__.py | 2 +- azure-mgmt-network/azure/mgmt/__init__.py | 2 +- .../express_route_gateways_operations.py | 2 +- azure-mgmt-network/azure_bdist_wheel.py | 54 ------------------- azure-mgmt-network/setup.cfg | 1 - azure-mgmt-network/setup.py | 17 +++--- 7 files changed, 12 insertions(+), 67 deletions(-) delete mode 100644 azure-mgmt-network/azure_bdist_wheel.py diff --git a/azure-mgmt-network/MANIFEST.in b/azure-mgmt-network/MANIFEST.in index 9ecaeb15de50..bb37a2723dae 100644 --- a/azure-mgmt-network/MANIFEST.in +++ b/azure-mgmt-network/MANIFEST.in @@ -1,2 +1 @@ include *.rst -include azure_bdist_wheel.py \ No newline at end of file diff --git a/azure-mgmt-network/azure/__init__.py b/azure-mgmt-network/azure/__init__.py index 849489fca33c..0260537a02bb 100644 --- a/azure-mgmt-network/azure/__init__.py +++ b/azure-mgmt-network/azure/__init__.py @@ -1 +1 @@ -__import__('pkg_resources').declare_namespace(__name__) +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/azure-mgmt-network/azure/mgmt/__init__.py b/azure-mgmt-network/azure/mgmt/__init__.py index 849489fca33c..0260537a02bb 100644 --- a/azure-mgmt-network/azure/mgmt/__init__.py +++ b/azure-mgmt-network/azure/mgmt/__init__.py @@ -1 +1 @@ -__import__('pkg_resources').declare_namespace(__name__) +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/azure-mgmt-network/azure/mgmt/network/v2018_08_01/operations/express_route_gateways_operations.py b/azure-mgmt-network/azure/mgmt/network/v2018_08_01/operations/express_route_gateways_operations.py index a8d5c40f9e03..28544395dff0 100644 --- a/azure-mgmt-network/azure/mgmt/network/v2018_08_01/operations/express_route_gateways_operations.py +++ b/azure-mgmt-network/azure/mgmt/network/v2018_08_01/operations/express_route_gateways_operations.py @@ -306,7 +306,7 @@ def get( request = self._client.get(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [200, 404]: + if response.status_code not in [200]: exp = CloudError(response) exp.request_id = response.headers.get('x-ms-request-id') raise exp diff --git a/azure-mgmt-network/azure_bdist_wheel.py b/azure-mgmt-network/azure_bdist_wheel.py deleted file mode 100644 index 8a81d1b61775..000000000000 --- a/azure-mgmt-network/azure_bdist_wheel.py +++ /dev/null @@ -1,54 +0,0 @@ -#------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -#-------------------------------------------------------------------------- - -from distutils import log as logger -import os.path - -from wheel.bdist_wheel import bdist_wheel -class azure_bdist_wheel(bdist_wheel): - """The purpose of this class is to build wheel a little differently than the sdist, - without requiring to build the wheel from the sdist (i.e. you can build the wheel - directly from source). - """ - - description = "Create an Azure wheel distribution" - - user_options = bdist_wheel.user_options + \ - [('azure-namespace-package=', None, - "Name of the deepest nspkg used")] - - def initialize_options(self): - bdist_wheel.initialize_options(self) - self.azure_namespace_package = None - - def finalize_options(self): - bdist_wheel.finalize_options(self) - if self.azure_namespace_package and not self.azure_namespace_package.endswith("-nspkg"): - raise ValueError("azure_namespace_package must finish by -nspkg") - - def run(self): - if not self.distribution.install_requires: - self.distribution.install_requires = [] - self.distribution.install_requires.append( - "{}>=2.0.0".format(self.azure_namespace_package)) - bdist_wheel.run(self) - - def write_record(self, bdist_dir, distinfo_dir): - if self.azure_namespace_package: - # Split and remove last part, assuming it's "nspkg" - subparts = self.azure_namespace_package.split('-')[0:-1] - folder_with_init = [os.path.join(*subparts[0:i+1]) for i in range(len(subparts))] - for azure_sub_package in folder_with_init: - init_file = os.path.join(bdist_dir, azure_sub_package, '__init__.py') - if os.path.isfile(init_file): - logger.info("manually remove {} while building the wheel".format(init_file)) - os.remove(init_file) - else: - raise ValueError("Unable to find {}. Are you sure of your namespace package?".format(init_file)) - bdist_wheel.write_record(self, bdist_dir, distinfo_dir) -cmdclass = { - 'bdist_wheel': azure_bdist_wheel, -} diff --git a/azure-mgmt-network/setup.cfg b/azure-mgmt-network/setup.cfg index 856f4164982c..3c6e79cf31da 100644 --- a/azure-mgmt-network/setup.cfg +++ b/azure-mgmt-network/setup.cfg @@ -1,3 +1,2 @@ [bdist_wheel] universal=1 -azure-namespace-package=azure-mgmt-nspkg \ No newline at end of file diff --git a/azure-mgmt-network/setup.py b/azure-mgmt-network/setup.py index 6148dcdc0212..90b9416272f1 100644 --- a/azure-mgmt-network/setup.py +++ b/azure-mgmt-network/setup.py @@ -10,12 +10,6 @@ import os.path from io import open from setuptools import find_packages, setup -try: - from azure_bdist_wheel import cmdclass -except ImportError: - from distutils import log as logger - logger.warn("Wheel is not available, disabling bdist_wheel hook") - cmdclass = {} # Change the PACKAGE_NAME only to change folder and different name PACKAGE_NAME = "azure-mgmt-network" @@ -76,11 +70,18 @@ 'License :: OSI Approved :: MIT License', ], zip_safe=False, - packages=find_packages(exclude=["tests"]), + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.mgmt', + ]), install_requires=[ 'msrest>=0.5.0', 'msrestazure>=0.4.32,<2.0.0', 'azure-common~=1.1', ], - cmdclass=cmdclass + extras_require={ + ":python_version<'3.0'": ['azure-mgmt-nspkg'], + } )