From 409a9194e1346a35fecb3bc37de95488a74f5d1f Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Mon, 13 Jul 2020 13:44:38 +0800 Subject: [PATCH 01/70] init pep420 change --- .azure-pipelines/templates/azdev_setup.yml | 5 ++ azure-pipelines.yml | 16 ++++++ build_scripts/windows/scripts/build.cmd | 3 +- scripts/ci/install_azdev.sh | 12 +++++ .../HISTORY.rst | 19 ------- .../MANIFEST.in | 1 - .../README.rst | 8 --- .../azure/cli/command_modules/__init__.py | 0 src/azure-cli-command_modules-nspkg/setup.cfg | 0 src/azure-cli-command_modules-nspkg/setup.py | 49 ------------------- src/azure-cli-core/azure/__init__.py | 3 +- src/azure-cli-core/azure/cli/__init__.py | 3 +- src/azure-cli-core/setup.py | 2 - src/azure-cli-nspkg/HISTORY.rst | 44 ----------------- src/azure-cli-nspkg/MANIFEST.in | 1 - src/azure-cli-nspkg/README.rst | 8 --- src/azure-cli-nspkg/azure/cli/__init__.py | 0 src/azure-cli-nspkg/setup.cfg | 0 src/azure-cli-nspkg/setup.py | 48 ------------------ src/azure-cli-telemetry/azure/__init__.py | 3 +- src/azure-cli-telemetry/azure/cli/__init__.py | 4 +- src/azure-cli-telemetry/setup.py | 2 - src/azure-cli-testsdk/azure/__init__.py | 4 +- src/azure-cli-testsdk/azure/cli/__init__.py | 4 +- src/azure-cli-testsdk/setup.py | 2 - src/azure-cli/README.rst | 1 + src/azure-cli/azure/__init__.py | 3 +- src/azure-cli/azure/cli/__init__.py | 8 +-- .../resource/tests/latest/test_cli_version.py | 2 - src/azure-cli/requirements.py3.Darwin.txt | 11 +++-- src/azure-cli/requirements.py3.Linux.txt | 11 +++-- src/azure-cli/requirements.py3.windows.txt | 11 +++-- src/azure-cli/setup.py | 6 +-- 33 files changed, 66 insertions(+), 228 deletions(-) create mode 100644 scripts/ci/install_azdev.sh delete mode 100644 src/azure-cli-command_modules-nspkg/HISTORY.rst delete mode 100644 src/azure-cli-command_modules-nspkg/MANIFEST.in delete mode 100644 src/azure-cli-command_modules-nspkg/README.rst delete mode 100644 src/azure-cli-command_modules-nspkg/azure/cli/command_modules/__init__.py delete mode 100644 src/azure-cli-command_modules-nspkg/setup.cfg delete mode 100644 src/azure-cli-command_modules-nspkg/setup.py delete mode 100644 src/azure-cli-nspkg/HISTORY.rst delete mode 100644 src/azure-cli-nspkg/MANIFEST.in delete mode 100644 src/azure-cli-nspkg/README.rst delete mode 100644 src/azure-cli-nspkg/azure/cli/__init__.py delete mode 100644 src/azure-cli-nspkg/setup.cfg delete mode 100644 src/azure-cli-nspkg/setup.py diff --git a/.azure-pipelines/templates/azdev_setup.yml b/.azure-pipelines/templates/azdev_setup.yml index 858a600524f..41c11bed2da 100644 --- a/.azure-pipelines/templates/azdev_setup.yml +++ b/.azure-pipelines/templates/azdev_setup.yml @@ -14,7 +14,12 @@ steps: chmod +x env/bin/activate . env/bin/activate +<<<<<<< HEAD pip install -q azdev==0.1.22 +======= + pip install -q git+https://github.com/Azure/azure-cli-dev-tools.git@pep420 + +>>>>>>> init pep420 change azdev --version if [ -z "$CLI_EXT_REPO_PATH" ]; then diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f38e2e4ba5c..21e287b3317 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -140,7 +140,23 @@ jobs: displayName: 'Use Python 3.7' inputs: versionSpec: 3.7 +<<<<<<< HEAD - template: .azure-pipelines/templates/azdev_setup.yml +======= + + - bash: | + #!/usr/bin/env bash + + set -ev + + pip install virtualenv + python -m virtualenv venv/ + . ./venv/bin/activate + pip install -q git+https://github.com/Azure/azure-cli-dev-tools.git@pep420 + azdev setup -c $(pwd) + displayName: 'Install azdev' + +>>>>>>> init pep420 change - bash: | set -ev . env/bin/activate diff --git a/build_scripts/windows/scripts/build.cmd b/build_scripts/windows/scripts/build.cmd index ffb19299b48..f69e474b3c2 100644 --- a/build_scripts/windows/scripts/build.cmd +++ b/build_scripts/windows/scripts/build.cmd @@ -88,7 +88,7 @@ robocopy %PYTHON_DIR% %BUILDING_DIR% /s /NFL /NDL set CLI_SRC=%REPO_ROOT%\src %BUILDING_DIR%\python.exe -m pip install --no-warn-script-location --force-reinstall pycparser==2.18 -for %%a in (%CLI_SRC%\azure-cli %CLI_SRC%\azure-cli-core %CLI_SRC%\azure-cli-nspkg %CLI_SRC%\azure-cli-telemetry) do ( +for %%a in (%CLI_SRC%\azure-cli %CLI_SRC%\azure-cli-core %CLI_SRC%\azure-cli-telemetry) do ( pushd %%a %BUILDING_DIR%\python.exe -m pip install --no-warn-script-location --no-cache-dir --no-deps . popd @@ -97,7 +97,6 @@ for %%a in (%CLI_SRC%\azure-cli %CLI_SRC%\azure-cli-core %CLI_SRC%\azure-cli-nsp if %errorlevel% neq 0 goto ERROR -%BUILDING_DIR%\python.exe -m pip install --no-warn-script-location --force-reinstall --upgrade azure-nspkg azure-mgmt-nspkg %BUILDING_DIR%\python.exe -m pip install --no-warn-script-location --force-reinstall urllib3==1.24.2 pushd %BUILDING_DIR% diff --git a/scripts/ci/install_azdev.sh b/scripts/ci/install_azdev.sh new file mode 100644 index 00000000000..6f597e70441 --- /dev/null +++ b/scripts/ci/install_azdev.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -e + +echo "Install azdev into virtual environment" +export CI="ADO" +pip install virtualenv +python -m virtualenv env +. env/bin/activate +pip install -U pip setuptools wheel -q +pip install -q git+https://github.com/Azure/azure-cli-dev-tools.git@pep420 +azdev setup -c diff --git a/src/azure-cli-command_modules-nspkg/HISTORY.rst b/src/azure-cli-command_modules-nspkg/HISTORY.rst deleted file mode 100644 index e7931547390..00000000000 --- a/src/azure-cli-command_modules-nspkg/HISTORY.rst +++ /dev/null @@ -1,19 +0,0 @@ -.. :changelog: - -Release History -=============== -2.0.3 -+++++ -* Indicate Python 3.7 support. - -2.0.2 -++++++ -* Minor fixes. - -2.0.1 -+++++ -* minor fixes - -2.0.0 (2017-04-28) -++++++++++++++++++ -* Initial release diff --git a/src/azure-cli-command_modules-nspkg/MANIFEST.in b/src/azure-cli-command_modules-nspkg/MANIFEST.in deleted file mode 100644 index bb37a2723da..00000000000 --- a/src/azure-cli-command_modules-nspkg/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include *.rst diff --git a/src/azure-cli-command_modules-nspkg/README.rst b/src/azure-cli-command_modules-nspkg/README.rst deleted file mode 100644 index 1ea0535b66b..00000000000 --- a/src/azure-cli-command_modules-nspkg/README.rst +++ /dev/null @@ -1,8 +0,0 @@ -Microsoft Azure CLI Command modules Namespace Package -===================================================== - -This is the Microsoft Azure CLI command module namespace package. - -This package is not intended to be installed directly by the end user. - -It provides the necessary files for other packages to extend the azure cli command module namespaces. diff --git a/src/azure-cli-command_modules-nspkg/azure/cli/command_modules/__init__.py b/src/azure-cli-command_modules-nspkg/azure/cli/command_modules/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/azure-cli-command_modules-nspkg/setup.cfg b/src/azure-cli-command_modules-nspkg/setup.cfg deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/azure-cli-command_modules-nspkg/setup.py b/src/azure-cli-command_modules-nspkg/setup.py deleted file mode 100644 index 2cfe3b6241f..00000000000 --- a/src/azure-cli-command_modules-nspkg/setup.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python - -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -from codecs import open -from setuptools import setup - -VERSION = "2.0.3" - -CLASSIFIERS = [ - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Developers', - 'Intended Audience :: System Administrators', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'License :: OSI Approved :: MIT License', -] - -with open('README.rst', 'r', encoding='utf-8') as f: - README = f.read() -with open('HISTORY.rst', 'r', encoding='utf-8') as f: - HISTORY = f.read() - -setup( - name='azure-cli-command-modules-nspkg', - version=VERSION, - description='Microsoft Azure CLI Command Modules Namespace Package', - long_description=README + '\n\n' + HISTORY, - license='MIT', - author='Microsoft Corporation', - author_email='azpycli@microsoft.com', - url='https://github.com/Azure/azure-cli', - zip_safe=False, - classifiers=CLASSIFIERS, - install_requires=[ - 'azure-cli-nspkg>=3.0.0' - ], - packages=[ - 'azure', - 'azure.cli', - 'azure.cli.command_modules' - ], -) diff --git a/src/azure-cli-core/azure/__init__.py b/src/azure-cli-core/azure/__init__.py index 73baee1e640..2ae78104e94 100644 --- a/src/azure-cli-core/azure/__init__.py +++ b/src/azure-cli-core/azure/__init__.py @@ -2,5 +2,4 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -import pkg_resources -pkg_resources.declare_namespace(__name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/src/azure-cli-core/azure/cli/__init__.py b/src/azure-cli-core/azure/cli/__init__.py index 73baee1e640..2ae78104e94 100644 --- a/src/azure-cli-core/azure/cli/__init__.py +++ b/src/azure-cli-core/azure/cli/__init__.py @@ -2,5 +2,4 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -import pkg_resources -pkg_resources.declare_namespace(__name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/src/azure-cli-core/setup.py b/src/azure-cli-core/setup.py index eb104a71e16..a4782767822 100644 --- a/src/azure-cli-core/setup.py +++ b/src/azure-cli-core/setup.py @@ -92,8 +92,6 @@ zip_safe=False, classifiers=CLASSIFIERS, packages=[ - 'azure', - 'azure.cli', 'azure.cli.core', 'azure.cli.core.commands', 'azure.cli.core.extension', diff --git a/src/azure-cli-nspkg/HISTORY.rst b/src/azure-cli-nspkg/HISTORY.rst deleted file mode 100644 index 43af6f5726b..00000000000 --- a/src/azure-cli-nspkg/HISTORY.rst +++ /dev/null @@ -1,44 +0,0 @@ -.. :changelog: - -Release History -=============== -3.0.4 -+++++ -* Indicate Python 3.7 support. - -3.0.3 -++++++ -* Minor fixes. - -3.0.2 -+++++ -* minor fixes - -3.0.1 -+++++ -* minor fixes - -3.0.0 (2016-04-28) -++++++++++++++++++ - -* New nspkg structure. - -2.0.0 (2016-02-27) -++++++++++++++++++ - -* GA release. - -0.1.2 (2016-01-30) -++++++++++++++++++ - -* Support Python 3.6. - -0.1.1 (2016-01-17) -++++++++++++++++++ - -* Stable release (no code changes since previous version). - -0.1.0b11 (2016-12-12) -+++++++++++++++++++++ - -* Preview release. diff --git a/src/azure-cli-nspkg/MANIFEST.in b/src/azure-cli-nspkg/MANIFEST.in deleted file mode 100644 index bb37a2723da..00000000000 --- a/src/azure-cli-nspkg/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include *.rst diff --git a/src/azure-cli-nspkg/README.rst b/src/azure-cli-nspkg/README.rst deleted file mode 100644 index 7d2fd556eb1..00000000000 --- a/src/azure-cli-nspkg/README.rst +++ /dev/null @@ -1,8 +0,0 @@ -Microsoft Azure CLI Namespace Package -===================================== - -This is the Microsoft Azure CLI namespace package. - -This package is not intended to be installed directly by the end user. - -It provides the necessary files for other packages to extend the azure cli namespaces. diff --git a/src/azure-cli-nspkg/azure/cli/__init__.py b/src/azure-cli-nspkg/azure/cli/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/azure-cli-nspkg/setup.cfg b/src/azure-cli-nspkg/setup.cfg deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/azure-cli-nspkg/setup.py b/src/azure-cli-nspkg/setup.py deleted file mode 100644 index fb01c0b8d9f..00000000000 --- a/src/azure-cli-nspkg/setup.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env python - -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -from codecs import open -from setuptools import setup - -VERSION = "3.0.4" - -CLASSIFIERS = [ - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Developers', - 'Intended Audience :: System Administrators', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'License :: OSI Approved :: MIT License', -] - -with open('README.rst', 'r', encoding='utf-8') as f: - README = f.read() -with open('HISTORY.rst', 'r', encoding='utf-8') as f: - HISTORY = f.read() - -setup( - name='azure-cli-nspkg', - version=VERSION, - description='Microsoft Azure CLI Namespace Package', - long_description=README + '\n\n' + HISTORY, - license='MIT', - author='Microsoft Corporation', - author_email='azpycli@microsoft.com', - url='https://github.com/Azure/azure-cli', - zip_safe=False, - classifiers=CLASSIFIERS, - install_requires=[ - 'azure-nspkg>=2.0.0' - ], - packages=[ - 'azure', - 'azure.cli', - ], -) diff --git a/src/azure-cli-telemetry/azure/__init__.py b/src/azure-cli-telemetry/azure/__init__.py index 73baee1e640..2ae78104e94 100644 --- a/src/azure-cli-telemetry/azure/__init__.py +++ b/src/azure-cli-telemetry/azure/__init__.py @@ -2,5 +2,4 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -import pkg_resources -pkg_resources.declare_namespace(__name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/src/azure-cli-telemetry/azure/cli/__init__.py b/src/azure-cli-telemetry/azure/cli/__init__.py index bb3f1f13b5e..2ae78104e94 100644 --- a/src/azure-cli-telemetry/azure/cli/__init__.py +++ b/src/azure-cli-telemetry/azure/cli/__init__.py @@ -2,6 +2,4 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -import pkg_resources - -pkg_resources.declare_namespace(__name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/src/azure-cli-telemetry/setup.py b/src/azure-cli-telemetry/setup.py index de4aded426e..66019f6fa3f 100755 --- a/src/azure-cli-telemetry/setup.py +++ b/src/azure-cli-telemetry/setup.py @@ -51,8 +51,6 @@ 'portalocker~=1.2', ], packages=[ - 'azure', - 'azure.cli', 'azure.cli.telemetry', 'azure.cli.telemetry.components' ], diff --git a/src/azure-cli-testsdk/azure/__init__.py b/src/azure-cli-testsdk/azure/__init__.py index a9dfa5391b9..2ae78104e94 100644 --- a/src/azure-cli-testsdk/azure/__init__.py +++ b/src/azure-cli-testsdk/azure/__init__.py @@ -2,6 +2,4 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- - -import pkg_resources -pkg_resources.declare_namespace(__name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/src/azure-cli-testsdk/azure/cli/__init__.py b/src/azure-cli-testsdk/azure/cli/__init__.py index a9dfa5391b9..2ae78104e94 100644 --- a/src/azure-cli-testsdk/azure/cli/__init__.py +++ b/src/azure-cli-testsdk/azure/cli/__init__.py @@ -2,6 +2,4 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- - -import pkg_resources -pkg_resources.declare_namespace(__name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/src/azure-cli-testsdk/setup.py b/src/azure-cli-testsdk/setup.py index 080f6a2abe5..00d2feeceb5 100644 --- a/src/azure-cli-testsdk/setup.py +++ b/src/azure-cli-testsdk/setup.py @@ -51,8 +51,6 @@ zip_safe=False, classifiers=CLASSIFIERS, packages=[ - 'azure', - 'azure.cli', 'azure.cli.testsdk' ], install_requires=DEPENDENCIES, diff --git a/src/azure-cli/README.rst b/src/azure-cli/README.rst index 5ef1c79fb17..526a1e3c0f1 100644 --- a/src/azure-cli/README.rst +++ b/src/azure-cli/README.rst @@ -103,3 +103,4 @@ License ======= `MIT `__ + diff --git a/src/azure-cli/azure/__init__.py b/src/azure-cli/azure/__init__.py index 73baee1e640..2ae78104e94 100644 --- a/src/azure-cli/azure/__init__.py +++ b/src/azure-cli/azure/__init__.py @@ -2,5 +2,4 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -import pkg_resources -pkg_resources.declare_namespace(__name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/src/azure-cli/azure/cli/__init__.py b/src/azure-cli/azure/cli/__init__.py index 1de18f100bb..5d23ab4a2e7 100644 --- a/src/azure-cli/azure/cli/__init__.py +++ b/src/azure-cli/azure/cli/__init__.py @@ -2,13 +2,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -'''The Azure Command-line tool. - -This tools provides a command-line interface to Azure's management and storage -APIs. -''' -import pkg_resources -pkg_resources.declare_namespace(__name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) __author__ = "Microsoft Corporation " __version__ = "2.9.1" diff --git a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_cli_version.py b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_cli_version.py index 9a4429f6bcd..e7e5f4524c0 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_cli_version.py +++ b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_cli_version.py @@ -14,9 +14,7 @@ class VersionTest(ScenarioTest): def test_version(self): output = self.cmd('az version').get_output_in_json() self.assertIn('azure-cli', output) - self.assertIn('azure-cli-command-modules-nspkg', output) self.assertIn('azure-cli-core', output) - self.assertIn('azure-cli-nspkg', output) self.assertIn('azure-cli-telemetry', output) self.assertIn('azure-cli-testsdk', output) self.assertIn('extensions', output) diff --git a/src/azure-cli/requirements.py3.Darwin.txt b/src/azure-cli/requirements.py3.Darwin.txt index 900bf69ba38..285819738d6 100644 --- a/src/azure-cli/requirements.py3.Darwin.txt +++ b/src/azure-cli/requirements.py3.Darwin.txt @@ -4,13 +4,18 @@ applicationinsights==0.11.9 argcomplete==1.11.1 asn1crypto==0.24.0 azure-batch==9.0.0 +<<<<<<< HEAD azure-cli==2.9.1 azure-cli-command-modules-nspkg==2.0.3 azure-cli-core==2.9.1 azure-cli-nspkg==3.0.4 +======= +azure-cli==2.9.0 +azure-cli-core==2.9.0 +>>>>>>> init pep420 change azure-cli-telemetry==1.0.4 azure-common==1.1.22 -azure-cosmos==3.1.0 +azure-cosmos==3.2.0 azure-datalake-store==0.0.48 azure-devtools==1.0.0 azure-functions-devops-build==0.0.22 @@ -59,7 +64,6 @@ azure-mgmt-monitor==0.11.0 azure-mgmt-msi==0.2.0 azure-mgmt-netapp==0.8.0 azure-mgmt-network==11.0.0 -azure-mgmt-nspkg==3.0.2 azure-mgmt-policyinsights==0.5.0 azure-mgmt-privatedns==0.1.0 azure-mgmt-rdbms==2.2.0 @@ -80,8 +84,7 @@ azure-mgmt-sqlvirtualmachine==0.5.0 azure-mgmt-storage==11.1.0 azure-mgmt-trafficmanager==0.51.0 azure-mgmt-web==0.47.0 -azure-multiapi-storage==0.3.2 -azure-nspkg==3.0.2 +azure-multiapi-storage==0.3.5 azure-loganalytics==0.1.0 azure-storage-common==1.4.2 bcrypt==3.1.7 diff --git a/src/azure-cli/requirements.py3.Linux.txt b/src/azure-cli/requirements.py3.Linux.txt index ea3bf9bd2c4..b6a192f9ef7 100644 --- a/src/azure-cli/requirements.py3.Linux.txt +++ b/src/azure-cli/requirements.py3.Linux.txt @@ -4,13 +4,18 @@ applicationinsights==0.11.9 argcomplete==1.11.1 asn1crypto==0.24.0 azure-batch==9.0.0 +<<<<<<< HEAD azure-cli==2.9.1 azure-cli-command-modules-nspkg==2.0.3 azure-cli-core==2.9.1 azure-cli-nspkg==3.0.4 +======= +azure-cli==2.9.0 +azure-cli-core==2.9.0 +>>>>>>> init pep420 change azure-cli-telemetry==1.0.4 azure-common==1.1.22 -azure-cosmos==3.1.0 +azure-cosmos==3.2.0 azure-datalake-store==0.0.48 azure-devtools==1.0.0 azure-functions-devops-build==0.0.22 @@ -59,7 +64,6 @@ azure-mgmt-monitor==0.11.0 azure-mgmt-msi==0.2.0 azure-mgmt-netapp==0.8.0 azure-mgmt-network==11.0.0 -azure-mgmt-nspkg==3.0.2 azure-mgmt-policyinsights==0.5.0 azure-mgmt-privatedns==0.1.0 azure-mgmt-rdbms==2.2.0 @@ -80,8 +84,7 @@ azure-mgmt-sqlvirtualmachine==0.5.0 azure-mgmt-storage==11.1.0 azure-mgmt-trafficmanager==0.51.0 azure-mgmt-web==0.47.0 -azure-multiapi-storage==0.3.2 -azure-nspkg==3.0.2 +azure-multiapi-storage==0.3.5 azure-loganalytics==0.1.0 azure-storage-common==1.4.2 bcrypt==3.1.7 diff --git a/src/azure-cli/requirements.py3.windows.txt b/src/azure-cli/requirements.py3.windows.txt index 495e03dfa88..dd5f3a6584e 100644 --- a/src/azure-cli/requirements.py3.windows.txt +++ b/src/azure-cli/requirements.py3.windows.txt @@ -4,13 +4,18 @@ applicationinsights==0.11.7 argcomplete==1.11.1 asn1crypto==0.24.0 azure-batch==9.0.0 +<<<<<<< HEAD azure-cli==2.9.1 azure-cli-command-modules-nspkg==2.0.3 azure-cli-core==2.9.1 azure-cli-nspkg==3.0.4 +======= +azure-cli==2.9.0 +azure-cli-core==2.9.0 +>>>>>>> init pep420 change azure-cli-telemetry==1.0.4 azure-common==1.1.22 -azure-cosmos==3.1.0 +azure-cosmos==3.2.0 azure-datalake-store==0.0.48 azure-functions-devops-build==0.0.22 azure-graphrbac==0.60.0 @@ -58,7 +63,6 @@ azure-mgmt-monitor==0.11.0 azure-mgmt-msi==0.2.0 azure-mgmt-netapp==0.8.0 azure-mgmt-network==11.0.0 -azure-mgmt-nspkg==3.0.2 azure-mgmt-policyinsights==0.5.0 azure-mgmt-privatedns==0.1.0 azure-mgmt-rdbms==2.2.0 @@ -79,8 +83,7 @@ azure-mgmt-sqlvirtualmachine==0.5.0 azure-mgmt-storage==11.1.0 azure-mgmt-trafficmanager==0.51.0 azure-mgmt-web==0.47.0 -azure-multiapi-storage==0.3.2 -azure-nspkg==3.0.2 +azure-multiapi-storage==0.3.5 azure-loganalytics==0.1.0 azure-storage-common==1.4.2 bcrypt==3.1.7 diff --git a/src/azure-cli/setup.py b/src/azure-cli/setup.py index c027bbd7460..f7eddce235a 100644 --- a/src/azure-cli/setup.py +++ b/src/azure-cli/setup.py @@ -52,9 +52,7 @@ DEPENDENCIES = [ 'antlr4-python3-runtime~=4.7.2', 'azure-batch~=9.0', - 'azure-cli-command_modules-nspkg~=2.0', 'azure-cli-core=={}.*'.format(VERSION), - 'azure-cli-nspkg~=3.0,>=3.0.3', 'azure-cosmos~=3.0,>=3.0.2', 'azure-datalake-store~=0.0.48', 'azure-functions-devops-build~=0.0.22', @@ -122,7 +120,7 @@ 'azure-mgmt-storage~=11.1.0', 'azure-mgmt-trafficmanager~=0.51.0', 'azure-mgmt-web~=0.47.0', - 'azure-multiapi-storage~=0.3.2', + 'azure-multiapi-storage~=0.3.5', 'azure-loganalytics~=0.1.0', 'azure-storage-common~=1.4', 'cryptography>=2.3.1,<3.0.0', @@ -164,7 +162,7 @@ 'az.completion.sh', 'az.bat', ], - packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]), + packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests", "azure"]), install_requires=DEPENDENCIES, package_data={ 'azure.cli.core': ['auth_landing_pages/*.html'], From 2eaa836ea5890f929dd78a4cdbc24d783b5e6093 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Mon, 13 Jul 2020 14:07:21 +0800 Subject: [PATCH 02/70] fix linter error --- src/azure-cli/README.rst | 1 - .../cli/command_modules/eventgrid/linter_exclusions.yml | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 src/azure-cli/azure/cli/command_modules/eventgrid/linter_exclusions.yml diff --git a/src/azure-cli/README.rst b/src/azure-cli/README.rst index 526a1e3c0f1..5ef1c79fb17 100644 --- a/src/azure-cli/README.rst +++ b/src/azure-cli/README.rst @@ -103,4 +103,3 @@ License ======= `MIT `__ - diff --git a/src/azure-cli/azure/cli/command_modules/eventgrid/linter_exclusions.yml b/src/azure-cli/azure/cli/command_modules/eventgrid/linter_exclusions.yml new file mode 100644 index 00000000000..9a29699c78d --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/eventgrid/linter_exclusions.yml @@ -0,0 +1,7 @@ +--- +eventgrid partner topic event-subscription update: + parameters: + endpoint_type: + rule_exclusions: + - no_parameter_defaults_for_update_commands +... \ No newline at end of file From 13fe8e236d04a04b235f9696f5b83159f3023014 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Mon, 13 Jul 2020 14:48:59 +0800 Subject: [PATCH 03/70] fix another linter error --- src/azure-cli/azure/cli/__init__.py | 2 -- .../cli/command_modules/eventgrid/linter_exclusions.yml | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/azure-cli/azure/cli/__init__.py b/src/azure-cli/azure/cli/__init__.py index 5d23ab4a2e7..fcadd389abf 100644 --- a/src/azure-cli/azure/cli/__init__.py +++ b/src/azure-cli/azure/cli/__init__.py @@ -2,7 +2,5 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -__path__ = __import__("pkgutil").extend_path(__path__, __name__) - __author__ = "Microsoft Corporation " __version__ = "2.9.1" diff --git a/src/azure-cli/azure/cli/command_modules/eventgrid/linter_exclusions.yml b/src/azure-cli/azure/cli/command_modules/eventgrid/linter_exclusions.yml index 9a29699c78d..61ede431b8a 100644 --- a/src/azure-cli/azure/cli/command_modules/eventgrid/linter_exclusions.yml +++ b/src/azure-cli/azure/cli/command_modules/eventgrid/linter_exclusions.yml @@ -4,4 +4,9 @@ eventgrid partner topic event-subscription update: endpoint_type: rule_exclusions: - no_parameter_defaults_for_update_commands +eventgrid system-topic event-subscription update: + parameters: + endpoint_type: + rule_exclusions: + - no_parameter_defaults_for_update_commands ... \ No newline at end of file From 8d8b52c583aabcb556daa6872780f35a46a18a62 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Wed, 15 Jul 2020 15:56:48 +0800 Subject: [PATCH 04/70] elegant way to handle __main__.py --- .vscode/launch.json | 6 ++--- Dockerfile.spot | 6 ++--- scripts/ci/version.sh | 8 +++++++ scripts/curl_install_pypi/install.py | 4 ---- scripts/dev_setup.py | 6 ----- scripts/release/debian/pipeline.sh | 2 +- scripts/release/docker/pipeline.sh | 2 +- scripts/release/get_version.sh | 4 ++-- scripts/release/rpm/pipeline.sh | 2 +- src/azure-cli-core/azure_bdist_wheel.py | 23 +++++++------------- src/azure-cli-telemetry/azure_bdist_wheel.py | 23 +++++++------------- src/azure-cli-testsdk/azure_bdist_wheel.py | 23 +++++++------------- src/azure-cli/azure/cli/__init__.py | 4 ++++ src/azure-cli/azure/cli/__main__.py | 3 +++ src/azure-cli/azure_bdist_wheel.py | 23 +++++++------------- src/azure-cli/setup.py | 5 ++--- 16 files changed, 59 insertions(+), 85 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index a3bb8f78c2a..1187e215bf1 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,7 +5,7 @@ "name": "Azure CLI Debug (Integrated Console)", "type": "python", "request": "launch", - "pythonPath": "${config:python.pythonPath}", + "pythonPath": "${command:python.interpreterPath}", "program": "${workspaceRoot}/src/azure-cli/azure/cli/__main__.py", "cwd": "${workspaceRoot}", "args": [ @@ -24,7 +24,7 @@ "type": "python", "request": "launch", "stopOnEntry": true, - "pythonPath": "${config:python.pythonPath}", + "pythonPath": "${command:python.interpreterPath}", "program": "${workspaceRoot}/src/azure-cli/azure/cli/__main__.py", "cwd": "${workspaceRoot}", "args": [ @@ -40,7 +40,7 @@ "name": "Azdev Scripts", "type": "python", "request": "launch", - "pythonPath": "${config:python.pythonPath}", + "pythonPath": "${command:python.interpreterPath}", "program": "${workspaceRoot}/tools/automation/__main__.py", "cwd": "${workspaceRoot}", "args": [ diff --git a/Dockerfile.spot b/Dockerfile.spot index fb2b3e3738b..91937df010c 100644 --- a/Dockerfile.spot +++ b/Dockerfile.spot @@ -33,15 +33,13 @@ COPY . /azure-cli # jmespath-terminal - we include jpterm as a useful tool # 1. Build packages and store in tmp dir # 2. Install the cli and the other command modules that weren't included -# 3. Temporary fix - install azure-nspkg to remove import of pkg_resources in azure/__init__.py (to improve performance) RUN /bin/bash -c 'TMP_PKG_DIR=$(mktemp -d); \ - for d in src/azure-cli src/azure-cli-core src/azure-cli-nspkg src/azure-cli-command_modules-nspkg src/command_modules/azure-cli-*/; \ + for d in src/azure-cli src/azure-cli-core src/command_modules/azure-cli-*/; \ do cd $d; echo $d; python setup.py bdist_wheel -d $TMP_PKG_DIR; cd -; \ done; \ [ -d privates ] && cp privates/*.whl $TMP_PKG_DIR; \ all_modules=`find $TMP_PKG_DIR -name "*.whl"`; \ - pip install --no-cache-dir $all_modules; \ - pip install --no-cache-dir --force-reinstall --upgrade azure-nspkg azure-mgmt-nspkg;' \ + pip install --no-cache-dir $all_modules;' \ && cat /azure-cli/az.completion > ~/.bashrc WORKDIR / diff --git a/scripts/ci/version.sh b/scripts/ci/version.sh index 8d1c3a619e6..9b3d2acf4b9 100755 --- a/scripts/ci/version.sh +++ b/scripts/ci/version.sh @@ -20,6 +20,14 @@ echo "Replace with version: $version" platform=`uname` +for each in $(find src -name __main__.py); do + if [ "$platform" == "Darwin" ]; then + sed -i "" "s/^__version__ = [\"']\(.*\)[\"']/__version__ = \"\1.dev$version\"/" $each + else + sed -i "s/^__version__ = [\"']\(.*\)[\"']/__version__ = \"\1.dev$version\"/" $each + fi +done + for each in $(find src -name __init__.py); do if [ "$platform" == "Darwin" ]; then sed -i "" "s/^__version__ = [\"']\(.*\)[\"']/__version__ = \"\1.dev$version\"/" $each diff --git a/scripts/curl_install_pypi/install.py b/scripts/curl_install_pypi/install.py index 975091f8253..29b4b4c5c4b 100644 --- a/scripts/curl_install_pypi/install.py +++ b/scripts/curl_install_pypi/install.py @@ -149,10 +149,6 @@ def install_cli(install_dir, tmp_dir): path_to_pip = os.path.join(install_dir, 'bin', 'pip') cmd = [path_to_pip, 'install', '--cache-dir', tmp_dir, 'azure-cli', '--upgrade'] exec_command(cmd) - # Temporary fix to make sure that we have empty __init__.py files for the azure site-packages folder. - # (including the pkg_resources/declare namespace significantly impacts startup perf for the CLI) - fixupcmd = [path_to_pip, 'install', '--cache-dir', tmp_dir, '--upgrade', '--force-reinstall', 'azure-nspkg', 'azure-mgmt-nspkg'] - exec_command(fixupcmd) def create_executable(exec_dir, install_dir): diff --git a/scripts/dev_setup.py b/scripts/dev_setup.py index 5557f7d09d1..03032645ed3 100755 --- a/scripts/dev_setup.py +++ b/scripts/dev_setup.py @@ -66,7 +66,6 @@ def pip_command(command): pip_command('install -e ./tools') # command modules have dependency on azure-cli-core so install this first -pip_command('install -e src/azure-cli-nspkg') pip_command('install -e src/azure-cli-telemetry') pip_command('install -e src/azure-cli-core') py_command('-m automation.setup.install_modules') @@ -75,11 +74,6 @@ def pip_command(command): pip_command('install -e src/azure-cli') pip_command('install -e src/azure-cli-testsdk') -# Ensure that the site package's azure/__init__.py has the old style namespace -# package declaration by installing the old namespace package -pip_command('install --force-reinstall azure-nspkg==1.0.0') -pip_command('install --force-reinstall azure-mgmt-nspkg==1.0.0') - print_support_message() print('Finished dev setup.') diff --git a/scripts/release/debian/pipeline.sh b/scripts/release/debian/pipeline.sh index 83ba0c81eae..bd9d7bdeebc 100755 --- a/scripts/release/debian/pipeline.sh +++ b/scripts/release/debian/pipeline.sh @@ -8,7 +8,7 @@ set -exv : ${DISTRO:?"DISTRO is not set"} : ${DISTRO_BASE_IMAGE:?"DISTRO_BASE_IMAGE is not set"} -CLI_VERSION=`cat src/azure-cli/azure/cli/__init__.py | grep __version__ | sed s/' '//g | sed s/'__version__='// | sed s/\"//g` +CLI_VERSION=`cat src/azure-cli/azure/cli/__main__.py | grep __version__ | sed s/' '//g | sed s/'__version__='// | sed s/\"//g` docker run --rm \ -v "$BUILD_SOURCESDIRECTORY":/mnt/repo \ diff --git a/scripts/release/docker/pipeline.sh b/scripts/release/docker/pipeline.sh index 2f5a5cb4630..01b727a80ef 100755 --- a/scripts/release/docker/pipeline.sh +++ b/scripts/release/docker/pipeline.sh @@ -1,5 +1,5 @@ IMAGE_NAME=clibuild$BUILD_BUILDNUMBER -CLI_VERSION=`cat src/azure-cli/azure/cli/__init__.py | grep __version__ | sed s/' '//g | sed s/'__version__='// | sed s/\"//g` +CLI_VERSION=`cat src/azure-cli/azure/cli/__main__.py | grep __version__ | sed s/' '//g | sed s/'__version__='// | sed s/\"//g` docker build --no-cache \ --build-arg BUILD_DATE="`date -u +"%Y-%m-%dT%H:%M:%SZ"`" \ diff --git a/scripts/release/get_version.sh b/scripts/release/get_version.sh index 6b9d65b11b0..a3093b6927d 100755 --- a/scripts/release/get_version.sh +++ b/scripts/release/get_version.sh @@ -1,7 +1,7 @@ -# Extract the version of the CLI from azure-cli package's __init__.py file. +# Extract the version of the CLI from azure-cli package's __main__.py file. : "${BUILD_STAGINGDIRECTORY:?BUILD_STAGINGDIRECTORY environment variable not set}" -ver=`cat src/azure-cli/azure/cli/__init__.py | grep __version__ | sed s/' '//g | sed s/'__version__='// | sed s/\"//g` +ver=`cat src/azure-cli/azure/cli/__main__.py | grep __version__ | sed s/' '//g | sed s/'__version__='// | sed s/\"//g` echo $ver > $BUILD_STAGINGDIRECTORY/version echo $ver > $BUILD_STAGINGDIRECTORY/azure-cli-${ver}.txt \ No newline at end of file diff --git a/scripts/release/rpm/pipeline.sh b/scripts/release/rpm/pipeline.sh index 36d44b06d5c..df6958a1c8d 100755 --- a/scripts/release/rpm/pipeline.sh +++ b/scripts/release/rpm/pipeline.sh @@ -6,7 +6,7 @@ set -exv : "${BUILD_STAGINGDIRECTORY:?BUILD_STAGINGDIRECTORY environment variable not set.}" -CLI_VERSION=`cat src/azure-cli/azure/cli/__init__.py | grep __version__ | sed s/' '//g | sed s/'__version__='// | sed s/\"//g` +CLI_VERSION=`cat src/azure-cli/azure/cli/__main__.py | grep __version__ | sed s/' '//g | sed s/'__version__='// | sed s/\"//g` # Create a container image that includes the source code and a built RPM using this file. docker build \ diff --git a/src/azure-cli-core/azure_bdist_wheel.py b/src/azure-cli-core/azure_bdist_wheel.py index 8a81d1b6177..c8083d8896b 100644 --- a/src/azure-cli-core/azure_bdist_wheel.py +++ b/src/azure-cli-core/azure_bdist_wheel.py @@ -29,25 +29,18 @@ def 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)) + 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: + logger.info("skip {} as it is not include in the build target".format(init_file)) bdist_wheel.write_record(self, bdist_dir, distinfo_dir) cmdclass = { 'bdist_wheel': azure_bdist_wheel, diff --git a/src/azure-cli-telemetry/azure_bdist_wheel.py b/src/azure-cli-telemetry/azure_bdist_wheel.py index 8a81d1b6177..c8083d8896b 100644 --- a/src/azure-cli-telemetry/azure_bdist_wheel.py +++ b/src/azure-cli-telemetry/azure_bdist_wheel.py @@ -29,25 +29,18 @@ def 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)) + 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: + logger.info("skip {} as it is not include in the build target".format(init_file)) bdist_wheel.write_record(self, bdist_dir, distinfo_dir) cmdclass = { 'bdist_wheel': azure_bdist_wheel, diff --git a/src/azure-cli-testsdk/azure_bdist_wheel.py b/src/azure-cli-testsdk/azure_bdist_wheel.py index 8a81d1b6177..c8083d8896b 100644 --- a/src/azure-cli-testsdk/azure_bdist_wheel.py +++ b/src/azure-cli-testsdk/azure_bdist_wheel.py @@ -29,25 +29,18 @@ def 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)) + 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: + logger.info("skip {} as it is not include in the build target".format(init_file)) bdist_wheel.write_record(self, bdist_dir, distinfo_dir) cmdclass = { 'bdist_wheel': azure_bdist_wheel, diff --git a/src/azure-cli/azure/cli/__init__.py b/src/azure-cli/azure/cli/__init__.py index fcadd389abf..402ff3d1932 100644 --- a/src/azure-cli/azure/cli/__init__.py +++ b/src/azure-cli/azure/cli/__init__.py @@ -2,5 +2,9 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- +<<<<<<< HEAD __author__ = "Microsoft Corporation " __version__ = "2.9.1" +======= +__path__ = __import__("pkgutil").extend_path(__path__, __name__) +>>>>>>> elegant way to handle __main__.py diff --git a/src/azure-cli/azure/cli/__main__.py b/src/azure-cli/azure/cli/__main__.py index 1558a8266e9..3a9b3858b8f 100644 --- a/src/azure-cli/azure/cli/__main__.py +++ b/src/azure-cli/azure/cli/__main__.py @@ -12,6 +12,9 @@ from knack.completion import ARGCOMPLETE_ENV_NAME from knack.log import get_logger +__author__ = "Microsoft Corporation " +__version__ = "2.9.0" + # Log the start time # TODO: Disable E402 "Module level import not at top of file" so that imports can also be timed start_time = timeit.default_timer() diff --git a/src/azure-cli/azure_bdist_wheel.py b/src/azure-cli/azure_bdist_wheel.py index 8a81d1b6177..c8083d8896b 100644 --- a/src/azure-cli/azure_bdist_wheel.py +++ b/src/azure-cli/azure_bdist_wheel.py @@ -29,25 +29,18 @@ def 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)) + 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: + logger.info("skip {} as it is not include in the build target".format(init_file)) bdist_wheel.write_record(self, bdist_dir, distinfo_dir) cmdclass = { 'bdist_wheel': azure_bdist_wheel, diff --git a/src/azure-cli/setup.py b/src/azure-cli/setup.py index f7eddce235a..800339001f0 100644 --- a/src/azure-cli/setup.py +++ b/src/azure-cli/setup.py @@ -22,7 +22,7 @@ # If we have source, validate that our version numbers match # This should prevent uploading releases with mismatched versions. try: - with open('azure/cli/__init__.py', 'r', encoding='utf-8') as f: + with open('azure/cli/__main__.py', 'r', encoding='utf-8') as f: content = f.read() except OSError: pass @@ -31,7 +31,7 @@ m = re.search(r'__version__\s*=\s*[\'"](.+?)[\'"]', content) if not m: - print('Could not find __version__ in azure/cli/__init__.py') + print('Could not find __version__ in azure/cli/__main__.py') sys.exit(1) if m.group(1) != VERSION: print('Expected __version__ = "{}"; found "{}"'.format(VERSION, m.group(1))) @@ -165,7 +165,6 @@ packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests", "azure"]), install_requires=DEPENDENCIES, package_data={ - 'azure.cli.core': ['auth_landing_pages/*.html'], 'azure.cli.command_modules.acr': ['*.json'], 'azure.cli.command_modules.botservice': ['*.json', '*.config'], 'azure.cli.command_modules.monitor.operations': ['autoscale-parameters-template.json'], From 6e23b628df776a33c6211a07355eca4afc45f7a7 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Wed, 15 Jul 2020 17:27:12 +0800 Subject: [PATCH 05/70] remove nspkg --- .snapcraft.yaml | 2 +- Dockerfile | 1 - Dockerfile.nanoserver | 1 - azure-cli.pyproj | 16 ---------------- azure-cli2017.pyproj | 17 ----------------- doc/authoring_command_modules/README.md | 4 ---- scripts/release/debian/Dockerfile | 1 - .../homebrew/docker/formula_template.txt | 2 -- tools/automation/style/__init__.py | 2 +- 9 files changed, 2 insertions(+), 44 deletions(-) diff --git a/.snapcraft.yaml b/.snapcraft.yaml index a48d019ec71..29390985351 100644 --- a/.snapcraft.yaml +++ b/.snapcraft.yaml @@ -28,7 +28,7 @@ parts: - libssl1.0.0 requirements: requirements.txt install: | - python_packages="src/azure-cli-core src/azure-cli-nspkg src/azure-cli-command_modules-nspkg src/command_modules/azure-cli*" + python_packages="src/azure-cli-core src/command_modules/azure-cli*" export PYTHONUSERBASE=$SNAPCRAFT_PART_INSTALL export PYTHONHOME=$SNAPCRAFT_PART_INSTALL/usr echo $SNAPCRAFT_PART_INSTALL/usr/bin/python3 diff --git a/Dockerfile b/Dockerfile index 60dc84bb84a..ecc5a489e39 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,7 +50,6 @@ COPY . /azure-cli # 1. Build packages and store in tmp dir # 2. Install the cli and the other command modules that weren't included -# 3. Temporary fix - install azure-nspkg to remove import of pkg_resources in azure/__init__.py (to improve performance) RUN ./scripts/install_full.sh \ && cat /azure-cli/az.completion > ~/.bashrc \ && runDeps="$( \ diff --git a/Dockerfile.nanoserver b/Dockerfile.nanoserver index f6e9bb7597d..442ac8ed942 100644 --- a/Dockerfile.nanoserver +++ b/Dockerfile.nanoserver @@ -78,7 +78,6 @@ foreach($m in $modules) \ { \ & pip install --no-cache-dir $m; \ }\ -& pip install --no-cache-dir --force-reinstall --upgrade azure-nspkg azure-mgmt-nspkg; \ Pop-Location; \ Write-Host 'Done'; diff --git a/azure-cli.pyproj b/azure-cli.pyproj index d32a0c24106..cf4117aca47 100644 --- a/azure-cli.pyproj +++ b/azure-cli.pyproj @@ -23,8 +23,6 @@ 10.0 - - @@ -78,8 +76,6 @@ - - @@ -785,10 +781,6 @@ - - - - @@ -797,9 +789,6 @@ - - - @@ -1130,13 +1119,8 @@ - - - - - diff --git a/azure-cli2017.pyproj b/azure-cli2017.pyproj index 7965aa145c8..4ee36c90454 100644 --- a/azure-cli2017.pyproj +++ b/azure-cli2017.pyproj @@ -23,8 +23,6 @@ 10.0 - - @@ -90,8 +88,6 @@ - - @@ -966,10 +962,6 @@ - - - - @@ -983,9 +975,6 @@ - - - @@ -1199,10 +1188,6 @@ - - - - @@ -1216,8 +1201,6 @@ - - diff --git a/doc/authoring_command_modules/README.md b/doc/authoring_command_modules/README.md index 8db4514a55e..f5250e0699e 100644 --- a/doc/authoring_command_modules/README.md +++ b/doc/authoring_command_modules/README.md @@ -55,10 +55,6 @@ Also, you can run `az` and if your command module contributes any commands, they If your commands aren't showing with `az`, use `az --debug` to help debug. There could have been an exception thrown whilst attempting to load your module. -**Note for locally installed Azure SDKs:** -If you're receiving Azure import errors, run `pip install -I azure-nspkg==1.0.0` in your virtual environment -after installing your SDK locally. - Authoring command modules ------ diff --git a/scripts/release/debian/Dockerfile b/scripts/release/debian/Dockerfile index a45c419a20b..bc408223447 100644 --- a/scripts/release/debian/Dockerfile +++ b/scripts/release/debian/Dockerfile @@ -29,7 +29,6 @@ RUN mkdir -p ./bin/pypi && \ BUILD_STAGINGDIRECTORY=/azure-cli/bin/pypi ./scripts/release/pypi/build.sh && \ if [ -d ./privates ]; then find ./privates -name '*.whl' | xargs pip install; fi && \ find ./bin/pypi -name '*.whl' | xargs pip install && \ - pip install --force-reinstall --upgrade azure-nspkg azure-mgmt-nspkg && \ pip install --force-reinstall urllib3==1.24.2 ARG cli_version=0.0.0-dev diff --git a/scripts/release/homebrew/docker/formula_template.txt b/scripts/release/homebrew/docker/formula_template.txt index b8f254e211a..519e6b278bc 100644 --- a/scripts/release/homebrew/docker/formula_template.txt +++ b/scripts/release/homebrew/docker/formula_template.txt @@ -28,8 +28,6 @@ class AzureCli < Formula buildpath/"src/azure-cli", buildpath/"src/azure-cli-telemetry", buildpath/"src/azure-cli-core", - buildpath/"src/azure-cli-nspkg", - buildpath/"src/azure-cli-command_modules-nspkg", ] # Install CLI diff --git a/tools/automation/style/__init__.py b/tools/automation/style/__init__.py index 52932960dce..0b1e99788c6 100644 --- a/tools/automation/style/__init__.py +++ b/tools/automation/style/__init__.py @@ -59,7 +59,7 @@ def define_arguments(parser): help='Run pylint') parser.add_argument('--module', dest='modules', action='append', help='The modules on which the style check should run. Accept short names, ' - 'except azure-cli, azure-cli-core and azure-cli-nspkg') + 'except azure-cli and azure-cli-core') def main_style(args): From 9a97ee41ad5d3986b95a70288eb725ab90aa59fd Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Thu, 16 Jul 2020 16:49:37 +0800 Subject: [PATCH 06/70] refactor azure_bdist_wheel to fit wheel 0.34.2 --- src/azure-cli-core/azure_bdist_wheel.py | 13 +++++++++---- src/azure-cli-telemetry/azure_bdist_wheel.py | 13 +++++++++---- src/azure-cli-testsdk/azure_bdist_wheel.py | 13 +++++++++---- src/azure-cli/azure_bdist_wheel.py | 13 +++++++++---- 4 files changed, 36 insertions(+), 16 deletions(-) diff --git a/src/azure-cli-core/azure_bdist_wheel.py b/src/azure-cli-core/azure_bdist_wheel.py index c8083d8896b..753ae493176 100644 --- a/src/azure-cli-core/azure_bdist_wheel.py +++ b/src/azure-cli-core/azure_bdist_wheel.py @@ -29,19 +29,24 @@ def 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 write_record(self, bdist_dir, distinfo_dir): + def write_wheelfile(self, wheelfile_base, generator=None): 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))] + folder_with_init = [os.path.join(*subparts[0:i + 1]) for i in range(len(subparts))] for azure_sub_package in folder_with_init: + bdist_dir = os.path.dirname(wheelfile_base) 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: logger.info("skip {} as it is not include in the build target".format(init_file)) - bdist_wheel.write_record(self, bdist_dir, distinfo_dir) + + if generator is None: + bdist_wheel.write_wheelfile(self, wheelfile_base) + else: + bdist_wheel.write_wheelfile(self, wheelfile_base, generator) + cmdclass = { 'bdist_wheel': azure_bdist_wheel, } diff --git a/src/azure-cli-telemetry/azure_bdist_wheel.py b/src/azure-cli-telemetry/azure_bdist_wheel.py index c8083d8896b..753ae493176 100644 --- a/src/azure-cli-telemetry/azure_bdist_wheel.py +++ b/src/azure-cli-telemetry/azure_bdist_wheel.py @@ -29,19 +29,24 @@ def 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 write_record(self, bdist_dir, distinfo_dir): + def write_wheelfile(self, wheelfile_base, generator=None): 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))] + folder_with_init = [os.path.join(*subparts[0:i + 1]) for i in range(len(subparts))] for azure_sub_package in folder_with_init: + bdist_dir = os.path.dirname(wheelfile_base) 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: logger.info("skip {} as it is not include in the build target".format(init_file)) - bdist_wheel.write_record(self, bdist_dir, distinfo_dir) + + if generator is None: + bdist_wheel.write_wheelfile(self, wheelfile_base) + else: + bdist_wheel.write_wheelfile(self, wheelfile_base, generator) + cmdclass = { 'bdist_wheel': azure_bdist_wheel, } diff --git a/src/azure-cli-testsdk/azure_bdist_wheel.py b/src/azure-cli-testsdk/azure_bdist_wheel.py index c8083d8896b..753ae493176 100644 --- a/src/azure-cli-testsdk/azure_bdist_wheel.py +++ b/src/azure-cli-testsdk/azure_bdist_wheel.py @@ -29,19 +29,24 @@ def 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 write_record(self, bdist_dir, distinfo_dir): + def write_wheelfile(self, wheelfile_base, generator=None): 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))] + folder_with_init = [os.path.join(*subparts[0:i + 1]) for i in range(len(subparts))] for azure_sub_package in folder_with_init: + bdist_dir = os.path.dirname(wheelfile_base) 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: logger.info("skip {} as it is not include in the build target".format(init_file)) - bdist_wheel.write_record(self, bdist_dir, distinfo_dir) + + if generator is None: + bdist_wheel.write_wheelfile(self, wheelfile_base) + else: + bdist_wheel.write_wheelfile(self, wheelfile_base, generator) + cmdclass = { 'bdist_wheel': azure_bdist_wheel, } diff --git a/src/azure-cli/azure_bdist_wheel.py b/src/azure-cli/azure_bdist_wheel.py index c8083d8896b..753ae493176 100644 --- a/src/azure-cli/azure_bdist_wheel.py +++ b/src/azure-cli/azure_bdist_wheel.py @@ -29,19 +29,24 @@ def 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 write_record(self, bdist_dir, distinfo_dir): + def write_wheelfile(self, wheelfile_base, generator=None): 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))] + folder_with_init = [os.path.join(*subparts[0:i + 1]) for i in range(len(subparts))] for azure_sub_package in folder_with_init: + bdist_dir = os.path.dirname(wheelfile_base) 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: logger.info("skip {} as it is not include in the build target".format(init_file)) - bdist_wheel.write_record(self, bdist_dir, distinfo_dir) + + if generator is None: + bdist_wheel.write_wheelfile(self, wheelfile_base) + else: + bdist_wheel.write_wheelfile(self, wheelfile_base, generator) + cmdclass = { 'bdist_wheel': azure_bdist_wheel, } From b491f9713c5d2db7fe790d16df90c9e8ccbac229 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Thu, 16 Jul 2020 17:28:50 +0800 Subject: [PATCH 07/70] add namespace package __init__.py to sdist --- src/azure-cli-core/MANIFEST.in | 4 +++- src/azure-cli-telemetry/MANIFEST.in | 4 +++- src/azure-cli-testsdk/MANIFEST.in | 4 +++- src/azure-cli/MANIFEST.in | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/azure-cli-core/MANIFEST.in b/src/azure-cli-core/MANIFEST.in index 9ecaeb15de5..9c3f67387c5 100644 --- a/src/azure-cli-core/MANIFEST.in +++ b/src/azure-cli-core/MANIFEST.in @@ -1,2 +1,4 @@ include *.rst -include azure_bdist_wheel.py \ No newline at end of file +include azure_bdist_wheel.py +include azure/__init__.py +include azure/cli/__init__.py \ No newline at end of file diff --git a/src/azure-cli-telemetry/MANIFEST.in b/src/azure-cli-telemetry/MANIFEST.in index 9ecaeb15de5..9c3f67387c5 100644 --- a/src/azure-cli-telemetry/MANIFEST.in +++ b/src/azure-cli-telemetry/MANIFEST.in @@ -1,2 +1,4 @@ include *.rst -include azure_bdist_wheel.py \ No newline at end of file +include azure_bdist_wheel.py +include azure/__init__.py +include azure/cli/__init__.py \ No newline at end of file diff --git a/src/azure-cli-testsdk/MANIFEST.in b/src/azure-cli-testsdk/MANIFEST.in index 9ecaeb15de5..9c3f67387c5 100644 --- a/src/azure-cli-testsdk/MANIFEST.in +++ b/src/azure-cli-testsdk/MANIFEST.in @@ -1,2 +1,4 @@ include *.rst -include azure_bdist_wheel.py \ No newline at end of file +include azure_bdist_wheel.py +include azure/__init__.py +include azure/cli/__init__.py \ No newline at end of file diff --git a/src/azure-cli/MANIFEST.in b/src/azure-cli/MANIFEST.in index 53b2eb48bf9..d54ffe8eb4f 100644 --- a/src/azure-cli/MANIFEST.in +++ b/src/azure-cli/MANIFEST.in @@ -1,4 +1,6 @@ include LICENSE.txt include HISTORY.rst include README.rst -include azure_bdist_wheel.py \ No newline at end of file +include azure_bdist_wheel.py +include azure/__init__.py +include azure/cli/__init__.py \ No newline at end of file From 3687e19a8f13cf9c8b9190a76c5733c3f11aa08f Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Thu, 16 Jul 2020 17:34:24 +0800 Subject: [PATCH 08/70] fix merge conflict --- src/azure-cli/azure/cli/__init__.py | 5 ----- src/azure-cli/azure/cli/__main__.py | 2 +- src/azure-cli/requirements.py3.Darwin.txt | 7 ------- src/azure-cli/requirements.py3.Linux.txt | 7 ------- src/azure-cli/requirements.py3.windows.txt | 7 ------- 5 files changed, 1 insertion(+), 27 deletions(-) diff --git a/src/azure-cli/azure/cli/__init__.py b/src/azure-cli/azure/cli/__init__.py index 402ff3d1932..2ae78104e94 100644 --- a/src/azure-cli/azure/cli/__init__.py +++ b/src/azure-cli/azure/cli/__init__.py @@ -2,9 +2,4 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -<<<<<<< HEAD -__author__ = "Microsoft Corporation " -__version__ = "2.9.1" -======= __path__ = __import__("pkgutil").extend_path(__path__, __name__) ->>>>>>> elegant way to handle __main__.py diff --git a/src/azure-cli/azure/cli/__main__.py b/src/azure-cli/azure/cli/__main__.py index 3a9b3858b8f..5bd7d17efe2 100644 --- a/src/azure-cli/azure/cli/__main__.py +++ b/src/azure-cli/azure/cli/__main__.py @@ -13,7 +13,7 @@ from knack.log import get_logger __author__ = "Microsoft Corporation " -__version__ = "2.9.0" +__version__ = "2.9.1" # Log the start time # TODO: Disable E402 "Module level import not at top of file" so that imports can also be timed diff --git a/src/azure-cli/requirements.py3.Darwin.txt b/src/azure-cli/requirements.py3.Darwin.txt index 285819738d6..f7b93e2b032 100644 --- a/src/azure-cli/requirements.py3.Darwin.txt +++ b/src/azure-cli/requirements.py3.Darwin.txt @@ -4,15 +4,8 @@ applicationinsights==0.11.9 argcomplete==1.11.1 asn1crypto==0.24.0 azure-batch==9.0.0 -<<<<<<< HEAD azure-cli==2.9.1 -azure-cli-command-modules-nspkg==2.0.3 azure-cli-core==2.9.1 -azure-cli-nspkg==3.0.4 -======= -azure-cli==2.9.0 -azure-cli-core==2.9.0 ->>>>>>> init pep420 change azure-cli-telemetry==1.0.4 azure-common==1.1.22 azure-cosmos==3.2.0 diff --git a/src/azure-cli/requirements.py3.Linux.txt b/src/azure-cli/requirements.py3.Linux.txt index b6a192f9ef7..7b196abfe95 100644 --- a/src/azure-cli/requirements.py3.Linux.txt +++ b/src/azure-cli/requirements.py3.Linux.txt @@ -4,15 +4,8 @@ applicationinsights==0.11.9 argcomplete==1.11.1 asn1crypto==0.24.0 azure-batch==9.0.0 -<<<<<<< HEAD azure-cli==2.9.1 -azure-cli-command-modules-nspkg==2.0.3 azure-cli-core==2.9.1 -azure-cli-nspkg==3.0.4 -======= -azure-cli==2.9.0 -azure-cli-core==2.9.0 ->>>>>>> init pep420 change azure-cli-telemetry==1.0.4 azure-common==1.1.22 azure-cosmos==3.2.0 diff --git a/src/azure-cli/requirements.py3.windows.txt b/src/azure-cli/requirements.py3.windows.txt index dd5f3a6584e..d317e84fa30 100644 --- a/src/azure-cli/requirements.py3.windows.txt +++ b/src/azure-cli/requirements.py3.windows.txt @@ -4,15 +4,8 @@ applicationinsights==0.11.7 argcomplete==1.11.1 asn1crypto==0.24.0 azure-batch==9.0.0 -<<<<<<< HEAD azure-cli==2.9.1 -azure-cli-command-modules-nspkg==2.0.3 azure-cli-core==2.9.1 -azure-cli-nspkg==3.0.4 -======= -azure-cli==2.9.0 -azure-cli-core==2.9.0 ->>>>>>> init pep420 change azure-cli-telemetry==1.0.4 azure-common==1.1.22 azure-cosmos==3.2.0 From 2304e2b5532a7f1e459ca84551b7e0889fff171c Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Mon, 20 Jul 2020 14:34:35 +0800 Subject: [PATCH 09/70] fix generic update problem --- .azure-pipelines/templates/automation_test.yml | 15 +++++++++++++++ .../azure/cli/core/tests/test_generic_update.py | 8 ++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.azure-pipelines/templates/automation_test.yml b/.azure-pipelines/templates/automation_test.yml index 76b8891b35c..482f1930844 100644 --- a/.azure-pipelines/templates/automation_test.yml +++ b/.azure-pipelines/templates/automation_test.yml @@ -7,7 +7,22 @@ steps: inputs: versionSpec: ${{ parameters.pythonVersion }} displayName: "Use Python ${{ parameters.pythonVersion }}" +<<<<<<< HEAD - template: ./azdev_setup.yml +======= + - bash: | + set -ev + + python -m venv env + chmod +x env/bin/activate + source env/bin/activate + + pip install -q git+https://github.com/Azure/azure-cli-dev-tools.git@pep420 + azdev --version + + azdev setup -c ./ + displayName: Setup Env +>>>>>>> fix generic update problem - bash: | set -ev diff --git a/src/azure-cli-core/azure/cli/core/tests/test_generic_update.py b/src/azure-cli-core/azure/cli/core/tests/test_generic_update.py index 48d13cb374a..0e5ed0e726a 100644 --- a/src/azure-cli-core/azure/cli/core/tests/test_generic_update.py +++ b/src/azure-cli-core/azure/cli/core/tests/test_generic_update.py @@ -84,10 +84,10 @@ def my_get(): def my_set(**kwargs): # pylint:disable=unused-argument return my_obj - - test_type = CliCommandType(operations_tmpl='{}#{{}}'.format(__name__)) - setattr(sys.modules[__name__], my_get.__name__, my_get) - setattr(sys.modules[__name__], my_set.__name__, my_set) + test_module = 'azure.cli.core.tests.test_generic_update' + test_type = CliCommandType(operations_tmpl='{}#{{}}'.format(test_module)) + setattr(sys.modules[test_module], my_get.__name__, my_get) + setattr(sys.modules[test_module], my_set.__name__, my_set) with self.command_group('', test_type) as g: g.generic_update_command('genupdate', getter_name='my_get', setter_name='my_set') From 1a286fd9e66479f894df5eb389e14e5c0bb35ba1 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Mon, 20 Jul 2020 14:41:29 +0800 Subject: [PATCH 10/70] fix merge conflict --- azure-pipelines.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 21e287b3317..f38e2e4ba5c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -140,23 +140,7 @@ jobs: displayName: 'Use Python 3.7' inputs: versionSpec: 3.7 -<<<<<<< HEAD - template: .azure-pipelines/templates/azdev_setup.yml -======= - - - bash: | - #!/usr/bin/env bash - - set -ev - - pip install virtualenv - python -m virtualenv venv/ - . ./venv/bin/activate - pip install -q git+https://github.com/Azure/azure-cli-dev-tools.git@pep420 - azdev setup -c $(pwd) - displayName: 'Install azdev' - ->>>>>>> init pep420 change - bash: | set -ev . env/bin/activate From dda178ce3521ba3de46cf133e54ca313edadb79f Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Tue, 21 Jul 2020 14:54:25 +0800 Subject: [PATCH 11/70] upgrade telemetry version --- src/azure-cli-telemetry/HISTORY.rst | 4 ++++ src/azure-cli-telemetry/setup.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/azure-cli-telemetry/HISTORY.rst b/src/azure-cli-telemetry/HISTORY.rst index be11b3b7864..ed953bae2f0 100644 --- a/src/azure-cli-telemetry/HISTORY.rst +++ b/src/azure-cli-telemetry/HISTORY.rst @@ -2,6 +2,10 @@ Release History =============== +1.0.5 ++++++ +* Support PEP420 namespace package + 1.0.4 +++++ * MANIFEST file change to fix wheel install diff --git a/src/azure-cli-telemetry/setup.py b/src/azure-cli-telemetry/setup.py index 66019f6fa3f..f413fe55ca7 100755 --- a/src/azure-cli-telemetry/setup.py +++ b/src/azure-cli-telemetry/setup.py @@ -16,7 +16,7 @@ logger.warn("Wheel is not available, disabling bdist_wheel hook") cmdclass = {} -VERSION = "1.0.4" +VERSION = "1.0.5" CLASSIFIERS = [ 'Development Status :: 5 - Production/Stable', From efd134e0a2f028a7b9a6d465e13058af3c2f9034 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Tue, 21 Jul 2020 15:32:09 +0800 Subject: [PATCH 12/70] upgrade telemetry version --- src/azure-cli/requirements.py3.Darwin.txt | 2 +- src/azure-cli/requirements.py3.Linux.txt | 2 +- src/azure-cli/requirements.py3.windows.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/azure-cli/requirements.py3.Darwin.txt b/src/azure-cli/requirements.py3.Darwin.txt index f7b93e2b032..1845740b4ba 100644 --- a/src/azure-cli/requirements.py3.Darwin.txt +++ b/src/azure-cli/requirements.py3.Darwin.txt @@ -6,7 +6,7 @@ asn1crypto==0.24.0 azure-batch==9.0.0 azure-cli==2.9.1 azure-cli-core==2.9.1 -azure-cli-telemetry==1.0.4 +azure-cli-telemetry==1.0.5 azure-common==1.1.22 azure-cosmos==3.2.0 azure-datalake-store==0.0.48 diff --git a/src/azure-cli/requirements.py3.Linux.txt b/src/azure-cli/requirements.py3.Linux.txt index 7b196abfe95..48e3ac67570 100644 --- a/src/azure-cli/requirements.py3.Linux.txt +++ b/src/azure-cli/requirements.py3.Linux.txt @@ -6,7 +6,7 @@ asn1crypto==0.24.0 azure-batch==9.0.0 azure-cli==2.9.1 azure-cli-core==2.9.1 -azure-cli-telemetry==1.0.4 +azure-cli-telemetry==1.0.5 azure-common==1.1.22 azure-cosmos==3.2.0 azure-datalake-store==0.0.48 diff --git a/src/azure-cli/requirements.py3.windows.txt b/src/azure-cli/requirements.py3.windows.txt index d317e84fa30..5c3dfc8ae2e 100644 --- a/src/azure-cli/requirements.py3.windows.txt +++ b/src/azure-cli/requirements.py3.windows.txt @@ -6,7 +6,7 @@ asn1crypto==0.24.0 azure-batch==9.0.0 azure-cli==2.9.1 azure-cli-core==2.9.1 -azure-cli-telemetry==1.0.4 +azure-cli-telemetry==1.0.5 azure-common==1.1.22 azure-cosmos==3.2.0 azure-datalake-store==0.0.48 From b8f203d5907dc886bfd16e2c49bab69348d6d7dd Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Tue, 21 Jul 2020 17:10:21 +0800 Subject: [PATCH 13/70] rollback some useless change --- .vscode/launch.json | 6 +++--- scripts/ci/install_azdev.sh | 12 ------------ .../command_modules/eventgrid/linter_exclusions.yml | 12 ------------ 3 files changed, 3 insertions(+), 27 deletions(-) delete mode 100644 scripts/ci/install_azdev.sh delete mode 100644 src/azure-cli/azure/cli/command_modules/eventgrid/linter_exclusions.yml diff --git a/.vscode/launch.json b/.vscode/launch.json index 1187e215bf1..a3bb8f78c2a 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,7 +5,7 @@ "name": "Azure CLI Debug (Integrated Console)", "type": "python", "request": "launch", - "pythonPath": "${command:python.interpreterPath}", + "pythonPath": "${config:python.pythonPath}", "program": "${workspaceRoot}/src/azure-cli/azure/cli/__main__.py", "cwd": "${workspaceRoot}", "args": [ @@ -24,7 +24,7 @@ "type": "python", "request": "launch", "stopOnEntry": true, - "pythonPath": "${command:python.interpreterPath}", + "pythonPath": "${config:python.pythonPath}", "program": "${workspaceRoot}/src/azure-cli/azure/cli/__main__.py", "cwd": "${workspaceRoot}", "args": [ @@ -40,7 +40,7 @@ "name": "Azdev Scripts", "type": "python", "request": "launch", - "pythonPath": "${command:python.interpreterPath}", + "pythonPath": "${config:python.pythonPath}", "program": "${workspaceRoot}/tools/automation/__main__.py", "cwd": "${workspaceRoot}", "args": [ diff --git a/scripts/ci/install_azdev.sh b/scripts/ci/install_azdev.sh deleted file mode 100644 index 6f597e70441..00000000000 --- a/scripts/ci/install_azdev.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -set -e - -echo "Install azdev into virtual environment" -export CI="ADO" -pip install virtualenv -python -m virtualenv env -. env/bin/activate -pip install -U pip setuptools wheel -q -pip install -q git+https://github.com/Azure/azure-cli-dev-tools.git@pep420 -azdev setup -c diff --git a/src/azure-cli/azure/cli/command_modules/eventgrid/linter_exclusions.yml b/src/azure-cli/azure/cli/command_modules/eventgrid/linter_exclusions.yml deleted file mode 100644 index 61ede431b8a..00000000000 --- a/src/azure-cli/azure/cli/command_modules/eventgrid/linter_exclusions.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -eventgrid partner topic event-subscription update: - parameters: - endpoint_type: - rule_exclusions: - - no_parameter_defaults_for_update_commands -eventgrid system-topic event-subscription update: - parameters: - endpoint_type: - rule_exclusions: - - no_parameter_defaults_for_update_commands -... \ No newline at end of file From 4d184489b3f41b73d13135c4db77306e6b48d8a2 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Tue, 21 Jul 2020 17:18:33 +0800 Subject: [PATCH 14/70] build yum/deb/homebrew etx --- azure-pipelines.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f38e2e4ba5c..a2f16d6fa69 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -485,7 +485,7 @@ jobs: displayName: Build Homebrew Formula dependsOn: BuildPythonWheel - condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual')) + condition: succeeded() pool: vmImage: 'ubuntu-16.04' steps: @@ -576,7 +576,7 @@ jobs: displayName: Build Yum Package dependsOn: BuildPythonWheel - condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual')) + condition: succeeded() pool: vmImage: 'ubuntu-16.04' steps: @@ -597,7 +597,7 @@ jobs: displayName: Test Yum Package dependsOn: BuildYumPackage - condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual')) + condition: succeeded() pool: vmImage: 'ubuntu-16.04' steps: @@ -633,7 +633,7 @@ jobs: displayName: Build Ubuntu Packages dependsOn: BuildPythonWheel - condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual')) + condition: succeeded() pool: vmImage: 'ubuntu-16.04' strategy: @@ -674,7 +674,7 @@ jobs: displayName: Build Debian Packages dependsOn: BuildPythonWheel - condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual')) + condition: succeeded() pool: vmImage: 'ubuntu-16.04' strategy: @@ -714,7 +714,7 @@ jobs: dependsOn: - BuildUbuntuPackages - BuildDebianPackages - condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual')) + condition: succeeded() pool: vmImage: 'ubuntu-16.04' steps: From c5d2930234230f1b2467e927130f00c36e3aa5e2 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Wed, 22 Jul 2020 11:22:26 +0800 Subject: [PATCH 15/70] use template to generate formula --- scripts/release/homebrew/docker/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/release/homebrew/docker/run.sh b/scripts/release/homebrew/docker/run.sh index b1375310371..2242efb8be9 100755 --- a/scripts/release/homebrew/docker/run.sh +++ b/scripts/release/homebrew/docker/run.sh @@ -10,4 +10,4 @@ pip install -r /mnt/src/azure-cli/requirements.py3.Darwin.txt pip list -python $root/formula_generate.py +python $root/formula_generate.py -b use_template From c1e76eaddc1ba5bdcf8b3910405dcdf96e0294d2 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Wed, 22 Jul 2020 11:46:51 +0800 Subject: [PATCH 16/70] update build.cmd --- build_scripts/windows/scripts/build.cmd | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build_scripts/windows/scripts/build.cmd b/build_scripts/windows/scripts/build.cmd index f69e474b3c2..c21939e0726 100644 --- a/build_scripts/windows/scripts/build.cmd +++ b/build_scripts/windows/scripts/build.cmd @@ -145,6 +145,12 @@ for /d /r %BUILDING_DIR%\Lib\site-packages\pip %%d in (__pycache__) do ( if exist %%d rmdir /s /q "%%d" ) +set AZURE_CLI_INIT_FILE=%BUILDING_DIR%\Lib\site-packages\azure\cli\__int__.pyc +if exist %AZURE_CLI_INIT_FILE% ( + echo Deleting extra __int__.pyc + del %AZURE_CLI_INIT_FILE% +) + if %errorlevel% neq 0 goto ERROR ::ensure propagate_env_change.exe is available From 0a1c1701714d2d4f0c2bd9948914510e0cb63716 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Wed, 22 Jul 2020 13:27:19 +0800 Subject: [PATCH 17/70] update build scripts --- build_scripts/windows/scripts/build.cmd | 2 +- scripts/release/debian/build.sh | 6 ++++++ scripts/release/homebrew/docker/formula_template.txt | 7 +++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/build_scripts/windows/scripts/build.cmd b/build_scripts/windows/scripts/build.cmd index c21939e0726..9cb070c4595 100644 --- a/build_scripts/windows/scripts/build.cmd +++ b/build_scripts/windows/scripts/build.cmd @@ -147,7 +147,7 @@ for /d /r %BUILDING_DIR%\Lib\site-packages\pip %%d in (__pycache__) do ( set AZURE_CLI_INIT_FILE=%BUILDING_DIR%\Lib\site-packages\azure\cli\__int__.pyc if exist %AZURE_CLI_INIT_FILE% ( - echo Deleting extra __int__.pyc + echo Deleting __int__.pyc del %AZURE_CLI_INIT_FILE% ) diff --git a/scripts/release/debian/build.sh b/scripts/release/debian/build.sh index 6b007198344..3156dab017f 100755 --- a/scripts/release/debian/build.sh +++ b/scripts/release/debian/build.sh @@ -38,6 +38,12 @@ export PATH=$PATH:$WORKDIR/python_env/bin find ${WORKDIR}/src/ -name setup.py -type f | xargs -I {} dirname {} | grep -v azure-cli-testsdk | xargs pip3 install --no-deps pip3 install -r ${WORKDIR}/src/azure-cli/requirements.py3.$(uname).txt +if -f ${WORKDIR}/src/azure/cli/__init__.py; then +if [ -f "${WORKDIR}/src/azure/cli/__init__.py" ]; then + echo "Deleting __int__.py" + rm -f ${WORKDIR}/src/azure/cli/__init__.py +fi + # Create create directory for debian build mkdir -p $WORKDIR/debian $SCRIPT_DIR/prepare.sh $WORKDIR/debian $WORKDIR/az.completion $WORKDIR diff --git a/scripts/release/homebrew/docker/formula_template.txt b/scripts/release/homebrew/docker/formula_template.txt index 519e6b278bc..89d47b483cb 100644 --- a/scripts/release/homebrew/docker/formula_template.txt +++ b/scripts/release/homebrew/docker/formula_template.txt @@ -6,6 +6,7 @@ class AzureCli < Formula url "{{ upstream_url }}" version "{{ cli_version }}" sha256 "{{ upstream_sha }}" + license "MIT" head "https://github.com/Azure/azure-cli.git" {{ bottle_hash }} @@ -13,6 +14,12 @@ class AzureCli < Formula depends_on "openssl@1.1" depends_on "python@3.8" + uses_from_macos "libffi" + + on_linux do + depends_on "pkg-config" => :build + end + {{ resources }} def install From d895720ef6318e7907f77a2a80b20cfd8ac9977e Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Mon, 27 Jul 2020 13:35:35 +0800 Subject: [PATCH 18/70] upgrade azure-mutliapi-storage to 0.3.6 --- src/azure-cli/requirements.py3.Darwin.txt | 2 +- src/azure-cli/requirements.py3.Linux.txt | 2 +- src/azure-cli/requirements.py3.windows.txt | 2 +- src/azure-cli/setup.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/azure-cli/requirements.py3.Darwin.txt b/src/azure-cli/requirements.py3.Darwin.txt index 1845740b4ba..17def6d8dd3 100644 --- a/src/azure-cli/requirements.py3.Darwin.txt +++ b/src/azure-cli/requirements.py3.Darwin.txt @@ -77,7 +77,7 @@ azure-mgmt-sqlvirtualmachine==0.5.0 azure-mgmt-storage==11.1.0 azure-mgmt-trafficmanager==0.51.0 azure-mgmt-web==0.47.0 -azure-multiapi-storage==0.3.5 +azure-multiapi-storage==0.3.6 azure-loganalytics==0.1.0 azure-storage-common==1.4.2 bcrypt==3.1.7 diff --git a/src/azure-cli/requirements.py3.Linux.txt b/src/azure-cli/requirements.py3.Linux.txt index 48e3ac67570..ec065c364a9 100644 --- a/src/azure-cli/requirements.py3.Linux.txt +++ b/src/azure-cli/requirements.py3.Linux.txt @@ -77,7 +77,7 @@ azure-mgmt-sqlvirtualmachine==0.5.0 azure-mgmt-storage==11.1.0 azure-mgmt-trafficmanager==0.51.0 azure-mgmt-web==0.47.0 -azure-multiapi-storage==0.3.5 +azure-multiapi-storage==0.3.6 azure-loganalytics==0.1.0 azure-storage-common==1.4.2 bcrypt==3.1.7 diff --git a/src/azure-cli/requirements.py3.windows.txt b/src/azure-cli/requirements.py3.windows.txt index 5c3dfc8ae2e..728dddb57ab 100644 --- a/src/azure-cli/requirements.py3.windows.txt +++ b/src/azure-cli/requirements.py3.windows.txt @@ -76,7 +76,7 @@ azure-mgmt-sqlvirtualmachine==0.5.0 azure-mgmt-storage==11.1.0 azure-mgmt-trafficmanager==0.51.0 azure-mgmt-web==0.47.0 -azure-multiapi-storage==0.3.5 +azure-multiapi-storage==0.3.6 azure-loganalytics==0.1.0 azure-storage-common==1.4.2 bcrypt==3.1.7 diff --git a/src/azure-cli/setup.py b/src/azure-cli/setup.py index 800339001f0..5754fba0e99 100644 --- a/src/azure-cli/setup.py +++ b/src/azure-cli/setup.py @@ -120,7 +120,7 @@ 'azure-mgmt-storage~=11.1.0', 'azure-mgmt-trafficmanager~=0.51.0', 'azure-mgmt-web~=0.47.0', - 'azure-multiapi-storage~=0.3.5', + 'azure-multiapi-storage~=0.3.6', 'azure-loganalytics~=0.1.0', 'azure-storage-common~=1.4', 'cryptography>=2.3.1,<3.0.0', From c8166bc06e6b11b5f87e48c43508ba2262fc3189 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Mon, 27 Jul 2020 13:39:40 +0800 Subject: [PATCH 19/70] fix debian build script --- scripts/release/debian/build.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/release/debian/build.sh b/scripts/release/debian/build.sh index 3156dab017f..8ac6823cca9 100755 --- a/scripts/release/debian/build.sh +++ b/scripts/release/debian/build.sh @@ -38,7 +38,6 @@ export PATH=$PATH:$WORKDIR/python_env/bin find ${WORKDIR}/src/ -name setup.py -type f | xargs -I {} dirname {} | grep -v azure-cli-testsdk | xargs pip3 install --no-deps pip3 install -r ${WORKDIR}/src/azure-cli/requirements.py3.$(uname).txt -if -f ${WORKDIR}/src/azure/cli/__init__.py; then if [ -f "${WORKDIR}/src/azure/cli/__init__.py" ]; then echo "Deleting __int__.py" rm -f ${WORKDIR}/src/azure/cli/__init__.py From 160276597e6a11214160d9c61d19328b932b0e25 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Mon, 27 Jul 2020 13:43:30 +0800 Subject: [PATCH 20/70] fix merge conflict --- .azure-pipelines/templates/automation_test.yml | 15 --------------- .azure-pipelines/templates/azdev_setup.yml | 4 ---- 2 files changed, 19 deletions(-) diff --git a/.azure-pipelines/templates/automation_test.yml b/.azure-pipelines/templates/automation_test.yml index 482f1930844..76b8891b35c 100644 --- a/.azure-pipelines/templates/automation_test.yml +++ b/.azure-pipelines/templates/automation_test.yml @@ -7,22 +7,7 @@ steps: inputs: versionSpec: ${{ parameters.pythonVersion }} displayName: "Use Python ${{ parameters.pythonVersion }}" -<<<<<<< HEAD - template: ./azdev_setup.yml -======= - - bash: | - set -ev - - python -m venv env - chmod +x env/bin/activate - source env/bin/activate - - pip install -q git+https://github.com/Azure/azure-cli-dev-tools.git@pep420 - azdev --version - - azdev setup -c ./ - displayName: Setup Env ->>>>>>> fix generic update problem - bash: | set -ev diff --git a/.azure-pipelines/templates/azdev_setup.yml b/.azure-pipelines/templates/azdev_setup.yml index 41c11bed2da..7b991bc6d50 100644 --- a/.azure-pipelines/templates/azdev_setup.yml +++ b/.azure-pipelines/templates/azdev_setup.yml @@ -14,12 +14,8 @@ steps: chmod +x env/bin/activate . env/bin/activate -<<<<<<< HEAD - pip install -q azdev==0.1.22 -======= pip install -q git+https://github.com/Azure/azure-cli-dev-tools.git@pep420 ->>>>>>> init pep420 change azdev --version if [ -z "$CLI_EXT_REPO_PATH" ]; then From 09b7101ea4c6308cf3f7568a754e671e8276c387 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Mon, 13 Jul 2020 13:44:38 +0800 Subject: [PATCH 21/70] init pep420 change --- .azure-pipelines/templates/azdev_setup.yml | 5 ++ azure-pipelines.yml | 16 ++++++ build_scripts/windows/scripts/build.cmd | 3 +- scripts/ci/install_azdev.sh | 12 +++++ .../HISTORY.rst | 19 ------- .../MANIFEST.in | 1 - .../README.rst | 8 --- .../azure/cli/command_modules/__init__.py | 0 src/azure-cli-command_modules-nspkg/setup.cfg | 0 src/azure-cli-command_modules-nspkg/setup.py | 49 ------------------- src/azure-cli-core/azure/__init__.py | 3 +- src/azure-cli-core/azure/cli/__init__.py | 3 +- src/azure-cli-core/setup.py | 2 - src/azure-cli-nspkg/HISTORY.rst | 44 ----------------- src/azure-cli-nspkg/MANIFEST.in | 1 - src/azure-cli-nspkg/README.rst | 8 --- src/azure-cli-nspkg/azure/cli/__init__.py | 0 src/azure-cli-nspkg/setup.cfg | 0 src/azure-cli-nspkg/setup.py | 48 ------------------ src/azure-cli-telemetry/azure/__init__.py | 3 +- src/azure-cli-telemetry/azure/cli/__init__.py | 4 +- src/azure-cli-telemetry/setup.py | 2 - src/azure-cli-testsdk/azure/__init__.py | 4 +- src/azure-cli-testsdk/azure/cli/__init__.py | 4 +- src/azure-cli-testsdk/setup.py | 2 - src/azure-cli/README.rst | 1 + src/azure-cli/azure/__init__.py | 3 +- src/azure-cli/azure/cli/__init__.py | 8 +-- .../resource/tests/latest/test_cli_version.py | 2 - src/azure-cli/requirements.py3.Darwin.txt | 11 +++-- src/azure-cli/requirements.py3.Linux.txt | 11 +++-- src/azure-cli/requirements.py3.windows.txt | 11 +++-- src/azure-cli/setup.py | 6 +-- 33 files changed, 66 insertions(+), 228 deletions(-) create mode 100644 scripts/ci/install_azdev.sh delete mode 100644 src/azure-cli-command_modules-nspkg/HISTORY.rst delete mode 100644 src/azure-cli-command_modules-nspkg/MANIFEST.in delete mode 100644 src/azure-cli-command_modules-nspkg/README.rst delete mode 100644 src/azure-cli-command_modules-nspkg/azure/cli/command_modules/__init__.py delete mode 100644 src/azure-cli-command_modules-nspkg/setup.cfg delete mode 100644 src/azure-cli-command_modules-nspkg/setup.py delete mode 100644 src/azure-cli-nspkg/HISTORY.rst delete mode 100644 src/azure-cli-nspkg/MANIFEST.in delete mode 100644 src/azure-cli-nspkg/README.rst delete mode 100644 src/azure-cli-nspkg/azure/cli/__init__.py delete mode 100644 src/azure-cli-nspkg/setup.cfg delete mode 100644 src/azure-cli-nspkg/setup.py diff --git a/.azure-pipelines/templates/azdev_setup.yml b/.azure-pipelines/templates/azdev_setup.yml index 858a600524f..41c11bed2da 100644 --- a/.azure-pipelines/templates/azdev_setup.yml +++ b/.azure-pipelines/templates/azdev_setup.yml @@ -14,7 +14,12 @@ steps: chmod +x env/bin/activate . env/bin/activate +<<<<<<< HEAD pip install -q azdev==0.1.22 +======= + pip install -q git+https://github.com/Azure/azure-cli-dev-tools.git@pep420 + +>>>>>>> init pep420 change azdev --version if [ -z "$CLI_EXT_REPO_PATH" ]; then diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f38e2e4ba5c..21e287b3317 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -140,7 +140,23 @@ jobs: displayName: 'Use Python 3.7' inputs: versionSpec: 3.7 +<<<<<<< HEAD - template: .azure-pipelines/templates/azdev_setup.yml +======= + + - bash: | + #!/usr/bin/env bash + + set -ev + + pip install virtualenv + python -m virtualenv venv/ + . ./venv/bin/activate + pip install -q git+https://github.com/Azure/azure-cli-dev-tools.git@pep420 + azdev setup -c $(pwd) + displayName: 'Install azdev' + +>>>>>>> init pep420 change - bash: | set -ev . env/bin/activate diff --git a/build_scripts/windows/scripts/build.cmd b/build_scripts/windows/scripts/build.cmd index ffb19299b48..f69e474b3c2 100644 --- a/build_scripts/windows/scripts/build.cmd +++ b/build_scripts/windows/scripts/build.cmd @@ -88,7 +88,7 @@ robocopy %PYTHON_DIR% %BUILDING_DIR% /s /NFL /NDL set CLI_SRC=%REPO_ROOT%\src %BUILDING_DIR%\python.exe -m pip install --no-warn-script-location --force-reinstall pycparser==2.18 -for %%a in (%CLI_SRC%\azure-cli %CLI_SRC%\azure-cli-core %CLI_SRC%\azure-cli-nspkg %CLI_SRC%\azure-cli-telemetry) do ( +for %%a in (%CLI_SRC%\azure-cli %CLI_SRC%\azure-cli-core %CLI_SRC%\azure-cli-telemetry) do ( pushd %%a %BUILDING_DIR%\python.exe -m pip install --no-warn-script-location --no-cache-dir --no-deps . popd @@ -97,7 +97,6 @@ for %%a in (%CLI_SRC%\azure-cli %CLI_SRC%\azure-cli-core %CLI_SRC%\azure-cli-nsp if %errorlevel% neq 0 goto ERROR -%BUILDING_DIR%\python.exe -m pip install --no-warn-script-location --force-reinstall --upgrade azure-nspkg azure-mgmt-nspkg %BUILDING_DIR%\python.exe -m pip install --no-warn-script-location --force-reinstall urllib3==1.24.2 pushd %BUILDING_DIR% diff --git a/scripts/ci/install_azdev.sh b/scripts/ci/install_azdev.sh new file mode 100644 index 00000000000..6f597e70441 --- /dev/null +++ b/scripts/ci/install_azdev.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -e + +echo "Install azdev into virtual environment" +export CI="ADO" +pip install virtualenv +python -m virtualenv env +. env/bin/activate +pip install -U pip setuptools wheel -q +pip install -q git+https://github.com/Azure/azure-cli-dev-tools.git@pep420 +azdev setup -c diff --git a/src/azure-cli-command_modules-nspkg/HISTORY.rst b/src/azure-cli-command_modules-nspkg/HISTORY.rst deleted file mode 100644 index e7931547390..00000000000 --- a/src/azure-cli-command_modules-nspkg/HISTORY.rst +++ /dev/null @@ -1,19 +0,0 @@ -.. :changelog: - -Release History -=============== -2.0.3 -+++++ -* Indicate Python 3.7 support. - -2.0.2 -++++++ -* Minor fixes. - -2.0.1 -+++++ -* minor fixes - -2.0.0 (2017-04-28) -++++++++++++++++++ -* Initial release diff --git a/src/azure-cli-command_modules-nspkg/MANIFEST.in b/src/azure-cli-command_modules-nspkg/MANIFEST.in deleted file mode 100644 index bb37a2723da..00000000000 --- a/src/azure-cli-command_modules-nspkg/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include *.rst diff --git a/src/azure-cli-command_modules-nspkg/README.rst b/src/azure-cli-command_modules-nspkg/README.rst deleted file mode 100644 index 1ea0535b66b..00000000000 --- a/src/azure-cli-command_modules-nspkg/README.rst +++ /dev/null @@ -1,8 +0,0 @@ -Microsoft Azure CLI Command modules Namespace Package -===================================================== - -This is the Microsoft Azure CLI command module namespace package. - -This package is not intended to be installed directly by the end user. - -It provides the necessary files for other packages to extend the azure cli command module namespaces. diff --git a/src/azure-cli-command_modules-nspkg/azure/cli/command_modules/__init__.py b/src/azure-cli-command_modules-nspkg/azure/cli/command_modules/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/azure-cli-command_modules-nspkg/setup.cfg b/src/azure-cli-command_modules-nspkg/setup.cfg deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/azure-cli-command_modules-nspkg/setup.py b/src/azure-cli-command_modules-nspkg/setup.py deleted file mode 100644 index 2cfe3b6241f..00000000000 --- a/src/azure-cli-command_modules-nspkg/setup.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python - -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -from codecs import open -from setuptools import setup - -VERSION = "2.0.3" - -CLASSIFIERS = [ - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Developers', - 'Intended Audience :: System Administrators', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'License :: OSI Approved :: MIT License', -] - -with open('README.rst', 'r', encoding='utf-8') as f: - README = f.read() -with open('HISTORY.rst', 'r', encoding='utf-8') as f: - HISTORY = f.read() - -setup( - name='azure-cli-command-modules-nspkg', - version=VERSION, - description='Microsoft Azure CLI Command Modules Namespace Package', - long_description=README + '\n\n' + HISTORY, - license='MIT', - author='Microsoft Corporation', - author_email='azpycli@microsoft.com', - url='https://github.com/Azure/azure-cli', - zip_safe=False, - classifiers=CLASSIFIERS, - install_requires=[ - 'azure-cli-nspkg>=3.0.0' - ], - packages=[ - 'azure', - 'azure.cli', - 'azure.cli.command_modules' - ], -) diff --git a/src/azure-cli-core/azure/__init__.py b/src/azure-cli-core/azure/__init__.py index 73baee1e640..2ae78104e94 100644 --- a/src/azure-cli-core/azure/__init__.py +++ b/src/azure-cli-core/azure/__init__.py @@ -2,5 +2,4 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -import pkg_resources -pkg_resources.declare_namespace(__name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/src/azure-cli-core/azure/cli/__init__.py b/src/azure-cli-core/azure/cli/__init__.py index 73baee1e640..2ae78104e94 100644 --- a/src/azure-cli-core/azure/cli/__init__.py +++ b/src/azure-cli-core/azure/cli/__init__.py @@ -2,5 +2,4 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -import pkg_resources -pkg_resources.declare_namespace(__name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/src/azure-cli-core/setup.py b/src/azure-cli-core/setup.py index 2710e81f8d9..fb69f8c7658 100644 --- a/src/azure-cli-core/setup.py +++ b/src/azure-cli-core/setup.py @@ -92,8 +92,6 @@ zip_safe=False, classifiers=CLASSIFIERS, packages=[ - 'azure', - 'azure.cli', 'azure.cli.core', 'azure.cli.core.commands', 'azure.cli.core.extension', diff --git a/src/azure-cli-nspkg/HISTORY.rst b/src/azure-cli-nspkg/HISTORY.rst deleted file mode 100644 index 43af6f5726b..00000000000 --- a/src/azure-cli-nspkg/HISTORY.rst +++ /dev/null @@ -1,44 +0,0 @@ -.. :changelog: - -Release History -=============== -3.0.4 -+++++ -* Indicate Python 3.7 support. - -3.0.3 -++++++ -* Minor fixes. - -3.0.2 -+++++ -* minor fixes - -3.0.1 -+++++ -* minor fixes - -3.0.0 (2016-04-28) -++++++++++++++++++ - -* New nspkg structure. - -2.0.0 (2016-02-27) -++++++++++++++++++ - -* GA release. - -0.1.2 (2016-01-30) -++++++++++++++++++ - -* Support Python 3.6. - -0.1.1 (2016-01-17) -++++++++++++++++++ - -* Stable release (no code changes since previous version). - -0.1.0b11 (2016-12-12) -+++++++++++++++++++++ - -* Preview release. diff --git a/src/azure-cli-nspkg/MANIFEST.in b/src/azure-cli-nspkg/MANIFEST.in deleted file mode 100644 index bb37a2723da..00000000000 --- a/src/azure-cli-nspkg/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include *.rst diff --git a/src/azure-cli-nspkg/README.rst b/src/azure-cli-nspkg/README.rst deleted file mode 100644 index 7d2fd556eb1..00000000000 --- a/src/azure-cli-nspkg/README.rst +++ /dev/null @@ -1,8 +0,0 @@ -Microsoft Azure CLI Namespace Package -===================================== - -This is the Microsoft Azure CLI namespace package. - -This package is not intended to be installed directly by the end user. - -It provides the necessary files for other packages to extend the azure cli namespaces. diff --git a/src/azure-cli-nspkg/azure/cli/__init__.py b/src/azure-cli-nspkg/azure/cli/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/azure-cli-nspkg/setup.cfg b/src/azure-cli-nspkg/setup.cfg deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/azure-cli-nspkg/setup.py b/src/azure-cli-nspkg/setup.py deleted file mode 100644 index fb01c0b8d9f..00000000000 --- a/src/azure-cli-nspkg/setup.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env python - -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -from codecs import open -from setuptools import setup - -VERSION = "3.0.4" - -CLASSIFIERS = [ - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Developers', - 'Intended Audience :: System Administrators', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'License :: OSI Approved :: MIT License', -] - -with open('README.rst', 'r', encoding='utf-8') as f: - README = f.read() -with open('HISTORY.rst', 'r', encoding='utf-8') as f: - HISTORY = f.read() - -setup( - name='azure-cli-nspkg', - version=VERSION, - description='Microsoft Azure CLI Namespace Package', - long_description=README + '\n\n' + HISTORY, - license='MIT', - author='Microsoft Corporation', - author_email='azpycli@microsoft.com', - url='https://github.com/Azure/azure-cli', - zip_safe=False, - classifiers=CLASSIFIERS, - install_requires=[ - 'azure-nspkg>=2.0.0' - ], - packages=[ - 'azure', - 'azure.cli', - ], -) diff --git a/src/azure-cli-telemetry/azure/__init__.py b/src/azure-cli-telemetry/azure/__init__.py index 73baee1e640..2ae78104e94 100644 --- a/src/azure-cli-telemetry/azure/__init__.py +++ b/src/azure-cli-telemetry/azure/__init__.py @@ -2,5 +2,4 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -import pkg_resources -pkg_resources.declare_namespace(__name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/src/azure-cli-telemetry/azure/cli/__init__.py b/src/azure-cli-telemetry/azure/cli/__init__.py index bb3f1f13b5e..2ae78104e94 100644 --- a/src/azure-cli-telemetry/azure/cli/__init__.py +++ b/src/azure-cli-telemetry/azure/cli/__init__.py @@ -2,6 +2,4 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -import pkg_resources - -pkg_resources.declare_namespace(__name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/src/azure-cli-telemetry/setup.py b/src/azure-cli-telemetry/setup.py index de4aded426e..66019f6fa3f 100755 --- a/src/azure-cli-telemetry/setup.py +++ b/src/azure-cli-telemetry/setup.py @@ -51,8 +51,6 @@ 'portalocker~=1.2', ], packages=[ - 'azure', - 'azure.cli', 'azure.cli.telemetry', 'azure.cli.telemetry.components' ], diff --git a/src/azure-cli-testsdk/azure/__init__.py b/src/azure-cli-testsdk/azure/__init__.py index a9dfa5391b9..2ae78104e94 100644 --- a/src/azure-cli-testsdk/azure/__init__.py +++ b/src/azure-cli-testsdk/azure/__init__.py @@ -2,6 +2,4 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- - -import pkg_resources -pkg_resources.declare_namespace(__name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/src/azure-cli-testsdk/azure/cli/__init__.py b/src/azure-cli-testsdk/azure/cli/__init__.py index a9dfa5391b9..2ae78104e94 100644 --- a/src/azure-cli-testsdk/azure/cli/__init__.py +++ b/src/azure-cli-testsdk/azure/cli/__init__.py @@ -2,6 +2,4 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- - -import pkg_resources -pkg_resources.declare_namespace(__name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/src/azure-cli-testsdk/setup.py b/src/azure-cli-testsdk/setup.py index deefdf2bc7b..360278cb5ec 100644 --- a/src/azure-cli-testsdk/setup.py +++ b/src/azure-cli-testsdk/setup.py @@ -51,8 +51,6 @@ zip_safe=False, classifiers=CLASSIFIERS, packages=[ - 'azure', - 'azure.cli', 'azure.cli.testsdk' ], install_requires=DEPENDENCIES, diff --git a/src/azure-cli/README.rst b/src/azure-cli/README.rst index 5ef1c79fb17..526a1e3c0f1 100644 --- a/src/azure-cli/README.rst +++ b/src/azure-cli/README.rst @@ -103,3 +103,4 @@ License ======= `MIT `__ + diff --git a/src/azure-cli/azure/__init__.py b/src/azure-cli/azure/__init__.py index 73baee1e640..2ae78104e94 100644 --- a/src/azure-cli/azure/__init__.py +++ b/src/azure-cli/azure/__init__.py @@ -2,5 +2,4 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -import pkg_resources -pkg_resources.declare_namespace(__name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/src/azure-cli/azure/cli/__init__.py b/src/azure-cli/azure/cli/__init__.py index 1de18f100bb..5d23ab4a2e7 100644 --- a/src/azure-cli/azure/cli/__init__.py +++ b/src/azure-cli/azure/cli/__init__.py @@ -2,13 +2,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -'''The Azure Command-line tool. - -This tools provides a command-line interface to Azure's management and storage -APIs. -''' -import pkg_resources -pkg_resources.declare_namespace(__name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) __author__ = "Microsoft Corporation " __version__ = "2.9.1" diff --git a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_cli_version.py b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_cli_version.py index 9a4429f6bcd..e7e5f4524c0 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_cli_version.py +++ b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_cli_version.py @@ -14,9 +14,7 @@ class VersionTest(ScenarioTest): def test_version(self): output = self.cmd('az version').get_output_in_json() self.assertIn('azure-cli', output) - self.assertIn('azure-cli-command-modules-nspkg', output) self.assertIn('azure-cli-core', output) - self.assertIn('azure-cli-nspkg', output) self.assertIn('azure-cli-telemetry', output) self.assertIn('azure-cli-testsdk', output) self.assertIn('extensions', output) diff --git a/src/azure-cli/requirements.py3.Darwin.txt b/src/azure-cli/requirements.py3.Darwin.txt index e22784c6d34..f25e34e46d2 100644 --- a/src/azure-cli/requirements.py3.Darwin.txt +++ b/src/azure-cli/requirements.py3.Darwin.txt @@ -4,13 +4,18 @@ applicationinsights==0.11.9 argcomplete==1.11.1 asn1crypto==0.24.0 azure-batch==9.0.0 +<<<<<<< HEAD azure-cli==2.9.1 azure-cli-command-modules-nspkg==2.0.3 azure-cli-core==2.9.1 azure-cli-nspkg==3.0.4 +======= +azure-cli==2.9.0 +azure-cli-core==2.9.0 +>>>>>>> init pep420 change azure-cli-telemetry==1.0.4 azure-common==1.1.22 -azure-cosmos==3.1.0 +azure-cosmos==3.2.0 azure-datalake-store==0.0.48 azure-devtools==1.2.0 azure-functions-devops-build==0.0.22 @@ -59,7 +64,6 @@ azure-mgmt-monitor==0.11.0 azure-mgmt-msi==0.2.0 azure-mgmt-netapp==0.8.0 azure-mgmt-network==11.0.0 -azure-mgmt-nspkg==3.0.2 azure-mgmt-policyinsights==0.5.0 azure-mgmt-privatedns==0.1.0 azure-mgmt-rdbms==2.2.0 @@ -80,8 +84,7 @@ azure-mgmt-sqlvirtualmachine==0.5.0 azure-mgmt-storage==11.1.0 azure-mgmt-trafficmanager==0.51.0 azure-mgmt-web==0.47.0 -azure-multiapi-storage==0.3.2 -azure-nspkg==3.0.2 +azure-multiapi-storage==0.3.5 azure-loganalytics==0.1.0 azure-storage-common==1.4.2 bcrypt==3.1.7 diff --git a/src/azure-cli/requirements.py3.Linux.txt b/src/azure-cli/requirements.py3.Linux.txt index bd42cf82a4b..f81e819478e 100644 --- a/src/azure-cli/requirements.py3.Linux.txt +++ b/src/azure-cli/requirements.py3.Linux.txt @@ -4,13 +4,18 @@ applicationinsights==0.11.9 argcomplete==1.11.1 asn1crypto==0.24.0 azure-batch==9.0.0 +<<<<<<< HEAD azure-cli==2.9.1 azure-cli-command-modules-nspkg==2.0.3 azure-cli-core==2.9.1 azure-cli-nspkg==3.0.4 +======= +azure-cli==2.9.0 +azure-cli-core==2.9.0 +>>>>>>> init pep420 change azure-cli-telemetry==1.0.4 azure-common==1.1.22 -azure-cosmos==3.1.0 +azure-cosmos==3.2.0 azure-datalake-store==0.0.48 azure-devtools==1.2.0 azure-functions-devops-build==0.0.22 @@ -59,7 +64,6 @@ azure-mgmt-monitor==0.11.0 azure-mgmt-msi==0.2.0 azure-mgmt-netapp==0.8.0 azure-mgmt-network==11.0.0 -azure-mgmt-nspkg==3.0.2 azure-mgmt-policyinsights==0.5.0 azure-mgmt-privatedns==0.1.0 azure-mgmt-rdbms==2.2.0 @@ -80,8 +84,7 @@ azure-mgmt-sqlvirtualmachine==0.5.0 azure-mgmt-storage==11.1.0 azure-mgmt-trafficmanager==0.51.0 azure-mgmt-web==0.47.0 -azure-multiapi-storage==0.3.2 -azure-nspkg==3.0.2 +azure-multiapi-storage==0.3.5 azure-loganalytics==0.1.0 azure-storage-common==1.4.2 bcrypt==3.1.7 diff --git a/src/azure-cli/requirements.py3.windows.txt b/src/azure-cli/requirements.py3.windows.txt index 663da1d1473..50d3232b343 100644 --- a/src/azure-cli/requirements.py3.windows.txt +++ b/src/azure-cli/requirements.py3.windows.txt @@ -4,13 +4,18 @@ applicationinsights==0.11.7 argcomplete==1.11.1 asn1crypto==0.24.0 azure-batch==9.0.0 +<<<<<<< HEAD azure-cli==2.9.1 azure-cli-command-modules-nspkg==2.0.3 azure-cli-core==2.9.1 azure-cli-nspkg==3.0.4 +======= +azure-cli==2.9.0 +azure-cli-core==2.9.0 +>>>>>>> init pep420 change azure-cli-telemetry==1.0.4 azure-common==1.1.22 -azure-cosmos==3.1.0 +azure-cosmos==3.2.0 azure-datalake-store==0.0.48 azure-devtools==1.2.0 azure-functions-devops-build==0.0.22 @@ -59,7 +64,6 @@ azure-mgmt-monitor==0.11.0 azure-mgmt-msi==0.2.0 azure-mgmt-netapp==0.8.0 azure-mgmt-network==11.0.0 -azure-mgmt-nspkg==3.0.2 azure-mgmt-policyinsights==0.5.0 azure-mgmt-privatedns==0.1.0 azure-mgmt-rdbms==2.2.0 @@ -80,8 +84,7 @@ azure-mgmt-sqlvirtualmachine==0.5.0 azure-mgmt-storage==11.1.0 azure-mgmt-trafficmanager==0.51.0 azure-mgmt-web==0.47.0 -azure-multiapi-storage==0.3.2 -azure-nspkg==3.0.2 +azure-multiapi-storage==0.3.5 azure-loganalytics==0.1.0 azure-storage-common==1.4.2 bcrypt==3.1.7 diff --git a/src/azure-cli/setup.py b/src/azure-cli/setup.py index c027bbd7460..f7eddce235a 100644 --- a/src/azure-cli/setup.py +++ b/src/azure-cli/setup.py @@ -52,9 +52,7 @@ DEPENDENCIES = [ 'antlr4-python3-runtime~=4.7.2', 'azure-batch~=9.0', - 'azure-cli-command_modules-nspkg~=2.0', 'azure-cli-core=={}.*'.format(VERSION), - 'azure-cli-nspkg~=3.0,>=3.0.3', 'azure-cosmos~=3.0,>=3.0.2', 'azure-datalake-store~=0.0.48', 'azure-functions-devops-build~=0.0.22', @@ -122,7 +120,7 @@ 'azure-mgmt-storage~=11.1.0', 'azure-mgmt-trafficmanager~=0.51.0', 'azure-mgmt-web~=0.47.0', - 'azure-multiapi-storage~=0.3.2', + 'azure-multiapi-storage~=0.3.5', 'azure-loganalytics~=0.1.0', 'azure-storage-common~=1.4', 'cryptography>=2.3.1,<3.0.0', @@ -164,7 +162,7 @@ 'az.completion.sh', 'az.bat', ], - packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]), + packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests", "azure"]), install_requires=DEPENDENCIES, package_data={ 'azure.cli.core': ['auth_landing_pages/*.html'], From 1dc87c1f9b9650e78711b18a9c97ecd8425ef9cc Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Mon, 13 Jul 2020 14:07:21 +0800 Subject: [PATCH 22/70] fix linter error --- src/azure-cli/README.rst | 1 - .../cli/command_modules/eventgrid/linter_exclusions.yml | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 src/azure-cli/azure/cli/command_modules/eventgrid/linter_exclusions.yml diff --git a/src/azure-cli/README.rst b/src/azure-cli/README.rst index 526a1e3c0f1..5ef1c79fb17 100644 --- a/src/azure-cli/README.rst +++ b/src/azure-cli/README.rst @@ -103,4 +103,3 @@ License ======= `MIT `__ - diff --git a/src/azure-cli/azure/cli/command_modules/eventgrid/linter_exclusions.yml b/src/azure-cli/azure/cli/command_modules/eventgrid/linter_exclusions.yml new file mode 100644 index 00000000000..9a29699c78d --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/eventgrid/linter_exclusions.yml @@ -0,0 +1,7 @@ +--- +eventgrid partner topic event-subscription update: + parameters: + endpoint_type: + rule_exclusions: + - no_parameter_defaults_for_update_commands +... \ No newline at end of file From 6a061217503e22df2ee9dc468b3f2e4bad4c50b3 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Mon, 13 Jul 2020 14:48:59 +0800 Subject: [PATCH 23/70] fix another linter error --- src/azure-cli/azure/cli/__init__.py | 2 -- .../cli/command_modules/eventgrid/linter_exclusions.yml | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/azure-cli/azure/cli/__init__.py b/src/azure-cli/azure/cli/__init__.py index 5d23ab4a2e7..fcadd389abf 100644 --- a/src/azure-cli/azure/cli/__init__.py +++ b/src/azure-cli/azure/cli/__init__.py @@ -2,7 +2,5 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -__path__ = __import__("pkgutil").extend_path(__path__, __name__) - __author__ = "Microsoft Corporation " __version__ = "2.9.1" diff --git a/src/azure-cli/azure/cli/command_modules/eventgrid/linter_exclusions.yml b/src/azure-cli/azure/cli/command_modules/eventgrid/linter_exclusions.yml index 9a29699c78d..61ede431b8a 100644 --- a/src/azure-cli/azure/cli/command_modules/eventgrid/linter_exclusions.yml +++ b/src/azure-cli/azure/cli/command_modules/eventgrid/linter_exclusions.yml @@ -4,4 +4,9 @@ eventgrid partner topic event-subscription update: endpoint_type: rule_exclusions: - no_parameter_defaults_for_update_commands +eventgrid system-topic event-subscription update: + parameters: + endpoint_type: + rule_exclusions: + - no_parameter_defaults_for_update_commands ... \ No newline at end of file From a16c1551d532282845bd064932e89927db1f4df7 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Wed, 15 Jul 2020 15:56:48 +0800 Subject: [PATCH 24/70] elegant way to handle __main__.py --- .vscode/launch.json | 6 ++--- Dockerfile.spot | 6 ++--- scripts/ci/version.sh | 8 +++++++ scripts/curl_install_pypi/install.py | 4 ---- scripts/dev_setup.py | 6 ----- scripts/release/debian/pipeline.sh | 2 +- scripts/release/docker/pipeline.sh | 2 +- scripts/release/get_version.sh | 4 ++-- scripts/release/rpm/pipeline.sh | 2 +- src/azure-cli-core/azure_bdist_wheel.py | 23 +++++++------------- src/azure-cli-telemetry/azure_bdist_wheel.py | 23 +++++++------------- src/azure-cli-testsdk/azure_bdist_wheel.py | 23 +++++++------------- src/azure-cli/azure/cli/__init__.py | 4 ++++ src/azure-cli/azure/cli/__main__.py | 9 ++++++++ src/azure-cli/azure_bdist_wheel.py | 23 +++++++------------- src/azure-cli/setup.py | 5 ++--- 16 files changed, 65 insertions(+), 85 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index a3bb8f78c2a..1187e215bf1 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,7 +5,7 @@ "name": "Azure CLI Debug (Integrated Console)", "type": "python", "request": "launch", - "pythonPath": "${config:python.pythonPath}", + "pythonPath": "${command:python.interpreterPath}", "program": "${workspaceRoot}/src/azure-cli/azure/cli/__main__.py", "cwd": "${workspaceRoot}", "args": [ @@ -24,7 +24,7 @@ "type": "python", "request": "launch", "stopOnEntry": true, - "pythonPath": "${config:python.pythonPath}", + "pythonPath": "${command:python.interpreterPath}", "program": "${workspaceRoot}/src/azure-cli/azure/cli/__main__.py", "cwd": "${workspaceRoot}", "args": [ @@ -40,7 +40,7 @@ "name": "Azdev Scripts", "type": "python", "request": "launch", - "pythonPath": "${config:python.pythonPath}", + "pythonPath": "${command:python.interpreterPath}", "program": "${workspaceRoot}/tools/automation/__main__.py", "cwd": "${workspaceRoot}", "args": [ diff --git a/Dockerfile.spot b/Dockerfile.spot index fb2b3e3738b..91937df010c 100644 --- a/Dockerfile.spot +++ b/Dockerfile.spot @@ -33,15 +33,13 @@ COPY . /azure-cli # jmespath-terminal - we include jpterm as a useful tool # 1. Build packages and store in tmp dir # 2. Install the cli and the other command modules that weren't included -# 3. Temporary fix - install azure-nspkg to remove import of pkg_resources in azure/__init__.py (to improve performance) RUN /bin/bash -c 'TMP_PKG_DIR=$(mktemp -d); \ - for d in src/azure-cli src/azure-cli-core src/azure-cli-nspkg src/azure-cli-command_modules-nspkg src/command_modules/azure-cli-*/; \ + for d in src/azure-cli src/azure-cli-core src/command_modules/azure-cli-*/; \ do cd $d; echo $d; python setup.py bdist_wheel -d $TMP_PKG_DIR; cd -; \ done; \ [ -d privates ] && cp privates/*.whl $TMP_PKG_DIR; \ all_modules=`find $TMP_PKG_DIR -name "*.whl"`; \ - pip install --no-cache-dir $all_modules; \ - pip install --no-cache-dir --force-reinstall --upgrade azure-nspkg azure-mgmt-nspkg;' \ + pip install --no-cache-dir $all_modules;' \ && cat /azure-cli/az.completion > ~/.bashrc WORKDIR / diff --git a/scripts/ci/version.sh b/scripts/ci/version.sh index 8d1c3a619e6..9b3d2acf4b9 100755 --- a/scripts/ci/version.sh +++ b/scripts/ci/version.sh @@ -20,6 +20,14 @@ echo "Replace with version: $version" platform=`uname` +for each in $(find src -name __main__.py); do + if [ "$platform" == "Darwin" ]; then + sed -i "" "s/^__version__ = [\"']\(.*\)[\"']/__version__ = \"\1.dev$version\"/" $each + else + sed -i "s/^__version__ = [\"']\(.*\)[\"']/__version__ = \"\1.dev$version\"/" $each + fi +done + for each in $(find src -name __init__.py); do if [ "$platform" == "Darwin" ]; then sed -i "" "s/^__version__ = [\"']\(.*\)[\"']/__version__ = \"\1.dev$version\"/" $each diff --git a/scripts/curl_install_pypi/install.py b/scripts/curl_install_pypi/install.py index 975091f8253..29b4b4c5c4b 100644 --- a/scripts/curl_install_pypi/install.py +++ b/scripts/curl_install_pypi/install.py @@ -149,10 +149,6 @@ def install_cli(install_dir, tmp_dir): path_to_pip = os.path.join(install_dir, 'bin', 'pip') cmd = [path_to_pip, 'install', '--cache-dir', tmp_dir, 'azure-cli', '--upgrade'] exec_command(cmd) - # Temporary fix to make sure that we have empty __init__.py files for the azure site-packages folder. - # (including the pkg_resources/declare namespace significantly impacts startup perf for the CLI) - fixupcmd = [path_to_pip, 'install', '--cache-dir', tmp_dir, '--upgrade', '--force-reinstall', 'azure-nspkg', 'azure-mgmt-nspkg'] - exec_command(fixupcmd) def create_executable(exec_dir, install_dir): diff --git a/scripts/dev_setup.py b/scripts/dev_setup.py index 5557f7d09d1..03032645ed3 100755 --- a/scripts/dev_setup.py +++ b/scripts/dev_setup.py @@ -66,7 +66,6 @@ def pip_command(command): pip_command('install -e ./tools') # command modules have dependency on azure-cli-core so install this first -pip_command('install -e src/azure-cli-nspkg') pip_command('install -e src/azure-cli-telemetry') pip_command('install -e src/azure-cli-core') py_command('-m automation.setup.install_modules') @@ -75,11 +74,6 @@ def pip_command(command): pip_command('install -e src/azure-cli') pip_command('install -e src/azure-cli-testsdk') -# Ensure that the site package's azure/__init__.py has the old style namespace -# package declaration by installing the old namespace package -pip_command('install --force-reinstall azure-nspkg==1.0.0') -pip_command('install --force-reinstall azure-mgmt-nspkg==1.0.0') - print_support_message() print('Finished dev setup.') diff --git a/scripts/release/debian/pipeline.sh b/scripts/release/debian/pipeline.sh index 83ba0c81eae..bd9d7bdeebc 100755 --- a/scripts/release/debian/pipeline.sh +++ b/scripts/release/debian/pipeline.sh @@ -8,7 +8,7 @@ set -exv : ${DISTRO:?"DISTRO is not set"} : ${DISTRO_BASE_IMAGE:?"DISTRO_BASE_IMAGE is not set"} -CLI_VERSION=`cat src/azure-cli/azure/cli/__init__.py | grep __version__ | sed s/' '//g | sed s/'__version__='// | sed s/\"//g` +CLI_VERSION=`cat src/azure-cli/azure/cli/__main__.py | grep __version__ | sed s/' '//g | sed s/'__version__='// | sed s/\"//g` docker run --rm \ -v "$BUILD_SOURCESDIRECTORY":/mnt/repo \ diff --git a/scripts/release/docker/pipeline.sh b/scripts/release/docker/pipeline.sh index 2f5a5cb4630..01b727a80ef 100755 --- a/scripts/release/docker/pipeline.sh +++ b/scripts/release/docker/pipeline.sh @@ -1,5 +1,5 @@ IMAGE_NAME=clibuild$BUILD_BUILDNUMBER -CLI_VERSION=`cat src/azure-cli/azure/cli/__init__.py | grep __version__ | sed s/' '//g | sed s/'__version__='// | sed s/\"//g` +CLI_VERSION=`cat src/azure-cli/azure/cli/__main__.py | grep __version__ | sed s/' '//g | sed s/'__version__='// | sed s/\"//g` docker build --no-cache \ --build-arg BUILD_DATE="`date -u +"%Y-%m-%dT%H:%M:%SZ"`" \ diff --git a/scripts/release/get_version.sh b/scripts/release/get_version.sh index 6b9d65b11b0..a3093b6927d 100755 --- a/scripts/release/get_version.sh +++ b/scripts/release/get_version.sh @@ -1,7 +1,7 @@ -# Extract the version of the CLI from azure-cli package's __init__.py file. +# Extract the version of the CLI from azure-cli package's __main__.py file. : "${BUILD_STAGINGDIRECTORY:?BUILD_STAGINGDIRECTORY environment variable not set}" -ver=`cat src/azure-cli/azure/cli/__init__.py | grep __version__ | sed s/' '//g | sed s/'__version__='// | sed s/\"//g` +ver=`cat src/azure-cli/azure/cli/__main__.py | grep __version__ | sed s/' '//g | sed s/'__version__='// | sed s/\"//g` echo $ver > $BUILD_STAGINGDIRECTORY/version echo $ver > $BUILD_STAGINGDIRECTORY/azure-cli-${ver}.txt \ No newline at end of file diff --git a/scripts/release/rpm/pipeline.sh b/scripts/release/rpm/pipeline.sh index 36d44b06d5c..df6958a1c8d 100755 --- a/scripts/release/rpm/pipeline.sh +++ b/scripts/release/rpm/pipeline.sh @@ -6,7 +6,7 @@ set -exv : "${BUILD_STAGINGDIRECTORY:?BUILD_STAGINGDIRECTORY environment variable not set.}" -CLI_VERSION=`cat src/azure-cli/azure/cli/__init__.py | grep __version__ | sed s/' '//g | sed s/'__version__='// | sed s/\"//g` +CLI_VERSION=`cat src/azure-cli/azure/cli/__main__.py | grep __version__ | sed s/' '//g | sed s/'__version__='// | sed s/\"//g` # Create a container image that includes the source code and a built RPM using this file. docker build \ diff --git a/src/azure-cli-core/azure_bdist_wheel.py b/src/azure-cli-core/azure_bdist_wheel.py index 8a81d1b6177..c8083d8896b 100644 --- a/src/azure-cli-core/azure_bdist_wheel.py +++ b/src/azure-cli-core/azure_bdist_wheel.py @@ -29,25 +29,18 @@ def 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)) + 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: + logger.info("skip {} as it is not include in the build target".format(init_file)) bdist_wheel.write_record(self, bdist_dir, distinfo_dir) cmdclass = { 'bdist_wheel': azure_bdist_wheel, diff --git a/src/azure-cli-telemetry/azure_bdist_wheel.py b/src/azure-cli-telemetry/azure_bdist_wheel.py index 8a81d1b6177..c8083d8896b 100644 --- a/src/azure-cli-telemetry/azure_bdist_wheel.py +++ b/src/azure-cli-telemetry/azure_bdist_wheel.py @@ -29,25 +29,18 @@ def 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)) + 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: + logger.info("skip {} as it is not include in the build target".format(init_file)) bdist_wheel.write_record(self, bdist_dir, distinfo_dir) cmdclass = { 'bdist_wheel': azure_bdist_wheel, diff --git a/src/azure-cli-testsdk/azure_bdist_wheel.py b/src/azure-cli-testsdk/azure_bdist_wheel.py index 8a81d1b6177..c8083d8896b 100644 --- a/src/azure-cli-testsdk/azure_bdist_wheel.py +++ b/src/azure-cli-testsdk/azure_bdist_wheel.py @@ -29,25 +29,18 @@ def 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)) + 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: + logger.info("skip {} as it is not include in the build target".format(init_file)) bdist_wheel.write_record(self, bdist_dir, distinfo_dir) cmdclass = { 'bdist_wheel': azure_bdist_wheel, diff --git a/src/azure-cli/azure/cli/__init__.py b/src/azure-cli/azure/cli/__init__.py index fcadd389abf..402ff3d1932 100644 --- a/src/azure-cli/azure/cli/__init__.py +++ b/src/azure-cli/azure/cli/__init__.py @@ -2,5 +2,9 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- +<<<<<<< HEAD __author__ = "Microsoft Corporation " __version__ = "2.9.1" +======= +__path__ = __import__("pkgutil").extend_path(__path__, __name__) +>>>>>>> elegant way to handle __main__.py diff --git a/src/azure-cli/azure/cli/__main__.py b/src/azure-cli/azure/cli/__main__.py index 06eef18cc6f..7bb970e9a20 100644 --- a/src/azure-cli/azure/cli/__main__.py +++ b/src/azure-cli/azure/cli/__main__.py @@ -16,6 +16,15 @@ from knack.completion import ARGCOMPLETE_ENV_NAME from knack.log import get_logger +<<<<<<< HEAD +======= +__author__ = "Microsoft Corporation " +__version__ = "2.9.0" + +# Log the start time +# TODO: Disable E402 "Module level import not at top of file" so that imports can also be timed +start_time = timeit.default_timer() +>>>>>>> elegant way to handle __main__.py # A workaround for https://bugs.python.org/issue32502 (https://github.com/Azure/azure-cli/issues/5184) # If uuid1 raises ValueError, use uuid4 instead. diff --git a/src/azure-cli/azure_bdist_wheel.py b/src/azure-cli/azure_bdist_wheel.py index 8a81d1b6177..c8083d8896b 100644 --- a/src/azure-cli/azure_bdist_wheel.py +++ b/src/azure-cli/azure_bdist_wheel.py @@ -29,25 +29,18 @@ def 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)) + 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: + logger.info("skip {} as it is not include in the build target".format(init_file)) bdist_wheel.write_record(self, bdist_dir, distinfo_dir) cmdclass = { 'bdist_wheel': azure_bdist_wheel, diff --git a/src/azure-cli/setup.py b/src/azure-cli/setup.py index f7eddce235a..800339001f0 100644 --- a/src/azure-cli/setup.py +++ b/src/azure-cli/setup.py @@ -22,7 +22,7 @@ # If we have source, validate that our version numbers match # This should prevent uploading releases with mismatched versions. try: - with open('azure/cli/__init__.py', 'r', encoding='utf-8') as f: + with open('azure/cli/__main__.py', 'r', encoding='utf-8') as f: content = f.read() except OSError: pass @@ -31,7 +31,7 @@ m = re.search(r'__version__\s*=\s*[\'"](.+?)[\'"]', content) if not m: - print('Could not find __version__ in azure/cli/__init__.py') + print('Could not find __version__ in azure/cli/__main__.py') sys.exit(1) if m.group(1) != VERSION: print('Expected __version__ = "{}"; found "{}"'.format(VERSION, m.group(1))) @@ -165,7 +165,6 @@ packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests", "azure"]), install_requires=DEPENDENCIES, package_data={ - 'azure.cli.core': ['auth_landing_pages/*.html'], 'azure.cli.command_modules.acr': ['*.json'], 'azure.cli.command_modules.botservice': ['*.json', '*.config'], 'azure.cli.command_modules.monitor.operations': ['autoscale-parameters-template.json'], From a61214ffc2e213efe1b982867162f20808841b30 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Wed, 15 Jul 2020 17:27:12 +0800 Subject: [PATCH 25/70] remove nspkg --- .snapcraft.yaml | 2 +- Dockerfile | 1 - Dockerfile.nanoserver | 1 - azure-cli.pyproj | 16 ---------------- azure-cli2017.pyproj | 17 ----------------- doc/authoring_command_modules/README.md | 4 ---- scripts/release/debian/Dockerfile | 1 - .../homebrew/docker/formula_template.txt | 2 -- tools/automation/style/__init__.py | 2 +- 9 files changed, 2 insertions(+), 44 deletions(-) diff --git a/.snapcraft.yaml b/.snapcraft.yaml index a48d019ec71..29390985351 100644 --- a/.snapcraft.yaml +++ b/.snapcraft.yaml @@ -28,7 +28,7 @@ parts: - libssl1.0.0 requirements: requirements.txt install: | - python_packages="src/azure-cli-core src/azure-cli-nspkg src/azure-cli-command_modules-nspkg src/command_modules/azure-cli*" + python_packages="src/azure-cli-core src/command_modules/azure-cli*" export PYTHONUSERBASE=$SNAPCRAFT_PART_INSTALL export PYTHONHOME=$SNAPCRAFT_PART_INSTALL/usr echo $SNAPCRAFT_PART_INSTALL/usr/bin/python3 diff --git a/Dockerfile b/Dockerfile index 60dc84bb84a..ecc5a489e39 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,7 +50,6 @@ COPY . /azure-cli # 1. Build packages and store in tmp dir # 2. Install the cli and the other command modules that weren't included -# 3. Temporary fix - install azure-nspkg to remove import of pkg_resources in azure/__init__.py (to improve performance) RUN ./scripts/install_full.sh \ && cat /azure-cli/az.completion > ~/.bashrc \ && runDeps="$( \ diff --git a/Dockerfile.nanoserver b/Dockerfile.nanoserver index f6e9bb7597d..442ac8ed942 100644 --- a/Dockerfile.nanoserver +++ b/Dockerfile.nanoserver @@ -78,7 +78,6 @@ foreach($m in $modules) \ { \ & pip install --no-cache-dir $m; \ }\ -& pip install --no-cache-dir --force-reinstall --upgrade azure-nspkg azure-mgmt-nspkg; \ Pop-Location; \ Write-Host 'Done'; diff --git a/azure-cli.pyproj b/azure-cli.pyproj index d32a0c24106..cf4117aca47 100644 --- a/azure-cli.pyproj +++ b/azure-cli.pyproj @@ -23,8 +23,6 @@ 10.0 - - @@ -78,8 +76,6 @@ - - @@ -785,10 +781,6 @@ - - - - @@ -797,9 +789,6 @@ - - - @@ -1130,13 +1119,8 @@ - - - - - diff --git a/azure-cli2017.pyproj b/azure-cli2017.pyproj index 7965aa145c8..4ee36c90454 100644 --- a/azure-cli2017.pyproj +++ b/azure-cli2017.pyproj @@ -23,8 +23,6 @@ 10.0 - - @@ -90,8 +88,6 @@ - - @@ -966,10 +962,6 @@ - - - - @@ -983,9 +975,6 @@ - - - @@ -1199,10 +1188,6 @@ - - - - @@ -1216,8 +1201,6 @@ - - diff --git a/doc/authoring_command_modules/README.md b/doc/authoring_command_modules/README.md index 8db4514a55e..f5250e0699e 100644 --- a/doc/authoring_command_modules/README.md +++ b/doc/authoring_command_modules/README.md @@ -55,10 +55,6 @@ Also, you can run `az` and if your command module contributes any commands, they If your commands aren't showing with `az`, use `az --debug` to help debug. There could have been an exception thrown whilst attempting to load your module. -**Note for locally installed Azure SDKs:** -If you're receiving Azure import errors, run `pip install -I azure-nspkg==1.0.0` in your virtual environment -after installing your SDK locally. - Authoring command modules ------ diff --git a/scripts/release/debian/Dockerfile b/scripts/release/debian/Dockerfile index a45c419a20b..bc408223447 100644 --- a/scripts/release/debian/Dockerfile +++ b/scripts/release/debian/Dockerfile @@ -29,7 +29,6 @@ RUN mkdir -p ./bin/pypi && \ BUILD_STAGINGDIRECTORY=/azure-cli/bin/pypi ./scripts/release/pypi/build.sh && \ if [ -d ./privates ]; then find ./privates -name '*.whl' | xargs pip install; fi && \ find ./bin/pypi -name '*.whl' | xargs pip install && \ - pip install --force-reinstall --upgrade azure-nspkg azure-mgmt-nspkg && \ pip install --force-reinstall urllib3==1.24.2 ARG cli_version=0.0.0-dev diff --git a/scripts/release/homebrew/docker/formula_template.txt b/scripts/release/homebrew/docker/formula_template.txt index b8f254e211a..519e6b278bc 100644 --- a/scripts/release/homebrew/docker/formula_template.txt +++ b/scripts/release/homebrew/docker/formula_template.txt @@ -28,8 +28,6 @@ class AzureCli < Formula buildpath/"src/azure-cli", buildpath/"src/azure-cli-telemetry", buildpath/"src/azure-cli-core", - buildpath/"src/azure-cli-nspkg", - buildpath/"src/azure-cli-command_modules-nspkg", ] # Install CLI diff --git a/tools/automation/style/__init__.py b/tools/automation/style/__init__.py index 52932960dce..0b1e99788c6 100644 --- a/tools/automation/style/__init__.py +++ b/tools/automation/style/__init__.py @@ -59,7 +59,7 @@ def define_arguments(parser): help='Run pylint') parser.add_argument('--module', dest='modules', action='append', help='The modules on which the style check should run. Accept short names, ' - 'except azure-cli, azure-cli-core and azure-cli-nspkg') + 'except azure-cli and azure-cli-core') def main_style(args): From e5704c9ebc86b809374c4c9ac36f265d345096c4 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Thu, 16 Jul 2020 16:49:37 +0800 Subject: [PATCH 26/70] refactor azure_bdist_wheel to fit wheel 0.34.2 --- src/azure-cli-core/azure_bdist_wheel.py | 13 +++++++++---- src/azure-cli-telemetry/azure_bdist_wheel.py | 13 +++++++++---- src/azure-cli-testsdk/azure_bdist_wheel.py | 13 +++++++++---- src/azure-cli/azure_bdist_wheel.py | 13 +++++++++---- 4 files changed, 36 insertions(+), 16 deletions(-) diff --git a/src/azure-cli-core/azure_bdist_wheel.py b/src/azure-cli-core/azure_bdist_wheel.py index c8083d8896b..753ae493176 100644 --- a/src/azure-cli-core/azure_bdist_wheel.py +++ b/src/azure-cli-core/azure_bdist_wheel.py @@ -29,19 +29,24 @@ def 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 write_record(self, bdist_dir, distinfo_dir): + def write_wheelfile(self, wheelfile_base, generator=None): 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))] + folder_with_init = [os.path.join(*subparts[0:i + 1]) for i in range(len(subparts))] for azure_sub_package in folder_with_init: + bdist_dir = os.path.dirname(wheelfile_base) 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: logger.info("skip {} as it is not include in the build target".format(init_file)) - bdist_wheel.write_record(self, bdist_dir, distinfo_dir) + + if generator is None: + bdist_wheel.write_wheelfile(self, wheelfile_base) + else: + bdist_wheel.write_wheelfile(self, wheelfile_base, generator) + cmdclass = { 'bdist_wheel': azure_bdist_wheel, } diff --git a/src/azure-cli-telemetry/azure_bdist_wheel.py b/src/azure-cli-telemetry/azure_bdist_wheel.py index c8083d8896b..753ae493176 100644 --- a/src/azure-cli-telemetry/azure_bdist_wheel.py +++ b/src/azure-cli-telemetry/azure_bdist_wheel.py @@ -29,19 +29,24 @@ def 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 write_record(self, bdist_dir, distinfo_dir): + def write_wheelfile(self, wheelfile_base, generator=None): 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))] + folder_with_init = [os.path.join(*subparts[0:i + 1]) for i in range(len(subparts))] for azure_sub_package in folder_with_init: + bdist_dir = os.path.dirname(wheelfile_base) 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: logger.info("skip {} as it is not include in the build target".format(init_file)) - bdist_wheel.write_record(self, bdist_dir, distinfo_dir) + + if generator is None: + bdist_wheel.write_wheelfile(self, wheelfile_base) + else: + bdist_wheel.write_wheelfile(self, wheelfile_base, generator) + cmdclass = { 'bdist_wheel': azure_bdist_wheel, } diff --git a/src/azure-cli-testsdk/azure_bdist_wheel.py b/src/azure-cli-testsdk/azure_bdist_wheel.py index c8083d8896b..753ae493176 100644 --- a/src/azure-cli-testsdk/azure_bdist_wheel.py +++ b/src/azure-cli-testsdk/azure_bdist_wheel.py @@ -29,19 +29,24 @@ def 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 write_record(self, bdist_dir, distinfo_dir): + def write_wheelfile(self, wheelfile_base, generator=None): 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))] + folder_with_init = [os.path.join(*subparts[0:i + 1]) for i in range(len(subparts))] for azure_sub_package in folder_with_init: + bdist_dir = os.path.dirname(wheelfile_base) 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: logger.info("skip {} as it is not include in the build target".format(init_file)) - bdist_wheel.write_record(self, bdist_dir, distinfo_dir) + + if generator is None: + bdist_wheel.write_wheelfile(self, wheelfile_base) + else: + bdist_wheel.write_wheelfile(self, wheelfile_base, generator) + cmdclass = { 'bdist_wheel': azure_bdist_wheel, } diff --git a/src/azure-cli/azure_bdist_wheel.py b/src/azure-cli/azure_bdist_wheel.py index c8083d8896b..753ae493176 100644 --- a/src/azure-cli/azure_bdist_wheel.py +++ b/src/azure-cli/azure_bdist_wheel.py @@ -29,19 +29,24 @@ def 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 write_record(self, bdist_dir, distinfo_dir): + def write_wheelfile(self, wheelfile_base, generator=None): 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))] + folder_with_init = [os.path.join(*subparts[0:i + 1]) for i in range(len(subparts))] for azure_sub_package in folder_with_init: + bdist_dir = os.path.dirname(wheelfile_base) 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: logger.info("skip {} as it is not include in the build target".format(init_file)) - bdist_wheel.write_record(self, bdist_dir, distinfo_dir) + + if generator is None: + bdist_wheel.write_wheelfile(self, wheelfile_base) + else: + bdist_wheel.write_wheelfile(self, wheelfile_base, generator) + cmdclass = { 'bdist_wheel': azure_bdist_wheel, } From 0a0edab2b135a0c6047890915fac638abbe0004b Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Thu, 16 Jul 2020 17:28:50 +0800 Subject: [PATCH 27/70] add namespace package __init__.py to sdist --- src/azure-cli-core/MANIFEST.in | 4 +++- src/azure-cli-telemetry/MANIFEST.in | 4 +++- src/azure-cli-testsdk/MANIFEST.in | 4 +++- src/azure-cli/MANIFEST.in | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/azure-cli-core/MANIFEST.in b/src/azure-cli-core/MANIFEST.in index 9ecaeb15de5..9c3f67387c5 100644 --- a/src/azure-cli-core/MANIFEST.in +++ b/src/azure-cli-core/MANIFEST.in @@ -1,2 +1,4 @@ include *.rst -include azure_bdist_wheel.py \ No newline at end of file +include azure_bdist_wheel.py +include azure/__init__.py +include azure/cli/__init__.py \ No newline at end of file diff --git a/src/azure-cli-telemetry/MANIFEST.in b/src/azure-cli-telemetry/MANIFEST.in index 9ecaeb15de5..9c3f67387c5 100644 --- a/src/azure-cli-telemetry/MANIFEST.in +++ b/src/azure-cli-telemetry/MANIFEST.in @@ -1,2 +1,4 @@ include *.rst -include azure_bdist_wheel.py \ No newline at end of file +include azure_bdist_wheel.py +include azure/__init__.py +include azure/cli/__init__.py \ No newline at end of file diff --git a/src/azure-cli-testsdk/MANIFEST.in b/src/azure-cli-testsdk/MANIFEST.in index 9ecaeb15de5..9c3f67387c5 100644 --- a/src/azure-cli-testsdk/MANIFEST.in +++ b/src/azure-cli-testsdk/MANIFEST.in @@ -1,2 +1,4 @@ include *.rst -include azure_bdist_wheel.py \ No newline at end of file +include azure_bdist_wheel.py +include azure/__init__.py +include azure/cli/__init__.py \ No newline at end of file diff --git a/src/azure-cli/MANIFEST.in b/src/azure-cli/MANIFEST.in index 53b2eb48bf9..d54ffe8eb4f 100644 --- a/src/azure-cli/MANIFEST.in +++ b/src/azure-cli/MANIFEST.in @@ -1,4 +1,6 @@ include LICENSE.txt include HISTORY.rst include README.rst -include azure_bdist_wheel.py \ No newline at end of file +include azure_bdist_wheel.py +include azure/__init__.py +include azure/cli/__init__.py \ No newline at end of file From 99cb087a26adc59ada06d7d79cd2125ed17dec79 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Thu, 16 Jul 2020 17:34:24 +0800 Subject: [PATCH 28/70] fix merge conflict --- src/azure-cli/azure/cli/__init__.py | 5 ----- src/azure-cli/azure/cli/__main__.py | 2 +- src/azure-cli/requirements.py3.Darwin.txt | 7 ------- src/azure-cli/requirements.py3.Linux.txt | 7 ------- src/azure-cli/requirements.py3.windows.txt | 7 ------- 5 files changed, 1 insertion(+), 27 deletions(-) diff --git a/src/azure-cli/azure/cli/__init__.py b/src/azure-cli/azure/cli/__init__.py index 402ff3d1932..2ae78104e94 100644 --- a/src/azure-cli/azure/cli/__init__.py +++ b/src/azure-cli/azure/cli/__init__.py @@ -2,9 +2,4 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -<<<<<<< HEAD -__author__ = "Microsoft Corporation " -__version__ = "2.9.1" -======= __path__ = __import__("pkgutil").extend_path(__path__, __name__) ->>>>>>> elegant way to handle __main__.py diff --git a/src/azure-cli/azure/cli/__main__.py b/src/azure-cli/azure/cli/__main__.py index 7bb970e9a20..1828f2c2db2 100644 --- a/src/azure-cli/azure/cli/__main__.py +++ b/src/azure-cli/azure/cli/__main__.py @@ -19,7 +19,7 @@ <<<<<<< HEAD ======= __author__ = "Microsoft Corporation " -__version__ = "2.9.0" +__version__ = "2.9.1" # Log the start time # TODO: Disable E402 "Module level import not at top of file" so that imports can also be timed diff --git a/src/azure-cli/requirements.py3.Darwin.txt b/src/azure-cli/requirements.py3.Darwin.txt index f25e34e46d2..d0d1a6abc58 100644 --- a/src/azure-cli/requirements.py3.Darwin.txt +++ b/src/azure-cli/requirements.py3.Darwin.txt @@ -4,15 +4,8 @@ applicationinsights==0.11.9 argcomplete==1.11.1 asn1crypto==0.24.0 azure-batch==9.0.0 -<<<<<<< HEAD azure-cli==2.9.1 -azure-cli-command-modules-nspkg==2.0.3 azure-cli-core==2.9.1 -azure-cli-nspkg==3.0.4 -======= -azure-cli==2.9.0 -azure-cli-core==2.9.0 ->>>>>>> init pep420 change azure-cli-telemetry==1.0.4 azure-common==1.1.22 azure-cosmos==3.2.0 diff --git a/src/azure-cli/requirements.py3.Linux.txt b/src/azure-cli/requirements.py3.Linux.txt index f81e819478e..a04adef9005 100644 --- a/src/azure-cli/requirements.py3.Linux.txt +++ b/src/azure-cli/requirements.py3.Linux.txt @@ -4,15 +4,8 @@ applicationinsights==0.11.9 argcomplete==1.11.1 asn1crypto==0.24.0 azure-batch==9.0.0 -<<<<<<< HEAD azure-cli==2.9.1 -azure-cli-command-modules-nspkg==2.0.3 azure-cli-core==2.9.1 -azure-cli-nspkg==3.0.4 -======= -azure-cli==2.9.0 -azure-cli-core==2.9.0 ->>>>>>> init pep420 change azure-cli-telemetry==1.0.4 azure-common==1.1.22 azure-cosmos==3.2.0 diff --git a/src/azure-cli/requirements.py3.windows.txt b/src/azure-cli/requirements.py3.windows.txt index 50d3232b343..37b9b1256a9 100644 --- a/src/azure-cli/requirements.py3.windows.txt +++ b/src/azure-cli/requirements.py3.windows.txt @@ -4,15 +4,8 @@ applicationinsights==0.11.7 argcomplete==1.11.1 asn1crypto==0.24.0 azure-batch==9.0.0 -<<<<<<< HEAD azure-cli==2.9.1 -azure-cli-command-modules-nspkg==2.0.3 azure-cli-core==2.9.1 -azure-cli-nspkg==3.0.4 -======= -azure-cli==2.9.0 -azure-cli-core==2.9.0 ->>>>>>> init pep420 change azure-cli-telemetry==1.0.4 azure-common==1.1.22 azure-cosmos==3.2.0 From d446a6370d099e09d88a044d07cbd32e785cd55e Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Mon, 20 Jul 2020 14:34:35 +0800 Subject: [PATCH 29/70] fix generic update problem --- .azure-pipelines/templates/automation_test.yml | 15 +++++++++++++++ .../azure/cli/core/tests/test_generic_update.py | 8 ++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.azure-pipelines/templates/automation_test.yml b/.azure-pipelines/templates/automation_test.yml index 76b8891b35c..482f1930844 100644 --- a/.azure-pipelines/templates/automation_test.yml +++ b/.azure-pipelines/templates/automation_test.yml @@ -7,7 +7,22 @@ steps: inputs: versionSpec: ${{ parameters.pythonVersion }} displayName: "Use Python ${{ parameters.pythonVersion }}" +<<<<<<< HEAD - template: ./azdev_setup.yml +======= + - bash: | + set -ev + + python -m venv env + chmod +x env/bin/activate + source env/bin/activate + + pip install -q git+https://github.com/Azure/azure-cli-dev-tools.git@pep420 + azdev --version + + azdev setup -c ./ + displayName: Setup Env +>>>>>>> fix generic update problem - bash: | set -ev diff --git a/src/azure-cli-core/azure/cli/core/tests/test_generic_update.py b/src/azure-cli-core/azure/cli/core/tests/test_generic_update.py index 48d13cb374a..0e5ed0e726a 100644 --- a/src/azure-cli-core/azure/cli/core/tests/test_generic_update.py +++ b/src/azure-cli-core/azure/cli/core/tests/test_generic_update.py @@ -84,10 +84,10 @@ def my_get(): def my_set(**kwargs): # pylint:disable=unused-argument return my_obj - - test_type = CliCommandType(operations_tmpl='{}#{{}}'.format(__name__)) - setattr(sys.modules[__name__], my_get.__name__, my_get) - setattr(sys.modules[__name__], my_set.__name__, my_set) + test_module = 'azure.cli.core.tests.test_generic_update' + test_type = CliCommandType(operations_tmpl='{}#{{}}'.format(test_module)) + setattr(sys.modules[test_module], my_get.__name__, my_get) + setattr(sys.modules[test_module], my_set.__name__, my_set) with self.command_group('', test_type) as g: g.generic_update_command('genupdate', getter_name='my_get', setter_name='my_set') From 7197682bdd1529254a2752007457ea8f4ad35b48 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Mon, 20 Jul 2020 14:41:29 +0800 Subject: [PATCH 30/70] fix merge conflict --- azure-pipelines.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 21e287b3317..f38e2e4ba5c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -140,23 +140,7 @@ jobs: displayName: 'Use Python 3.7' inputs: versionSpec: 3.7 -<<<<<<< HEAD - template: .azure-pipelines/templates/azdev_setup.yml -======= - - - bash: | - #!/usr/bin/env bash - - set -ev - - pip install virtualenv - python -m virtualenv venv/ - . ./venv/bin/activate - pip install -q git+https://github.com/Azure/azure-cli-dev-tools.git@pep420 - azdev setup -c $(pwd) - displayName: 'Install azdev' - ->>>>>>> init pep420 change - bash: | set -ev . env/bin/activate From a43aac5bc0937ad8409bf38a4b300ac52f447750 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Tue, 21 Jul 2020 14:54:25 +0800 Subject: [PATCH 31/70] upgrade telemetry version --- src/azure-cli-telemetry/HISTORY.rst | 4 ++++ src/azure-cli-telemetry/setup.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/azure-cli-telemetry/HISTORY.rst b/src/azure-cli-telemetry/HISTORY.rst index be11b3b7864..ed953bae2f0 100644 --- a/src/azure-cli-telemetry/HISTORY.rst +++ b/src/azure-cli-telemetry/HISTORY.rst @@ -2,6 +2,10 @@ Release History =============== +1.0.5 ++++++ +* Support PEP420 namespace package + 1.0.4 +++++ * MANIFEST file change to fix wheel install diff --git a/src/azure-cli-telemetry/setup.py b/src/azure-cli-telemetry/setup.py index 66019f6fa3f..f413fe55ca7 100755 --- a/src/azure-cli-telemetry/setup.py +++ b/src/azure-cli-telemetry/setup.py @@ -16,7 +16,7 @@ logger.warn("Wheel is not available, disabling bdist_wheel hook") cmdclass = {} -VERSION = "1.0.4" +VERSION = "1.0.5" CLASSIFIERS = [ 'Development Status :: 5 - Production/Stable', From ed508fa8820c2664fe0b95d00c3e5d9304dff76c Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Tue, 21 Jul 2020 15:32:09 +0800 Subject: [PATCH 32/70] upgrade telemetry version --- src/azure-cli/requirements.py3.Darwin.txt | 2 +- src/azure-cli/requirements.py3.Linux.txt | 2 +- src/azure-cli/requirements.py3.windows.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/azure-cli/requirements.py3.Darwin.txt b/src/azure-cli/requirements.py3.Darwin.txt index d0d1a6abc58..be3152d72ad 100644 --- a/src/azure-cli/requirements.py3.Darwin.txt +++ b/src/azure-cli/requirements.py3.Darwin.txt @@ -6,7 +6,7 @@ asn1crypto==0.24.0 azure-batch==9.0.0 azure-cli==2.9.1 azure-cli-core==2.9.1 -azure-cli-telemetry==1.0.4 +azure-cli-telemetry==1.0.5 azure-common==1.1.22 azure-cosmos==3.2.0 azure-datalake-store==0.0.48 diff --git a/src/azure-cli/requirements.py3.Linux.txt b/src/azure-cli/requirements.py3.Linux.txt index a04adef9005..a74455ef1bd 100644 --- a/src/azure-cli/requirements.py3.Linux.txt +++ b/src/azure-cli/requirements.py3.Linux.txt @@ -6,7 +6,7 @@ asn1crypto==0.24.0 azure-batch==9.0.0 azure-cli==2.9.1 azure-cli-core==2.9.1 -azure-cli-telemetry==1.0.4 +azure-cli-telemetry==1.0.5 azure-common==1.1.22 azure-cosmos==3.2.0 azure-datalake-store==0.0.48 diff --git a/src/azure-cli/requirements.py3.windows.txt b/src/azure-cli/requirements.py3.windows.txt index 37b9b1256a9..c00885a2dae 100644 --- a/src/azure-cli/requirements.py3.windows.txt +++ b/src/azure-cli/requirements.py3.windows.txt @@ -6,7 +6,7 @@ asn1crypto==0.24.0 azure-batch==9.0.0 azure-cli==2.9.1 azure-cli-core==2.9.1 -azure-cli-telemetry==1.0.4 +azure-cli-telemetry==1.0.5 azure-common==1.1.22 azure-cosmos==3.2.0 azure-datalake-store==0.0.48 From 0b73c3057e49a5bc84384b85dae708d1d5d27feb Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Tue, 21 Jul 2020 17:10:21 +0800 Subject: [PATCH 33/70] rollback some useless change --- .vscode/launch.json | 6 +++--- scripts/ci/install_azdev.sh | 12 ------------ .../command_modules/eventgrid/linter_exclusions.yml | 12 ------------ 3 files changed, 3 insertions(+), 27 deletions(-) delete mode 100644 scripts/ci/install_azdev.sh delete mode 100644 src/azure-cli/azure/cli/command_modules/eventgrid/linter_exclusions.yml diff --git a/.vscode/launch.json b/.vscode/launch.json index 1187e215bf1..a3bb8f78c2a 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,7 +5,7 @@ "name": "Azure CLI Debug (Integrated Console)", "type": "python", "request": "launch", - "pythonPath": "${command:python.interpreterPath}", + "pythonPath": "${config:python.pythonPath}", "program": "${workspaceRoot}/src/azure-cli/azure/cli/__main__.py", "cwd": "${workspaceRoot}", "args": [ @@ -24,7 +24,7 @@ "type": "python", "request": "launch", "stopOnEntry": true, - "pythonPath": "${command:python.interpreterPath}", + "pythonPath": "${config:python.pythonPath}", "program": "${workspaceRoot}/src/azure-cli/azure/cli/__main__.py", "cwd": "${workspaceRoot}", "args": [ @@ -40,7 +40,7 @@ "name": "Azdev Scripts", "type": "python", "request": "launch", - "pythonPath": "${command:python.interpreterPath}", + "pythonPath": "${config:python.pythonPath}", "program": "${workspaceRoot}/tools/automation/__main__.py", "cwd": "${workspaceRoot}", "args": [ diff --git a/scripts/ci/install_azdev.sh b/scripts/ci/install_azdev.sh deleted file mode 100644 index 6f597e70441..00000000000 --- a/scripts/ci/install_azdev.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -set -e - -echo "Install azdev into virtual environment" -export CI="ADO" -pip install virtualenv -python -m virtualenv env -. env/bin/activate -pip install -U pip setuptools wheel -q -pip install -q git+https://github.com/Azure/azure-cli-dev-tools.git@pep420 -azdev setup -c diff --git a/src/azure-cli/azure/cli/command_modules/eventgrid/linter_exclusions.yml b/src/azure-cli/azure/cli/command_modules/eventgrid/linter_exclusions.yml deleted file mode 100644 index 61ede431b8a..00000000000 --- a/src/azure-cli/azure/cli/command_modules/eventgrid/linter_exclusions.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -eventgrid partner topic event-subscription update: - parameters: - endpoint_type: - rule_exclusions: - - no_parameter_defaults_for_update_commands -eventgrid system-topic event-subscription update: - parameters: - endpoint_type: - rule_exclusions: - - no_parameter_defaults_for_update_commands -... \ No newline at end of file From 944f72fa1d7655d42e3c24f6b555d6e06aecc1f0 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Tue, 21 Jul 2020 17:18:33 +0800 Subject: [PATCH 34/70] build yum/deb/homebrew etx --- azure-pipelines.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f38e2e4ba5c..a2f16d6fa69 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -485,7 +485,7 @@ jobs: displayName: Build Homebrew Formula dependsOn: BuildPythonWheel - condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual')) + condition: succeeded() pool: vmImage: 'ubuntu-16.04' steps: @@ -576,7 +576,7 @@ jobs: displayName: Build Yum Package dependsOn: BuildPythonWheel - condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual')) + condition: succeeded() pool: vmImage: 'ubuntu-16.04' steps: @@ -597,7 +597,7 @@ jobs: displayName: Test Yum Package dependsOn: BuildYumPackage - condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual')) + condition: succeeded() pool: vmImage: 'ubuntu-16.04' steps: @@ -633,7 +633,7 @@ jobs: displayName: Build Ubuntu Packages dependsOn: BuildPythonWheel - condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual')) + condition: succeeded() pool: vmImage: 'ubuntu-16.04' strategy: @@ -674,7 +674,7 @@ jobs: displayName: Build Debian Packages dependsOn: BuildPythonWheel - condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual')) + condition: succeeded() pool: vmImage: 'ubuntu-16.04' strategy: @@ -714,7 +714,7 @@ jobs: dependsOn: - BuildUbuntuPackages - BuildDebianPackages - condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual')) + condition: succeeded() pool: vmImage: 'ubuntu-16.04' steps: From c348606feb6713b6a8fc5024c2050d272b01cd22 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Wed, 22 Jul 2020 11:22:26 +0800 Subject: [PATCH 35/70] use template to generate formula --- scripts/release/homebrew/docker/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/release/homebrew/docker/run.sh b/scripts/release/homebrew/docker/run.sh index b1375310371..2242efb8be9 100755 --- a/scripts/release/homebrew/docker/run.sh +++ b/scripts/release/homebrew/docker/run.sh @@ -10,4 +10,4 @@ pip install -r /mnt/src/azure-cli/requirements.py3.Darwin.txt pip list -python $root/formula_generate.py +python $root/formula_generate.py -b use_template From c5a3468934973d2371bd687f3dbc23351fd4db5f Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Wed, 22 Jul 2020 11:46:51 +0800 Subject: [PATCH 36/70] update build.cmd --- build_scripts/windows/scripts/build.cmd | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build_scripts/windows/scripts/build.cmd b/build_scripts/windows/scripts/build.cmd index f69e474b3c2..c21939e0726 100644 --- a/build_scripts/windows/scripts/build.cmd +++ b/build_scripts/windows/scripts/build.cmd @@ -145,6 +145,12 @@ for /d /r %BUILDING_DIR%\Lib\site-packages\pip %%d in (__pycache__) do ( if exist %%d rmdir /s /q "%%d" ) +set AZURE_CLI_INIT_FILE=%BUILDING_DIR%\Lib\site-packages\azure\cli\__int__.pyc +if exist %AZURE_CLI_INIT_FILE% ( + echo Deleting extra __int__.pyc + del %AZURE_CLI_INIT_FILE% +) + if %errorlevel% neq 0 goto ERROR ::ensure propagate_env_change.exe is available From ac4097154806ba0a59861498ae29c990d4ffe220 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Wed, 22 Jul 2020 13:27:19 +0800 Subject: [PATCH 37/70] update build scripts --- build_scripts/windows/scripts/build.cmd | 2 +- scripts/release/debian/build.sh | 6 ++++++ scripts/release/homebrew/docker/formula_template.txt | 7 +++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/build_scripts/windows/scripts/build.cmd b/build_scripts/windows/scripts/build.cmd index c21939e0726..9cb070c4595 100644 --- a/build_scripts/windows/scripts/build.cmd +++ b/build_scripts/windows/scripts/build.cmd @@ -147,7 +147,7 @@ for /d /r %BUILDING_DIR%\Lib\site-packages\pip %%d in (__pycache__) do ( set AZURE_CLI_INIT_FILE=%BUILDING_DIR%\Lib\site-packages\azure\cli\__int__.pyc if exist %AZURE_CLI_INIT_FILE% ( - echo Deleting extra __int__.pyc + echo Deleting __int__.pyc del %AZURE_CLI_INIT_FILE% ) diff --git a/scripts/release/debian/build.sh b/scripts/release/debian/build.sh index 6b007198344..3156dab017f 100755 --- a/scripts/release/debian/build.sh +++ b/scripts/release/debian/build.sh @@ -38,6 +38,12 @@ export PATH=$PATH:$WORKDIR/python_env/bin find ${WORKDIR}/src/ -name setup.py -type f | xargs -I {} dirname {} | grep -v azure-cli-testsdk | xargs pip3 install --no-deps pip3 install -r ${WORKDIR}/src/azure-cli/requirements.py3.$(uname).txt +if -f ${WORKDIR}/src/azure/cli/__init__.py; then +if [ -f "${WORKDIR}/src/azure/cli/__init__.py" ]; then + echo "Deleting __int__.py" + rm -f ${WORKDIR}/src/azure/cli/__init__.py +fi + # Create create directory for debian build mkdir -p $WORKDIR/debian $SCRIPT_DIR/prepare.sh $WORKDIR/debian $WORKDIR/az.completion $WORKDIR diff --git a/scripts/release/homebrew/docker/formula_template.txt b/scripts/release/homebrew/docker/formula_template.txt index 519e6b278bc..89d47b483cb 100644 --- a/scripts/release/homebrew/docker/formula_template.txt +++ b/scripts/release/homebrew/docker/formula_template.txt @@ -6,6 +6,7 @@ class AzureCli < Formula url "{{ upstream_url }}" version "{{ cli_version }}" sha256 "{{ upstream_sha }}" + license "MIT" head "https://github.com/Azure/azure-cli.git" {{ bottle_hash }} @@ -13,6 +14,12 @@ class AzureCli < Formula depends_on "openssl@1.1" depends_on "python@3.8" + uses_from_macos "libffi" + + on_linux do + depends_on "pkg-config" => :build + end + {{ resources }} def install From 48240f0cdb488b7caf18ef54dbf761e3ef4ca679 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Mon, 27 Jul 2020 13:35:35 +0800 Subject: [PATCH 38/70] upgrade azure-mutliapi-storage to 0.3.6 --- src/azure-cli/requirements.py3.Darwin.txt | 2 +- src/azure-cli/requirements.py3.Linux.txt | 2 +- src/azure-cli/requirements.py3.windows.txt | 2 +- src/azure-cli/setup.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/azure-cli/requirements.py3.Darwin.txt b/src/azure-cli/requirements.py3.Darwin.txt index be3152d72ad..481a55cac2c 100644 --- a/src/azure-cli/requirements.py3.Darwin.txt +++ b/src/azure-cli/requirements.py3.Darwin.txt @@ -77,7 +77,7 @@ azure-mgmt-sqlvirtualmachine==0.5.0 azure-mgmt-storage==11.1.0 azure-mgmt-trafficmanager==0.51.0 azure-mgmt-web==0.47.0 -azure-multiapi-storage==0.3.5 +azure-multiapi-storage==0.3.6 azure-loganalytics==0.1.0 azure-storage-common==1.4.2 bcrypt==3.1.7 diff --git a/src/azure-cli/requirements.py3.Linux.txt b/src/azure-cli/requirements.py3.Linux.txt index a74455ef1bd..58ea8c01d88 100644 --- a/src/azure-cli/requirements.py3.Linux.txt +++ b/src/azure-cli/requirements.py3.Linux.txt @@ -77,7 +77,7 @@ azure-mgmt-sqlvirtualmachine==0.5.0 azure-mgmt-storage==11.1.0 azure-mgmt-trafficmanager==0.51.0 azure-mgmt-web==0.47.0 -azure-multiapi-storage==0.3.5 +azure-multiapi-storage==0.3.6 azure-loganalytics==0.1.0 azure-storage-common==1.4.2 bcrypt==3.1.7 diff --git a/src/azure-cli/requirements.py3.windows.txt b/src/azure-cli/requirements.py3.windows.txt index c00885a2dae..0558889ff39 100644 --- a/src/azure-cli/requirements.py3.windows.txt +++ b/src/azure-cli/requirements.py3.windows.txt @@ -77,7 +77,7 @@ azure-mgmt-sqlvirtualmachine==0.5.0 azure-mgmt-storage==11.1.0 azure-mgmt-trafficmanager==0.51.0 azure-mgmt-web==0.47.0 -azure-multiapi-storage==0.3.5 +azure-multiapi-storage==0.3.6 azure-loganalytics==0.1.0 azure-storage-common==1.4.2 bcrypt==3.1.7 diff --git a/src/azure-cli/setup.py b/src/azure-cli/setup.py index 800339001f0..5754fba0e99 100644 --- a/src/azure-cli/setup.py +++ b/src/azure-cli/setup.py @@ -120,7 +120,7 @@ 'azure-mgmt-storage~=11.1.0', 'azure-mgmt-trafficmanager~=0.51.0', 'azure-mgmt-web~=0.47.0', - 'azure-multiapi-storage~=0.3.5', + 'azure-multiapi-storage~=0.3.6', 'azure-loganalytics~=0.1.0', 'azure-storage-common~=1.4', 'cryptography>=2.3.1,<3.0.0', From 6bd5326f3e1ad4421c2484d7233c57dcff24f148 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Mon, 27 Jul 2020 13:39:40 +0800 Subject: [PATCH 39/70] fix debian build script --- scripts/release/debian/build.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/release/debian/build.sh b/scripts/release/debian/build.sh index 3156dab017f..8ac6823cca9 100755 --- a/scripts/release/debian/build.sh +++ b/scripts/release/debian/build.sh @@ -38,7 +38,6 @@ export PATH=$PATH:$WORKDIR/python_env/bin find ${WORKDIR}/src/ -name setup.py -type f | xargs -I {} dirname {} | grep -v azure-cli-testsdk | xargs pip3 install --no-deps pip3 install -r ${WORKDIR}/src/azure-cli/requirements.py3.$(uname).txt -if -f ${WORKDIR}/src/azure/cli/__init__.py; then if [ -f "${WORKDIR}/src/azure/cli/__init__.py" ]; then echo "Deleting __int__.py" rm -f ${WORKDIR}/src/azure/cli/__init__.py From 2a486a8d5ca886c641e19f01806dd25947385a0e Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Mon, 27 Jul 2020 13:43:30 +0800 Subject: [PATCH 40/70] fix merge conflict --- .azure-pipelines/templates/automation_test.yml | 15 --------------- .azure-pipelines/templates/azdev_setup.yml | 4 ---- 2 files changed, 19 deletions(-) diff --git a/.azure-pipelines/templates/automation_test.yml b/.azure-pipelines/templates/automation_test.yml index 482f1930844..76b8891b35c 100644 --- a/.azure-pipelines/templates/automation_test.yml +++ b/.azure-pipelines/templates/automation_test.yml @@ -7,22 +7,7 @@ steps: inputs: versionSpec: ${{ parameters.pythonVersion }} displayName: "Use Python ${{ parameters.pythonVersion }}" -<<<<<<< HEAD - template: ./azdev_setup.yml -======= - - bash: | - set -ev - - python -m venv env - chmod +x env/bin/activate - source env/bin/activate - - pip install -q git+https://github.com/Azure/azure-cli-dev-tools.git@pep420 - azdev --version - - azdev setup -c ./ - displayName: Setup Env ->>>>>>> fix generic update problem - bash: | set -ev diff --git a/.azure-pipelines/templates/azdev_setup.yml b/.azure-pipelines/templates/azdev_setup.yml index 41c11bed2da..7b991bc6d50 100644 --- a/.azure-pipelines/templates/azdev_setup.yml +++ b/.azure-pipelines/templates/azdev_setup.yml @@ -14,12 +14,8 @@ steps: chmod +x env/bin/activate . env/bin/activate -<<<<<<< HEAD - pip install -q azdev==0.1.22 -======= pip install -q git+https://github.com/Azure/azure-cli-dev-tools.git@pep420 ->>>>>>> init pep420 change azdev --version if [ -z "$CLI_EXT_REPO_PATH" ]; then From 5f65b2e325a6e8d918c2b667d708e6a3d973ce9c Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Wed, 29 Jul 2020 16:45:23 +0800 Subject: [PATCH 41/70] fix merge conflict --- src/azure-cli/azure/cli/__main__.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/azure-cli/azure/cli/__main__.py b/src/azure-cli/azure/cli/__main__.py index 1828f2c2db2..4fc1bc894ea 100644 --- a/src/azure-cli/azure/cli/__main__.py +++ b/src/azure-cli/azure/cli/__main__.py @@ -16,15 +16,12 @@ from knack.completion import ARGCOMPLETE_ENV_NAME from knack.log import get_logger -<<<<<<< HEAD -======= __author__ = "Microsoft Corporation " __version__ = "2.9.1" # Log the start time # TODO: Disable E402 "Module level import not at top of file" so that imports can also be timed start_time = timeit.default_timer() ->>>>>>> elegant way to handle __main__.py # A workaround for https://bugs.python.org/issue32502 (https://github.com/Azure/azure-cli/issues/5184) # If uuid1 raises ValueError, use uuid4 instead. From 46bd50f22266f7f68c3670b72fa8c54b473e6f93 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Thu, 30 Jul 2020 15:52:30 +0800 Subject: [PATCH 42/70] fix generic update test problem --- .../azure/cli/core/tests/test_generic_update.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/azure-cli-core/azure/cli/core/tests/test_generic_update.py b/src/azure-cli-core/azure/cli/core/tests/test_generic_update.py index 0e5ed0e726a..d335b3fc2d2 100644 --- a/src/azure-cli-core/azure/cli/core/tests/test_generic_update.py +++ b/src/azure-cli-core/azure/cli/core/tests/test_generic_update.py @@ -86,8 +86,14 @@ def my_set(**kwargs): # pylint:disable=unused-argument return my_obj test_module = 'azure.cli.core.tests.test_generic_update' test_type = CliCommandType(operations_tmpl='{}#{{}}'.format(test_module)) - setattr(sys.modules[test_module], my_get.__name__, my_get) - setattr(sys.modules[test_module], my_set.__name__, my_set) + try: + setattr(sys.modules[test_module], my_get.__name__, my_get) + setattr(sys.modules[test_module], my_set.__name__, my_set) + except KeyError: + import importlib + loaded_module = importlib.import_module(test_module) + setattr(loaded_module, my_get.__name__, my_get) + setattr(loaded_module, my_set.__name__, my_set) with self.command_group('', test_type) as g: g.generic_update_command('genupdate', getter_name='my_get', setter_name='my_set') From 2bfc20e502af877eb712706ccea8a1ad1af2a828 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Thu, 30 Jul 2020 18:22:36 +0800 Subject: [PATCH 43/70] remove extra __init__.py --- build_scripts/windows/scripts/build.cmd | 12 ++++++------ scripts/release/debian/build.sh | 5 +---- scripts/release/rpm/azure-cli.spec | 4 +++- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/build_scripts/windows/scripts/build.cmd b/build_scripts/windows/scripts/build.cmd index 9cb070c4595..503e785c658 100644 --- a/build_scripts/windows/scripts/build.cmd +++ b/build_scripts/windows/scripts/build.cmd @@ -95,6 +95,12 @@ for %%a in (%CLI_SRC%\azure-cli %CLI_SRC%\azure-cli-core %CLI_SRC%\azure-cli-tel ) %BUILDING_DIR%\python.exe -m pip install -r %CLI_SRC%\azure-cli\requirements.py3.windows.txt +set AZURE_CLI_INIT_FILE=%BUILDING_DIR%\Lib\site-packages\azure\cli\__init__.py +if exist %AZURE_CLI_INIT_FILE% ( + echo Deleting __init__.py + del %AZURE_CLI_INIT_FILE% +) + if %errorlevel% neq 0 goto ERROR %BUILDING_DIR%\python.exe -m pip install --no-warn-script-location --force-reinstall urllib3==1.24.2 @@ -145,12 +151,6 @@ for /d /r %BUILDING_DIR%\Lib\site-packages\pip %%d in (__pycache__) do ( if exist %%d rmdir /s /q "%%d" ) -set AZURE_CLI_INIT_FILE=%BUILDING_DIR%\Lib\site-packages\azure\cli\__int__.pyc -if exist %AZURE_CLI_INIT_FILE% ( - echo Deleting __int__.pyc - del %AZURE_CLI_INIT_FILE% -) - if %errorlevel% neq 0 goto ERROR ::ensure propagate_env_change.exe is available diff --git a/scripts/release/debian/build.sh b/scripts/release/debian/build.sh index 8ac6823cca9..2ff2af929a3 100755 --- a/scripts/release/debian/build.sh +++ b/scripts/release/debian/build.sh @@ -38,10 +38,7 @@ export PATH=$PATH:$WORKDIR/python_env/bin find ${WORKDIR}/src/ -name setup.py -type f | xargs -I {} dirname {} | grep -v azure-cli-testsdk | xargs pip3 install --no-deps pip3 install -r ${WORKDIR}/src/azure-cli/requirements.py3.$(uname).txt -if [ -f "${WORKDIR}/src/azure/cli/__init__.py" ]; then - echo "Deleting __int__.py" - rm -f ${WORKDIR}/src/azure/cli/__init__.py -fi +rm -f ${WORKDIR}/python_env/lib/python3.6/site-packages/azure/cli/__init__.py # Create create directory for debian build mkdir -p $WORKDIR/debian diff --git a/scripts/release/rpm/azure-cli.spec b/scripts/release/rpm/azure-cli.spec index 1dfc379c8fb..2660e5258c7 100644 --- a/scripts/release/rpm/azure-cli.spec +++ b/scripts/release/rpm/azure-cli.spec @@ -44,6 +44,9 @@ source %{buildroot}%{cli_lib_dir}/bin/activate source %{repo_path}/scripts/install_full.sh +python_version=$(ls %{buildroot}%{cli_lib_dir}/lib/ | head -n 1) +rm -f %{buildroot}%{cli_lib_dir}/lib/${python_version}/site-packages/azure/cli/__init__.py + deactivate # Fix up %{buildroot} appearing in some files... @@ -51,7 +54,6 @@ for d in %{buildroot}%{cli_lib_dir}/bin/*; do perl -p -i -e "s#%{buildroot}##g" # Create executable mkdir -p %{buildroot}%{_bindir} -python_version=$(ls %{buildroot}%{cli_lib_dir}/lib/ | head -n 1) printf "#!/usr/bin/env bash\nAZ_INSTALLER=RPM PYTHONPATH=%{cli_lib_dir}/lib/${python_version}/site-packages /usr/bin/%{python_cmd} -sm azure.cli \"\$@\"" > %{buildroot}%{_bindir}/az rm %{buildroot}%{cli_lib_dir}/bin/python* %{buildroot}%{cli_lib_dir}/bin/pip* From 4fcf574b65d985ec02d74c6f920fc9c003c6231d Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Fri, 31 Jul 2020 11:27:00 +0800 Subject: [PATCH 44/70] remove __init__.pyc file in debian and rpm --- scripts/release/debian/build.sh | 1 + scripts/release/rpm/azure-cli.spec | 1 + 2 files changed, 2 insertions(+) diff --git a/scripts/release/debian/build.sh b/scripts/release/debian/build.sh index 2ff2af929a3..d800334c917 100755 --- a/scripts/release/debian/build.sh +++ b/scripts/release/debian/build.sh @@ -39,6 +39,7 @@ find ${WORKDIR}/src/ -name setup.py -type f | xargs -I {} dirname {} | grep -v a pip3 install -r ${WORKDIR}/src/azure-cli/requirements.py3.$(uname).txt rm -f ${WORKDIR}/python_env/lib/python3.6/site-packages/azure/cli/__init__.py +rm -f ${WORKDIR}/python_env/lib/python3.6/site-packages/azure/cli/__pycache__/__init__* # Create create directory for debian build mkdir -p $WORKDIR/debian diff --git a/scripts/release/rpm/azure-cli.spec b/scripts/release/rpm/azure-cli.spec index 2660e5258c7..ea670efb102 100644 --- a/scripts/release/rpm/azure-cli.spec +++ b/scripts/release/rpm/azure-cli.spec @@ -46,6 +46,7 @@ source %{repo_path}/scripts/install_full.sh python_version=$(ls %{buildroot}%{cli_lib_dir}/lib/ | head -n 1) rm -f %{buildroot}%{cli_lib_dir}/lib/${python_version}/site-packages/azure/cli/__init__.py +rm -f %{buildroot}%{cli_lib_dir}/lib/${python_version}/site-packages/azure/cli/__pycache__/__init__* deactivate From 53569e52e6f9cef7ac8c5b0fbbc7a9d1a5853ab8 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Mon, 3 Aug 2020 11:44:58 +0800 Subject: [PATCH 45/70] update build wheel stratages --- src/azure-cli-core/MANIFEST.in | 1 - src/azure-cli-core/azure_bdist_wheel.py | 52 -------------------- src/azure-cli-core/setup.cfg | 2 - src/azure-cli-core/setup.py | 11 +---- src/azure-cli-telemetry/MANIFEST.in | 1 - src/azure-cli-telemetry/azure_bdist_wheel.py | 52 -------------------- src/azure-cli-telemetry/setup.cfg | 3 +- src/azure-cli-telemetry/setup.py | 11 +---- src/azure-cli-testsdk/MANIFEST.in | 1 - src/azure-cli-testsdk/azure_bdist_wheel.py | 52 -------------------- src/azure-cli-testsdk/setup.cfg | 2 - src/azure-cli-testsdk/setup.py | 9 +--- src/azure-cli/MANIFEST.in | 2 +- src/azure-cli/azure_bdist_wheel.py | 52 -------------------- src/azure-cli/azure_cli_bdist_wheel.py | 25 ++++++++++ src/azure-cli/setup.cfg | 4 +- src/azure-cli/setup.py | 4 +- 17 files changed, 34 insertions(+), 250 deletions(-) delete mode 100644 src/azure-cli-core/azure_bdist_wheel.py delete mode 100644 src/azure-cli-telemetry/azure_bdist_wheel.py delete mode 100644 src/azure-cli-testsdk/azure_bdist_wheel.py delete mode 100644 src/azure-cli/azure_bdist_wheel.py create mode 100644 src/azure-cli/azure_cli_bdist_wheel.py diff --git a/src/azure-cli-core/MANIFEST.in b/src/azure-cli-core/MANIFEST.in index 9c3f67387c5..69ea6552b6e 100644 --- a/src/azure-cli-core/MANIFEST.in +++ b/src/azure-cli-core/MANIFEST.in @@ -1,4 +1,3 @@ include *.rst -include azure_bdist_wheel.py include azure/__init__.py include azure/cli/__init__.py \ No newline at end of file diff --git a/src/azure-cli-core/azure_bdist_wheel.py b/src/azure-cli-core/azure_bdist_wheel.py deleted file mode 100644 index 753ae493176..00000000000 --- a/src/azure-cli-core/azure_bdist_wheel.py +++ /dev/null @@ -1,52 +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 write_wheelfile(self, wheelfile_base, generator=None): - if self.azure_namespace_package: - 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: - bdist_dir = os.path.dirname(wheelfile_base) - 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: - logger.info("skip {} as it is not include in the build target".format(init_file)) - - if generator is None: - bdist_wheel.write_wheelfile(self, wheelfile_base) - else: - bdist_wheel.write_wheelfile(self, wheelfile_base, generator) - -cmdclass = { - 'bdist_wheel': azure_bdist_wheel, -} diff --git a/src/azure-cli-core/setup.cfg b/src/azure-cli-core/setup.cfg index 06af3bd4360..e69de29bb2d 100644 --- a/src/azure-cli-core/setup.cfg +++ b/src/azure-cli-core/setup.cfg @@ -1,2 +0,0 @@ -[bdist_wheel] -azure-namespace-package=azure-cli-nspkg diff --git a/src/azure-cli-core/setup.py b/src/azure-cli-core/setup.py index fb69f8c7658..a1357cb89f5 100644 --- a/src/azure-cli-core/setup.py +++ b/src/azure-cli-core/setup.py @@ -9,14 +9,6 @@ from codecs import open from setuptools import 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 = {} - VERSION = "2.9.1" # If we have source, validate that our version numbers match # This should prevent uploading releases with mismatched versions. @@ -105,6 +97,5 @@ "test": TESTS_REQUIRE, }, tests_require=TESTS_REQUIRE, - package_data={'azure.cli.core': ['auth_landing_pages/*.html']}, - cmdclass=cmdclass + package_data={'azure.cli.core': ['auth_landing_pages/*.html']} ) diff --git a/src/azure-cli-telemetry/MANIFEST.in b/src/azure-cli-telemetry/MANIFEST.in index 9c3f67387c5..69ea6552b6e 100644 --- a/src/azure-cli-telemetry/MANIFEST.in +++ b/src/azure-cli-telemetry/MANIFEST.in @@ -1,4 +1,3 @@ include *.rst -include azure_bdist_wheel.py include azure/__init__.py include azure/cli/__init__.py \ No newline at end of file diff --git a/src/azure-cli-telemetry/azure_bdist_wheel.py b/src/azure-cli-telemetry/azure_bdist_wheel.py deleted file mode 100644 index 753ae493176..00000000000 --- a/src/azure-cli-telemetry/azure_bdist_wheel.py +++ /dev/null @@ -1,52 +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 write_wheelfile(self, wheelfile_base, generator=None): - if self.azure_namespace_package: - 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: - bdist_dir = os.path.dirname(wheelfile_base) - 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: - logger.info("skip {} as it is not include in the build target".format(init_file)) - - if generator is None: - bdist_wheel.write_wheelfile(self, wheelfile_base) - else: - bdist_wheel.write_wheelfile(self, wheelfile_base, generator) - -cmdclass = { - 'bdist_wheel': azure_bdist_wheel, -} diff --git a/src/azure-cli-telemetry/setup.cfg b/src/azure-cli-telemetry/setup.cfg index 06af3bd4360..8b137891791 100644 --- a/src/azure-cli-telemetry/setup.cfg +++ b/src/azure-cli-telemetry/setup.cfg @@ -1,2 +1 @@ -[bdist_wheel] -azure-namespace-package=azure-cli-nspkg + diff --git a/src/azure-cli-telemetry/setup.py b/src/azure-cli-telemetry/setup.py index f413fe55ca7..28a90870376 100755 --- a/src/azure-cli-telemetry/setup.py +++ b/src/azure-cli-telemetry/setup.py @@ -8,14 +8,6 @@ from codecs import open from setuptools import 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 = {} - VERSION = "1.0.5" CLASSIFIERS = [ @@ -56,6 +48,5 @@ ], test_requires=[ 'mock' - ], - cmdclass=cmdclass + ] ) diff --git a/src/azure-cli-testsdk/MANIFEST.in b/src/azure-cli-testsdk/MANIFEST.in index 9c3f67387c5..69ea6552b6e 100644 --- a/src/azure-cli-testsdk/MANIFEST.in +++ b/src/azure-cli-testsdk/MANIFEST.in @@ -1,4 +1,3 @@ include *.rst -include azure_bdist_wheel.py include azure/__init__.py include azure/cli/__init__.py \ No newline at end of file diff --git a/src/azure-cli-testsdk/azure_bdist_wheel.py b/src/azure-cli-testsdk/azure_bdist_wheel.py deleted file mode 100644 index 753ae493176..00000000000 --- a/src/azure-cli-testsdk/azure_bdist_wheel.py +++ /dev/null @@ -1,52 +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 write_wheelfile(self, wheelfile_base, generator=None): - if self.azure_namespace_package: - 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: - bdist_dir = os.path.dirname(wheelfile_base) - 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: - logger.info("skip {} as it is not include in the build target".format(init_file)) - - if generator is None: - bdist_wheel.write_wheelfile(self, wheelfile_base) - else: - bdist_wheel.write_wheelfile(self, wheelfile_base, generator) - -cmdclass = { - 'bdist_wheel': azure_bdist_wheel, -} diff --git a/src/azure-cli-testsdk/setup.cfg b/src/azure-cli-testsdk/setup.cfg index 06af3bd4360..e69de29bb2d 100644 --- a/src/azure-cli-testsdk/setup.cfg +++ b/src/azure-cli-testsdk/setup.cfg @@ -1,2 +0,0 @@ -[bdist_wheel] -azure-namespace-package=azure-cli-nspkg diff --git a/src/azure-cli-testsdk/setup.py b/src/azure-cli-testsdk/setup.py index 360278cb5ec..0d563a5e860 100644 --- a/src/azure-cli-testsdk/setup.py +++ b/src/azure-cli-testsdk/setup.py @@ -7,12 +7,6 @@ from codecs import open from setuptools import 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 = {} VERSION = "0.2.4" @@ -53,6 +47,5 @@ packages=[ 'azure.cli.testsdk' ], - install_requires=DEPENDENCIES, - cmdclass=cmdclass + install_requires=DEPENDENCIES ) diff --git a/src/azure-cli/MANIFEST.in b/src/azure-cli/MANIFEST.in index d54ffe8eb4f..88aeeb7ed71 100644 --- a/src/azure-cli/MANIFEST.in +++ b/src/azure-cli/MANIFEST.in @@ -1,6 +1,6 @@ include LICENSE.txt include HISTORY.rst include README.rst -include azure_bdist_wheel.py +include azure_cli_bdist_wheel.py include azure/__init__.py include azure/cli/__init__.py \ No newline at end of file diff --git a/src/azure-cli/azure_bdist_wheel.py b/src/azure-cli/azure_bdist_wheel.py deleted file mode 100644 index 753ae493176..00000000000 --- a/src/azure-cli/azure_bdist_wheel.py +++ /dev/null @@ -1,52 +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 write_wheelfile(self, wheelfile_base, generator=None): - if self.azure_namespace_package: - 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: - bdist_dir = os.path.dirname(wheelfile_base) - 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: - logger.info("skip {} as it is not include in the build target".format(init_file)) - - if generator is None: - bdist_wheel.write_wheelfile(self, wheelfile_base) - else: - bdist_wheel.write_wheelfile(self, wheelfile_base, generator) - -cmdclass = { - 'bdist_wheel': azure_bdist_wheel, -} diff --git a/src/azure-cli/azure_cli_bdist_wheel.py b/src/azure-cli/azure_cli_bdist_wheel.py new file mode 100644 index 00000000000..65d157a9ce3 --- /dev/null +++ b/src/azure-cli/azure_cli_bdist_wheel.py @@ -0,0 +1,25 @@ +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +from distutils.command.build_py import build_py + + +class azure_cli_build_py(build_py): + + def initialize_options(self): + super(azure_cli_build_py, self).initialize_options() + self.extra_build_source_files = None + + def build_packages(self): + super(azure_cli_build_py, self).build_packages() + if self.extra_build_source_files: + package, module, module_file = self.extra_build_source_files.split(',') + self.build_module(module, module_file, package) + + +cmdclass = { + 'build_py': azure_cli_build_py, +} diff --git a/src/azure-cli/setup.cfg b/src/azure-cli/setup.cfg index 06af3bd4360..71550440584 100644 --- a/src/azure-cli/setup.cfg +++ b/src/azure-cli/setup.cfg @@ -1,2 +1,2 @@ -[bdist_wheel] -azure-namespace-package=azure-cli-nspkg +[build_py] +extra-build-source-files=azure.cli,__main__,azure/cli/__main__.py diff --git a/src/azure-cli/setup.py b/src/azure-cli/setup.py index 3f3db35c49f..564fb678885 100644 --- a/src/azure-cli/setup.py +++ b/src/azure-cli/setup.py @@ -11,7 +11,7 @@ import sys try: - from azure_bdist_wheel import cmdclass + from azure_cli_bdist_wheel import cmdclass except ImportError: from distutils import log as logger @@ -162,7 +162,7 @@ 'az.completion.sh', 'az.bat', ], - packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests", "azure"]), + packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests", "azure", "azure.cli"]), install_requires=DEPENDENCIES, package_data={ 'azure.cli.command_modules.acr': ['*.json'], From 4d87e274ce4d61c85feb29bfb9651a895b58a91d Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Mon, 3 Aug 2020 12:29:03 +0800 Subject: [PATCH 46/70] update version --- src/azure-cli-core/azure/cli/core/__init__.py | 2 +- src/azure-cli-core/setup.py | 2 +- src/azure-cli/requirements.py3.Darwin.txt | 4 ++-- src/azure-cli/requirements.py3.Linux.txt | 4 ++-- src/azure-cli/requirements.py3.windows.txt | 4 ++-- src/azure-cli/setup.py | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/azure-cli-core/azure/cli/core/__init__.py b/src/azure-cli-core/azure/cli/core/__init__.py index eea93fa1fea..db35a2254fd 100644 --- a/src/azure-cli-core/azure/cli/core/__init__.py +++ b/src/azure-cli-core/azure/cli/core/__init__.py @@ -6,7 +6,7 @@ from __future__ import print_function -__version__ = "2.10.0" +__version__ = "2.9.1" import os import sys diff --git a/src/azure-cli-core/setup.py b/src/azure-cli-core/setup.py index 5169c7290e8..a1357cb89f5 100644 --- a/src/azure-cli-core/setup.py +++ b/src/azure-cli-core/setup.py @@ -9,7 +9,7 @@ from codecs import open from setuptools import setup -VERSION = "2.10.0" +VERSION = "2.9.1" # If we have source, validate that our version numbers match # This should prevent uploading releases with mismatched versions. try: diff --git a/src/azure-cli/requirements.py3.Darwin.txt b/src/azure-cli/requirements.py3.Darwin.txt index 8bc727d9ab8..e6d3d9c7a6e 100644 --- a/src/azure-cli/requirements.py3.Darwin.txt +++ b/src/azure-cli/requirements.py3.Darwin.txt @@ -4,8 +4,8 @@ applicationinsights==0.11.9 argcomplete==1.11.1 asn1crypto==0.24.0 azure-batch==9.0.0 -azure-cli==2.10.0 -azure-cli-core==2.10.0 +azure-cli==2.9.1 +azure-cli-core==2.9.1 azure-cli-telemetry==1.0.5 azure-common==1.1.22 azure-cosmos==3.2.0 diff --git a/src/azure-cli/requirements.py3.Linux.txt b/src/azure-cli/requirements.py3.Linux.txt index f0f6bdd802b..0130b590858 100644 --- a/src/azure-cli/requirements.py3.Linux.txt +++ b/src/azure-cli/requirements.py3.Linux.txt @@ -4,8 +4,8 @@ applicationinsights==0.11.9 argcomplete==1.11.1 asn1crypto==0.24.0 azure-batch==9.0.0 -azure-cli==2.10.0 -azure-cli-core==2.10.0 +azure-cli==2.9.1 +azure-cli-core==2.9.1 azure-cli-telemetry==1.0.5 azure-common==1.1.22 azure-cosmos==3.2.0 diff --git a/src/azure-cli/requirements.py3.windows.txt b/src/azure-cli/requirements.py3.windows.txt index 2f72c2b5f57..bee3e33a822 100644 --- a/src/azure-cli/requirements.py3.windows.txt +++ b/src/azure-cli/requirements.py3.windows.txt @@ -4,8 +4,8 @@ applicationinsights==0.11.7 argcomplete==1.11.1 asn1crypto==0.24.0 azure-batch==9.0.0 -azure-cli==2.10.0 -azure-cli-core==2.10.0 +azure-cli==2.9.1 +azure-cli-core==2.9.1 azure-cli-telemetry==1.0.5 azure-common==1.1.22 azure-cosmos==3.2.0 diff --git a/src/azure-cli/setup.py b/src/azure-cli/setup.py index 084d9c2e1cc..564fb678885 100644 --- a/src/azure-cli/setup.py +++ b/src/azure-cli/setup.py @@ -18,7 +18,7 @@ logger.warn("Wheel is not available, disabling bdist_wheel hook") cmdclass = {} -VERSION = "2.10.0" +VERSION = "2.9.1" # If we have source, validate that our version numbers match # This should prevent uploading releases with mismatched versions. try: From 820629994af239fd379874c0a9f0df24e1bacc23 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Mon, 3 Aug 2020 12:40:09 +0800 Subject: [PATCH 47/70] update build scripts --- build_scripts/windows/scripts/build.cmd | 6 -- scripts/release/debian/build.sh | 3 - scripts/release/rpm/azure-cli.spec | 5 +- src/azure-cli-core/HISTORY.rst | 4 - src/azure-cli/HISTORY.rst | 98 ------------------------- 5 files changed, 1 insertion(+), 115 deletions(-) diff --git a/build_scripts/windows/scripts/build.cmd b/build_scripts/windows/scripts/build.cmd index ac40c4db04e..16117510c96 100644 --- a/build_scripts/windows/scripts/build.cmd +++ b/build_scripts/windows/scripts/build.cmd @@ -95,12 +95,6 @@ for %%a in (%CLI_SRC%\azure-cli %CLI_SRC%\azure-cli-core %CLI_SRC%\azure-cli-tel ) %BUILDING_DIR%\python.exe -m pip install -r %CLI_SRC%\azure-cli\requirements.py3.windows.txt -set AZURE_CLI_INIT_FILE=%BUILDING_DIR%\Lib\site-packages\azure\cli\__init__.py -if exist %AZURE_CLI_INIT_FILE% ( - echo Deleting __init__.py - del %AZURE_CLI_INIT_FILE% -) - if %errorlevel% neq 0 goto ERROR %BUILDING_DIR%\python.exe -m pip install --no-warn-script-location --force-reinstall urllib3==1.24.2 diff --git a/scripts/release/debian/build.sh b/scripts/release/debian/build.sh index d800334c917..6b007198344 100755 --- a/scripts/release/debian/build.sh +++ b/scripts/release/debian/build.sh @@ -38,9 +38,6 @@ export PATH=$PATH:$WORKDIR/python_env/bin find ${WORKDIR}/src/ -name setup.py -type f | xargs -I {} dirname {} | grep -v azure-cli-testsdk | xargs pip3 install --no-deps pip3 install -r ${WORKDIR}/src/azure-cli/requirements.py3.$(uname).txt -rm -f ${WORKDIR}/python_env/lib/python3.6/site-packages/azure/cli/__init__.py -rm -f ${WORKDIR}/python_env/lib/python3.6/site-packages/azure/cli/__pycache__/__init__* - # Create create directory for debian build mkdir -p $WORKDIR/debian $SCRIPT_DIR/prepare.sh $WORKDIR/debian $WORKDIR/az.completion $WORKDIR diff --git a/scripts/release/rpm/azure-cli.spec b/scripts/release/rpm/azure-cli.spec index ea670efb102..1dfc379c8fb 100644 --- a/scripts/release/rpm/azure-cli.spec +++ b/scripts/release/rpm/azure-cli.spec @@ -44,10 +44,6 @@ source %{buildroot}%{cli_lib_dir}/bin/activate source %{repo_path}/scripts/install_full.sh -python_version=$(ls %{buildroot}%{cli_lib_dir}/lib/ | head -n 1) -rm -f %{buildroot}%{cli_lib_dir}/lib/${python_version}/site-packages/azure/cli/__init__.py -rm -f %{buildroot}%{cli_lib_dir}/lib/${python_version}/site-packages/azure/cli/__pycache__/__init__* - deactivate # Fix up %{buildroot} appearing in some files... @@ -55,6 +51,7 @@ for d in %{buildroot}%{cli_lib_dir}/bin/*; do perl -p -i -e "s#%{buildroot}##g" # Create executable mkdir -p %{buildroot}%{_bindir} +python_version=$(ls %{buildroot}%{cli_lib_dir}/lib/ | head -n 1) printf "#!/usr/bin/env bash\nAZ_INSTALLER=RPM PYTHONPATH=%{cli_lib_dir}/lib/${python_version}/site-packages /usr/bin/%{python_cmd} -sm azure.cli \"\$@\"" > %{buildroot}%{_bindir}/az rm %{buildroot}%{cli_lib_dir}/bin/python* %{buildroot}%{cli_lib_dir}/bin/pip* diff --git a/src/azure-cli-core/HISTORY.rst b/src/azure-cli-core/HISTORY.rst index 15c6f9c962f..669e82cd33e 100644 --- a/src/azure-cli-core/HISTORY.rst +++ b/src/azure-cli-core/HISTORY.rst @@ -3,10 +3,6 @@ Release History =============== -2.10.0 -++++++ -* Minor fixes - 2.9.1 ++++++ * Minor fixes diff --git a/src/azure-cli/HISTORY.rst b/src/azure-cli/HISTORY.rst index 11e3b16369b..9543b1755f5 100644 --- a/src/azure-cli/HISTORY.rst +++ b/src/azure-cli/HISTORY.rst @@ -3,104 +3,6 @@ Release History =============== -2.10.0 -++++++ - -**AKS** - -* `az aks update`: Change --enable-aad argument to migrate a RBAC-enabled non-AAD cluster to a AKS-managed AAD cluster (#14420) -* `az aks install-cli`: Add --kubelogin-version and --kubelogin-install-location arguments to install kubelogin (#14441) -* Add az aks nodepool get-upgrades command (#14516) - -**AMS** - -* Fix #14021: az ams account sp is not idempotent (#14429) - -**APIM** - -* apim api import: support API import and enchance other api level cli commands (#14363) - -**App Service** - -* Fix #13035: Add validation for az webapp config access-restriction to avoid adding duplicates (#14486) - -**AppConfig** - -* Default to standard sku if not specified (#14398) -* [BREAKING CHANGE] Support settings with JSON content type (#14170) - -**ARM** - -* `az resource tag`: Fix the bug of managedApp tagging and some related test issues (#14381) -* `az deployment mg/tenant what-if`: Add support to management group and tenant level deployment What-If (#14568) -* `az deployment mg/tenant create`: Add --confirm-with-what-if/-c parameter. (#14568) -* `az deployment mg/tenant create`: Add --what-if-result-format/-r parameter. (#14568) -* `az deployment mg/tenant create`: Add --what-if-exclude-change-types/-x parameter. (#14568) -* `az tag`: az tag support for resource id parameter (#14558) - -**Backup** - -* Trigger AFS container/item discovery only when needed (#14479) - -**CDN** - -* Add private link fields to origin (#14520) - -**Compute** - -* `az vm/vmss create`: Select a valid username for user if the default username is invalid (#14346) -* `az vm update`: support cross tenant image (#14532) -* `az disk-access`: Add new command group to operate disk access resource (#14460) -* Support dedicated host group automatic placement (#14439) -* Support ppg and spg in VMSS orchestration mode (#14443) - -**Config** - -* `az config`: Add new `config` command module (#14436) - -**Extension** - -* Support automatically installing an extension if the extension of a command is not installed (#14478) - -**HDInsight** - -* Add 3 parameters to the command `az hdinsight create` to support private link and encryption in transit feature: (#14504) - -**Iot Hub** - -* Fix #7792: IoT Hub Create is not idempotent (#14449) - -**IoT Central** - -* Add paramater option list for iot central (#14471) - -**KeyVault** - -* `az keyvault key encrypt/decrypt`: add parameter `--data-type` for explicitly specifing the type of original data (#14386) - -**Monitor** - -* `az monitor log-analytics workspace data-export`: support event hub namespace as the destination. (#14434) -* `az monitor autoscale`: support namespace and dimensions for --condition (#14255) - -**NetAppFiles** - -* `az volume revert`: Add Volume Revert to revert a volume to one of its snapshots. (#14424) -* [BREAKING CHANGE] Remove `az netappfiles mount-target`. (#14424) -* `az volume show`: Add site to Active Directory Properties (#14424) - -**Network** - -* `az application-gateway private-link add`: support to specify an existing subnet by ID (#14463) -* `az network application-gateway waf-policy create`: support version and type (#14531) - -**Storage** - -* Fix #10302: Support guess content-type when synchronizing files (#14353) -* `az storage blob lease`: Apply new api version for blob lease operations (#14231) -* `az storage fs access`: Support AAD credential in managing access control for ADLS Gen2 account (#14506) -* `az storage share-rm create/update`: add --access-tier to support access tier (#14148) - 2.9.1 ++++++ From 81fbb364eec76ff0bc00491e82f3d51a1a3392af Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Mon, 3 Aug 2020 13:37:46 +0800 Subject: [PATCH 48/70] fix webapp test error --- .../recordings/test_webapp_assign_user_identity.yaml | 6 +++--- .../latest/recordings/test_webapp_create_with_msi.yaml | 6 +++--- .../latest/recordings/test_webapp_remove_identity.yaml | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/recordings/test_webapp_assign_user_identity.yaml b/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/recordings/test_webapp_assign_user_identity.yaml index 04aa5b44c86..8e2fb2c77c6 100644 --- a/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/recordings/test_webapp_assign_user_identity.yaml +++ b/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/recordings/test_webapp_assign_user_identity.yaml @@ -18,7 +18,7 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2019-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2020-06-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001","name":"clitest.rg000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2020-07-09T09:43:29Z"},"properties":{"provisioningState":"Succeeded"}}' @@ -116,7 +116,7 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2019-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2020-06-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001","name":"clitest.rg000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2020-07-09T09:43:29Z"},"properties":{"provisioningState":"Succeeded"}}' @@ -221,7 +221,7 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2019-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2020-06-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001","name":"clitest.rg000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2020-07-09T09:43:29Z"},"properties":{"provisioningState":"Succeeded"}}' diff --git a/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/recordings/test_webapp_create_with_msi.yaml b/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/recordings/test_webapp_create_with_msi.yaml index 0ec3ead013d..1b69eb91b58 100644 --- a/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/recordings/test_webapp_create_with_msi.yaml +++ b/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/recordings/test_webapp_create_with_msi.yaml @@ -18,7 +18,7 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg000001?api-version=2019-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg000001?api-version=2020-06-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000001","name":"rg000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2020-07-20T06:00:19Z"},"properties":{"provisioningState":"Succeeded"}}' @@ -116,7 +116,7 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg000001?api-version=2019-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg000001?api-version=2020-06-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000001","name":"rg000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2020-07-20T06:00:19Z"},"properties":{"provisioningState":"Succeeded"}}' @@ -221,7 +221,7 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg000001?api-version=2019-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg000001?api-version=2020-06-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000001","name":"rg000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2020-07-20T06:00:19Z"},"properties":{"provisioningState":"Succeeded"}}' diff --git a/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/recordings/test_webapp_remove_identity.yaml b/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/recordings/test_webapp_remove_identity.yaml index 658acdef2bd..485755a164d 100644 --- a/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/recordings/test_webapp_remove_identity.yaml +++ b/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/recordings/test_webapp_remove_identity.yaml @@ -18,7 +18,7 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2019-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2020-06-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001","name":"clitest.rg000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2020-07-10T08:59:26Z"},"properties":{"provisioningState":"Succeeded"}}' @@ -116,7 +116,7 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2019-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2020-06-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001","name":"clitest.rg000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2020-07-10T08:59:26Z"},"properties":{"provisioningState":"Succeeded"}}' @@ -214,7 +214,7 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2019-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2020-06-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001","name":"clitest.rg000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2020-07-10T08:59:26Z"},"properties":{"provisioningState":"Succeeded"}}' @@ -319,7 +319,7 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2019-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2020-06-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001","name":"clitest.rg000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2020-07-10T08:59:26Z"},"properties":{"provisioningState":"Succeeded"}}' From 7f47f19e0710b35c8787dd0233ae2666ba5ce51a Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Mon, 3 Aug 2020 14:48:01 +0800 Subject: [PATCH 49/70] add __main__.py in sdist --- src/azure-cli/MANIFEST.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/azure-cli/MANIFEST.in b/src/azure-cli/MANIFEST.in index 88aeeb7ed71..b50e5418e51 100644 --- a/src/azure-cli/MANIFEST.in +++ b/src/azure-cli/MANIFEST.in @@ -3,4 +3,5 @@ include HISTORY.rst include README.rst include azure_cli_bdist_wheel.py include azure/__init__.py -include azure/cli/__init__.py \ No newline at end of file +include azure/cli/__init__.py +include azure/cli/__main__.py From 7cec6fb5f0322e328e2c9cd0a7fce020e78259a7 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Tue, 11 Aug 2020 15:00:47 +0800 Subject: [PATCH 50/70] add test homebrew package scripts --- azure-pipelines.yml | 27 +++++++++++++++ .../release/homebrew/test_homebrew_package.py | 34 +++++++++++++++++++ .../release/homebrew/test_homebrew_package.sh | 25 ++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 scripts/release/homebrew/test_homebrew_package.py create mode 100644 scripts/release/homebrew/test_homebrew_package.sh diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9fbe1df0b15..69ee4bf377b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -572,6 +572,33 @@ jobs: displayName: 'Bash Script' +- job: TestHomebrewPackage + displayName: Test Homebrew Package + + dependsOn: BuildHomebrewFormula + condition: succeeded() + pool: + vmImage: 'macOS-10.14' + steps: + - task: DownloadPipelineArtifact@1 + displayName: 'Download Metadata' + inputs: + TargetPath: '$(Build.ArtifactStagingDirectory)/metadata' + artifactName: metadata + + + - task: DownloadPipelineArtifact@1 + displayName: 'Download Build Artifacts' + inputs: + TargetPath: '$(Build.ArtifactStagingDirectory)/homebrew' + artifactName: homebrew + + + - bash: ./scripts/release/homebrew/test_homebrew_package.sh + + + displayName: 'Test Homebrew Package' + - job: BuildYumPackage displayName: Build Yum Package diff --git a/scripts/release/homebrew/test_homebrew_package.py b/scripts/release/homebrew/test_homebrew_package.py new file mode 100644 index 00000000000..2215ad1f518 --- /dev/null +++ b/scripts/release/homebrew/test_homebrew_package.py @@ -0,0 +1,34 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +import os +import sys +import subprocess + +if len(sys.argv) < 2: + print('AZ_BASE or PYTHON_VERSION are not specified') + sys.exit(-1) + +az_base = sys.argv[1] +python_version = sys.argv[2] + +root_dir = '{}/lib/{}/site-packages/azure/cli/command_modules'.format(az_base, python_version) +mod_list = [mod for mod in sorted(os.listdir(root_dir)) if os.path.isdir(os.path.join(root_dir, mod)) and mod != '__pycache__'] + +pytest_base_cmd = 'PYTHONPATH={}/lib/{}/site-packages python -m pytest -x -v --boxed -p no:warnings --log-level=WARN'.format(az_base, python_version) +pytest_parallel_cmd = '{} -n auto'.format(pytest_base_cmd) + +for mod_name in mod_list: + if mod_name in ['botservice', 'network']: + exit_code = subprocess.call(['{} --junit-xml /azure_cli_test_result/{}.xml --pyargs azure.cli.command_modules.{}'.format(pytest_base_cmd, mod_name, mod_name)], shell=True) + else: + exit_code = subprocess.call(['{} --junit-xml /azure_cli_test_result/{}.xml --pyargs azure.cli.command_modules.{}'.format(pytest_parallel_cmd, mod_name, mod_name)], shell=True) + if exit_code == 5: + print('No tests found for {}'.format(mod_name)) + elif exit_code != 0: + sys.exit(exit_code) + +exit_code = subprocess.call(['{} --junit-xml /azure_cli_test_result/azure-cli-core.xml --pyargs azure.cli.core'.format(pytest_parallel_cmd)], shell=True) +sys.exit(exit_code) diff --git a/scripts/release/homebrew/test_homebrew_package.sh b/scripts/release/homebrew/test_homebrew_package.sh new file mode 100644 index 00000000000..f4ab7dbf605 --- /dev/null +++ b/scripts/release/homebrew/test_homebrew_package.sh @@ -0,0 +1,25 @@ +#/bin/bash + +set -ev + +CLI_VERSION=`cat $SYSTEM_ARTIFACTSDIRECTORY/metadata/version` + +echo == Remove pre-installed azure-cli == +brew uninstall azure-cli + +echo == Install azure-cli.rb formula == +brew install --build-from-source $SYSTEM_ARTIFACTSDIRECTORY/homebrew/azure-cli.rb + +AZ_BASE=/usr/local/Cellar/azure-cli/$CLI_VERSION/libexec +ln -s $AZ_BASE/bin/python /usr/bin/python +ln -s $AZ_BASE/bin/pip /usr/bin/pip +pip install wheel +./scripts/ci/build.sh +pip install pytest --prefix $AZ_BASE +pip install pytest-xdist --prefix $AZ_BASE + +find ./artifacts/build -name "azure_cli_testsdk*" | xargs pip install --prefix $AZ_BASE --upgrade --ignore-installed +find ./artifacts/build -name "azure_cli_fulltest*" | xargs pip install --prefix $AZ_BASE --upgrade --ignore-installed --no-deps + +PYTHON_VERSION=`ls $AZ_BASE/lib/ | head -n 1` +python ./scripts/release/homebrew/test_homebrew_package.py $AZ_BASE $PYTHON_VERSION \ No newline at end of file From e3087c548887e1ca98acdabd1b45a34bdfce4582 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Tue, 11 Aug 2020 15:06:50 +0800 Subject: [PATCH 51/70] update version value in __main__.py --- src/azure-cli/azure/cli/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/__main__.py b/src/azure-cli/azure/cli/__main__.py index 4fc1bc894ea..20ef665b7f3 100644 --- a/src/azure-cli/azure/cli/__main__.py +++ b/src/azure-cli/azure/cli/__main__.py @@ -17,7 +17,7 @@ from knack.log import get_logger __author__ = "Microsoft Corporation " -__version__ = "2.9.1" +__version__ = "2.10.1" # Log the start time # TODO: Disable E402 "Module level import not at top of file" so that imports can also be timed From 525de65dc802bf32f61310d75fe826e8dd5f5e71 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Tue, 11 Aug 2020 15:25:01 +0800 Subject: [PATCH 52/70] make test_homebrew_package.sh executable --- scripts/release/homebrew/test_homebrew_package.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/release/homebrew/test_homebrew_package.sh diff --git a/scripts/release/homebrew/test_homebrew_package.sh b/scripts/release/homebrew/test_homebrew_package.sh old mode 100644 new mode 100755 From dea113d51d176c265263adc5eadfc2736c353739 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Tue, 11 Aug 2020 16:03:09 +0800 Subject: [PATCH 53/70] fix homebrew permission problem --- scripts/release/homebrew/test_homebrew_package.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/release/homebrew/test_homebrew_package.sh b/scripts/release/homebrew/test_homebrew_package.sh index f4ab7dbf605..c3209100b75 100755 --- a/scripts/release/homebrew/test_homebrew_package.sh +++ b/scripts/release/homebrew/test_homebrew_package.sh @@ -11,8 +11,8 @@ echo == Install azure-cli.rb formula == brew install --build-from-source $SYSTEM_ARTIFACTSDIRECTORY/homebrew/azure-cli.rb AZ_BASE=/usr/local/Cellar/azure-cli/$CLI_VERSION/libexec -ln -s $AZ_BASE/bin/python /usr/bin/python -ln -s $AZ_BASE/bin/pip /usr/bin/pip +export PATH=$AZ_BASE/bin:$PATH +echo $PATH pip install wheel ./scripts/ci/build.sh pip install pytest --prefix $AZ_BASE From 22fef1eab8361aded3ce431045752d1cf5d3a2d4 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Wed, 12 Aug 2020 10:28:50 +0800 Subject: [PATCH 54/70] fix error --- scripts/release/homebrew/test_homebrew_package.py | 6 +++--- scripts/release/homebrew/test_homebrew_package.sh | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/release/homebrew/test_homebrew_package.py b/scripts/release/homebrew/test_homebrew_package.py index 2215ad1f518..8fd11922d1e 100644 --- a/scripts/release/homebrew/test_homebrew_package.py +++ b/scripts/release/homebrew/test_homebrew_package.py @@ -22,13 +22,13 @@ for mod_name in mod_list: if mod_name in ['botservice', 'network']: - exit_code = subprocess.call(['{} --junit-xml /azure_cli_test_result/{}.xml --pyargs azure.cli.command_modules.{}'.format(pytest_base_cmd, mod_name, mod_name)], shell=True) + exit_code = subprocess.call(['{} --junit-xml ./azure_cli_test_result/{}.xml --pyargs azure.cli.command_modules.{}'.format(pytest_base_cmd, mod_name, mod_name)], shell=True) else: - exit_code = subprocess.call(['{} --junit-xml /azure_cli_test_result/{}.xml --pyargs azure.cli.command_modules.{}'.format(pytest_parallel_cmd, mod_name, mod_name)], shell=True) + exit_code = subprocess.call(['{} --junit-xml ./azure_cli_test_result/{}.xml --pyargs azure.cli.command_modules.{}'.format(pytest_parallel_cmd, mod_name, mod_name)], shell=True) if exit_code == 5: print('No tests found for {}'.format(mod_name)) elif exit_code != 0: sys.exit(exit_code) -exit_code = subprocess.call(['{} --junit-xml /azure_cli_test_result/azure-cli-core.xml --pyargs azure.cli.core'.format(pytest_parallel_cmd)], shell=True) +exit_code = subprocess.call(['{} --junit-xml ./azure_cli_test_result/azure-cli-core.xml --pyargs azure.cli.core'.format(pytest_parallel_cmd)], shell=True) sys.exit(exit_code) diff --git a/scripts/release/homebrew/test_homebrew_package.sh b/scripts/release/homebrew/test_homebrew_package.sh index c3209100b75..a699520fac2 100755 --- a/scripts/release/homebrew/test_homebrew_package.sh +++ b/scripts/release/homebrew/test_homebrew_package.sh @@ -12,6 +12,7 @@ brew install --build-from-source $SYSTEM_ARTIFACTSDIRECTORY/homebrew/azure-cli.r AZ_BASE=/usr/local/Cellar/azure-cli/$CLI_VERSION/libexec export PATH=$AZ_BASE/bin:$PATH +export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES echo $PATH pip install wheel ./scripts/ci/build.sh From 162378735988cb622d205a8788e52f2731b82015 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Thu, 13 Aug 2020 11:40:37 +0800 Subject: [PATCH 55/70] skip some acr tests --- .../azure/cli/command_modules/acs/tests/latest/test_custom.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_custom.py b/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_custom.py index 90ad3645317..9c14f33af00 100644 --- a/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_custom.py +++ b/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_custom.py @@ -665,6 +665,7 @@ def test_k8s_install_kubectl_create_installation_dir(self, logger_mock, mock_url finally: shutil.rmtree(temp_dir) + @unittest.skip('skip') @mock.patch('azure.cli.command_modules.acs.custom._urlretrieve') @mock.patch('azure.cli.command_modules.acs.custom.logger') def test_k8s_install_kubelogin_emit_warnings(self, logger_mock, mock_url_retrieve): @@ -679,6 +680,7 @@ def test_k8s_install_kubelogin_emit_warnings(self, logger_mock, mock_url_retriev finally: shutil.rmtree(temp_dir) + @unittest.skip('skip') @mock.patch('azure.cli.command_modules.acs.custom._urlretrieve') @mock.patch('azure.cli.command_modules.acs.custom.logger') def test_k8s_install_kubelogin_create_installation_dir(self, logger_mock, mock_url_retrieve): From acbdbc6ac76656f98a50852e5cae57fc6d419477 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Thu, 13 Aug 2020 14:02:22 +0800 Subject: [PATCH 56/70] fix style error --- src/azure-cli/azure_cli_bdist_wheel.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/azure-cli/azure_cli_bdist_wheel.py b/src/azure-cli/azure_cli_bdist_wheel.py index 65d157a9ce3..8a2d18edb2e 100644 --- a/src/azure-cli/azure_cli_bdist_wheel.py +++ b/src/azure-cli/azure_cli_bdist_wheel.py @@ -1,8 +1,8 @@ -#------------------------------------------------------------------------- +# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- from distutils.command.build_py import build_py From 6b5db1a74cd471ba65d4b5243695339b34bfda96 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Mon, 17 Aug 2020 11:07:27 +0800 Subject: [PATCH 57/70] skip config tests --- .../azure/cli/command_modules/config/tests/latest/test_config.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/azure-cli/azure/cli/command_modules/config/tests/latest/test_config.py b/src/azure-cli/azure/cli/command_modules/config/tests/latest/test_config.py index e1fb7395d28..d882386d6aa 100644 --- a/src/azure-cli/azure/cli/command_modules/config/tests/latest/test_config.py +++ b/src/azure-cli/azure/cli/command_modules/config/tests/latest/test_config.py @@ -13,6 +13,7 @@ class ConfigTest(ScenarioTest): + @unittest.skip('skip') def test_config(self): # [test_section1] From b254fdbeaa3c9ee6fd11ffcd70c064e2d4551f4c Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Mon, 17 Aug 2020 13:29:18 +0800 Subject: [PATCH 58/70] fix config test MAC error --- .../cli/command_modules/config/tests/latest/test_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/config/tests/latest/test_config.py b/src/azure-cli/azure/cli/command_modules/config/tests/latest/test_config.py index d882386d6aa..a004ae00f57 100644 --- a/src/azure-cli/azure/cli/command_modules/config/tests/latest/test_config.py +++ b/src/azure-cli/azure/cli/command_modules/config/tests/latest/test_config.py @@ -13,7 +13,6 @@ class ConfigTest(ScenarioTest): - @unittest.skip('skip') def test_config(self): # [test_section1] @@ -25,6 +24,7 @@ def test_config(self): # C:\Users\{username}\AppData\Local\Temp tempdir = tempfile.gettempdir() + tempdir = os.path.realpath(tempdir) original_path = os.getcwd() os.chdir(tempdir) print("Using temp dir: {}".format(tempdir)) From 866972d3553e908d75f0e38efeda66c2fccfc803 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Mon, 17 Aug 2020 14:49:51 +0800 Subject: [PATCH 59/70] fix role config test error --- .../command_modules/role/tests/latest/test_role.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/role/tests/latest/test_role.py b/src/azure-cli/azure/cli/command_modules/role/tests/latest/test_role.py index 80ad5adae39..7eb564695fc 100644 --- a/src/azure-cli/azure/cli/command_modules/role/tests/latest/test_role.py +++ b/src/azure-cli/azure/cli/command_modules/role/tests/latest/test_role.py @@ -392,15 +392,15 @@ def test_role_assignment_handle_conflicted_assignments(self, resource_group): base_dir = os.path.abspath(os.curdir) try: - temp_dir = self.create_temp_dir() + temp_dir = os.path.realpath(self.create_temp_dir()) os.chdir(temp_dir) self.cmd('configure --default group={rg} --scope local') - local_defaults_config = self.cmd('configure --list-defaults --scope local', checks=[ - self.check('length([])', 1), - self.check('[0].name', 'group'), - self.check('[0].value', '{rg}') - ]).get_output_in_json() - self.assertTrue(temp_dir.lower() in local_defaults_config[0]['source'].lower()) + local_defaults_config = self.cmd('configure --list-defaults --scope local').get_output_in_json() + + self.assertGreaterEqual(len(local_defaults_config), 1) + actual = set([(x['name'], x['resource'], x['value']) for x in local_defaults_config if x['name'] == 'group']) + expected = set([('group', temp_dir.lower(), self.kwargs['rg'])]) + self.assertTrue(actual == expected) # test role assignments on a resource group rg_id = self.cmd('group show -n {rg}').get_output_in_json()['id'] From ded0f26101793e949ee62b357fb9bfe83e4e21d4 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Mon, 17 Aug 2020 15:03:08 +0800 Subject: [PATCH 60/70] fix test error --- .../cli/command_modules/role/tests/latest/test_role.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/role/tests/latest/test_role.py b/src/azure-cli/azure/cli/command_modules/role/tests/latest/test_role.py index 7eb564695fc..91330079d0b 100644 --- a/src/azure-cli/azure/cli/command_modules/role/tests/latest/test_role.py +++ b/src/azure-cli/azure/cli/command_modules/role/tests/latest/test_role.py @@ -398,9 +398,9 @@ def test_role_assignment_handle_conflicted_assignments(self, resource_group): local_defaults_config = self.cmd('configure --list-defaults --scope local').get_output_in_json() self.assertGreaterEqual(len(local_defaults_config), 1) - actual = set([(x['name'], x['resource'], x['value']) for x in local_defaults_config if x['name'] == 'group']) - expected = set([('group', temp_dir.lower(), self.kwargs['rg'])]) - self.assertTrue(actual == expected) + actual = set([(x['name'], x['source'], x['value']) for x in local_defaults_config if x['name'] == 'group']) + expected = set([('group', os.path.join(temp_dir, '.azure', 'config'), self.kwargs['rg'])]) + self.assertEqual(actual, expected) # test role assignments on a resource group rg_id = self.cmd('group show -n {rg}').get_output_in_json()['id'] From 7e2fe75f6de77ce97c55e64dbd174f3848f33bdf Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Mon, 17 Aug 2020 16:17:09 +0800 Subject: [PATCH 61/70] fix test error --- .../acs/tests/latest/test_custom.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_custom.py b/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_custom.py index 9c14f33af00..2a9090a06ae 100644 --- a/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_custom.py +++ b/src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_custom.py @@ -665,13 +665,12 @@ def test_k8s_install_kubectl_create_installation_dir(self, logger_mock, mock_url finally: shutil.rmtree(temp_dir) - @unittest.skip('skip') @mock.patch('azure.cli.command_modules.acs.custom._urlretrieve') @mock.patch('azure.cli.command_modules.acs.custom.logger') def test_k8s_install_kubelogin_emit_warnings(self, logger_mock, mock_url_retrieve): mock_url_retrieve.side_effect = create_kubelogin_zip try: - temp_dir = tempfile.mkdtemp() # tempfile.TemporaryDirectory() is no available on 2.7 + temp_dir = os.path.realpath(tempfile.mkdtemp()) # tempfile.TemporaryDirectory() is no available on 2.7 test_location = os.path.join(temp_dir, 'kubelogin') k8s_install_kubelogin(mock.MagicMock(), client_version='0.0.4', install_location=test_location) self.assertEqual(mock_url_retrieve.call_count, 1) @@ -680,7 +679,6 @@ def test_k8s_install_kubelogin_emit_warnings(self, logger_mock, mock_url_retriev finally: shutil.rmtree(temp_dir) - @unittest.skip('skip') @mock.patch('azure.cli.command_modules.acs.custom._urlretrieve') @mock.patch('azure.cli.command_modules.acs.custom.logger') def test_k8s_install_kubelogin_create_installation_dir(self, logger_mock, mock_url_retrieve): @@ -698,9 +696,16 @@ def create_kubelogin_zip(file_url, download_path): import zipfile try: cwd = os.getcwd() - temp_dir = tempfile.mkdtemp() + temp_dir = os.path.realpath(tempfile.mkdtemp()) os.chdir(temp_dir) - bin_dir = 'bin/linux_amd64' + bin_dir = 'bin' + system = platform.system() + if system == 'Windows': + bin_dir += '/windows_amd64' + elif system == 'Linux': + bin_dir += '/linux_amd64' + elif system == 'Darwin': + bin_dir += '/darwin_amd64' os.makedirs(bin_dir) bin_location = os.path.join(bin_dir, 'kubelogin') open(bin_location, 'a').close() From 16f6aff90e7ec978af1a67ca45bc0592caafd8f8 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Mon, 17 Aug 2020 17:08:59 +0800 Subject: [PATCH 62/70] workaround for vsts bug --- scripts/release/homebrew/test_homebrew_package.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/release/homebrew/test_homebrew_package.sh b/scripts/release/homebrew/test_homebrew_package.sh index a699520fac2..f53bd82aa21 100755 --- a/scripts/release/homebrew/test_homebrew_package.sh +++ b/scripts/release/homebrew/test_homebrew_package.sh @@ -22,5 +22,8 @@ pip install pytest-xdist --prefix $AZ_BASE find ./artifacts/build -name "azure_cli_testsdk*" | xargs pip install --prefix $AZ_BASE --upgrade --ignore-installed find ./artifacts/build -name "azure_cli_fulltest*" | xargs pip install --prefix $AZ_BASE --upgrade --ignore-installed --no-deps +# workaround for this bug (https://github.com/microsoft/azure-devops-python-api/issues/354) +mkdir -p ~/.vsts/python-sdk/cache + PYTHON_VERSION=`ls $AZ_BASE/lib/ | head -n 1` python ./scripts/release/homebrew/test_homebrew_package.py $AZ_BASE $PYTHON_VERSION \ No newline at end of file From 31e7934f0ad4516e54c51783820d87d46bbddd89 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Mon, 17 Aug 2020 17:42:41 +0800 Subject: [PATCH 63/70] fix test error --- scripts/release/rpm/test_rpm_package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/release/rpm/test_rpm_package.py b/scripts/release/rpm/test_rpm_package.py index 78eec9817b5..47b4ee27afb 100644 --- a/scripts/release/rpm/test_rpm_package.py +++ b/scripts/release/rpm/test_rpm_package.py @@ -23,5 +23,5 @@ elif exit_code != 0: sys.exit(exit_code) -exit_code = subprocess.call(['{} --junit-xml /azure_cli_test_result/azure-cli-core.xml --pyargs azure.cli.core'.format(pytest_parallel_cmd)], shell=True) +exit_code = subprocess.call(['{} --junit-xml /azure_cli_test_result/azure-cli-core.xml --pyargs azure.cli.core'.format(pytest_base_cmd)], shell=True) sys.exit(exit_code) From 5c2a43d2f5f3893611e55b95aa2ccf0cf9de6690 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Tue, 18 Aug 2020 09:58:43 +0800 Subject: [PATCH 64/70] fix homebrew test error --- scripts/release/homebrew/test_homebrew_package.py | 2 +- scripts/release/rpm/test_rpm_package.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/release/homebrew/test_homebrew_package.py b/scripts/release/homebrew/test_homebrew_package.py index 8fd11922d1e..c9f38235a82 100644 --- a/scripts/release/homebrew/test_homebrew_package.py +++ b/scripts/release/homebrew/test_homebrew_package.py @@ -30,5 +30,5 @@ elif exit_code != 0: sys.exit(exit_code) -exit_code = subprocess.call(['{} --junit-xml ./azure_cli_test_result/azure-cli-core.xml --pyargs azure.cli.core'.format(pytest_parallel_cmd)], shell=True) +exit_code = subprocess.call(['{} --junit-xml ./azure_cli_test_result/azure-cli-core.xml --pyargs azure.cli.core'.format(pytest_base_cmd)], shell=True) sys.exit(exit_code) diff --git a/scripts/release/rpm/test_rpm_package.py b/scripts/release/rpm/test_rpm_package.py index 47b4ee27afb..78eec9817b5 100644 --- a/scripts/release/rpm/test_rpm_package.py +++ b/scripts/release/rpm/test_rpm_package.py @@ -23,5 +23,5 @@ elif exit_code != 0: sys.exit(exit_code) -exit_code = subprocess.call(['{} --junit-xml /azure_cli_test_result/azure-cli-core.xml --pyargs azure.cli.core'.format(pytest_base_cmd)], shell=True) +exit_code = subprocess.call(['{} --junit-xml /azure_cli_test_result/azure-cli-core.xml --pyargs azure.cli.core'.format(pytest_parallel_cmd)], shell=True) sys.exit(exit_code) From fec21db7a33882da3c86bf1aa55a9138bd04f436 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Tue, 18 Aug 2020 10:41:21 +0800 Subject: [PATCH 65/70] fix configure test error --- scripts/release/homebrew/test_homebrew_package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/release/homebrew/test_homebrew_package.py b/scripts/release/homebrew/test_homebrew_package.py index c9f38235a82..447520c2da4 100644 --- a/scripts/release/homebrew/test_homebrew_package.py +++ b/scripts/release/homebrew/test_homebrew_package.py @@ -21,7 +21,7 @@ pytest_parallel_cmd = '{} -n auto'.format(pytest_base_cmd) for mod_name in mod_list: - if mod_name in ['botservice', 'network']: + if mod_name in ['botservice', 'network', 'configure']: exit_code = subprocess.call(['{} --junit-xml ./azure_cli_test_result/{}.xml --pyargs azure.cli.command_modules.{}'.format(pytest_base_cmd, mod_name, mod_name)], shell=True) else: exit_code = subprocess.call(['{} --junit-xml ./azure_cli_test_result/{}.xml --pyargs azure.cli.command_modules.{}'.format(pytest_parallel_cmd, mod_name, mod_name)], shell=True) From b35b76702f6488328ec58a99c5dfec14b5f79fc2 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Tue, 18 Aug 2020 14:08:06 +0800 Subject: [PATCH 66/70] update homebrew package job timeout value --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 69ee4bf377b..576fd0fcd99 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -574,7 +574,7 @@ jobs: - job: TestHomebrewPackage displayName: Test Homebrew Package - + timeoutInMinutes: 120 dependsOn: BuildHomebrewFormula condition: succeeded() pool: From 5ccc96cc4aa975f134d4f20e08e8b27ddc23edcc Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Wed, 19 Aug 2020 11:36:47 +0800 Subject: [PATCH 67/70] use released azdev --- .azure-pipelines/templates/azdev_setup.yml | 2 +- build_scripts/windows/scripts/build.cmd | 2 -- src/azure-cli/azure/cli/__main__.py | 3 --- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/.azure-pipelines/templates/azdev_setup.yml b/.azure-pipelines/templates/azdev_setup.yml index 5aa23e8703b..d33ae283d6d 100644 --- a/.azure-pipelines/templates/azdev_setup.yml +++ b/.azure-pipelines/templates/azdev_setup.yml @@ -14,7 +14,7 @@ steps: chmod +x env/bin/activate . env/bin/activate - pip install -q git+https://github.com/Azure/azure-cli-dev-tools.git@pep420 + pip install -q azdev==0.1.25 azdev --version if [ -z "$CLI_EXT_REPO_PATH" ]; then diff --git a/build_scripts/windows/scripts/build.cmd b/build_scripts/windows/scripts/build.cmd index 5ccb0031a23..5479ca84c24 100644 --- a/build_scripts/windows/scripts/build.cmd +++ b/build_scripts/windows/scripts/build.cmd @@ -97,8 +97,6 @@ for %%a in (%CLI_SRC%\azure-cli %CLI_SRC%\azure-cli-core %CLI_SRC%\azure-cli-tel if %errorlevel% neq 0 goto ERROR -%BUILDING_DIR%\python.exe -m pip install --no-warn-script-location --force-reinstall urllib3==1.24.2 - pushd %BUILDING_DIR% %BUILDING_DIR%\python.exe %~dp0\patch_models_v2.py popd diff --git a/src/azure-cli/azure/cli/__main__.py b/src/azure-cli/azure/cli/__main__.py index 20ef665b7f3..50b4b96af80 100644 --- a/src/azure-cli/azure/cli/__main__.py +++ b/src/azure-cli/azure/cli/__main__.py @@ -19,9 +19,6 @@ __author__ = "Microsoft Corporation " __version__ = "2.10.1" -# Log the start time -# TODO: Disable E402 "Module level import not at top of file" so that imports can also be timed -start_time = timeit.default_timer() # A workaround for https://bugs.python.org/issue32502 (https://github.com/Azure/azure-cli/issues/5184) # If uuid1 raises ValueError, use uuid4 instead. From 12403e8da9c62c7fcf8cd9e533b12966d1914c5e Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Wed, 19 Aug 2020 13:43:08 +0800 Subject: [PATCH 68/70] rollback pipelines --- azure-pipelines.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 576fd0fcd99..cc7ae86bce0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -485,7 +485,7 @@ jobs: displayName: Build Homebrew Formula dependsOn: BuildPythonWheel - condition: succeeded() + condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual')) pool: vmImage: 'ubuntu-16.04' steps: @@ -576,7 +576,7 @@ jobs: displayName: Test Homebrew Package timeoutInMinutes: 120 dependsOn: BuildHomebrewFormula - condition: succeeded() + condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual')) pool: vmImage: 'macOS-10.14' steps: @@ -603,7 +603,7 @@ jobs: displayName: Build Yum Package dependsOn: BuildPythonWheel - condition: succeeded() + condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual')) pool: vmImage: 'ubuntu-16.04' steps: @@ -624,7 +624,7 @@ jobs: displayName: Test Yum Package dependsOn: BuildYumPackage - condition: succeeded() + condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual')) pool: vmImage: 'ubuntu-16.04' steps: @@ -660,7 +660,7 @@ jobs: displayName: Build Ubuntu Packages dependsOn: BuildPythonWheel - condition: succeeded() + condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual')) pool: vmImage: 'ubuntu-16.04' strategy: @@ -701,7 +701,7 @@ jobs: displayName: Build Debian Packages dependsOn: BuildPythonWheel - condition: succeeded() + condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual')) pool: vmImage: 'ubuntu-16.04' strategy: From ede06e093fa83bcdd7b1b3ea625810f213a41f43 Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Wed, 19 Aug 2020 13:45:11 +0800 Subject: [PATCH 69/70] rollback pipelines 2 --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index cc7ae86bce0..21b9b248100 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -741,7 +741,7 @@ jobs: dependsOn: - BuildUbuntuPackages - BuildDebianPackages - condition: succeeded() + condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual')) pool: vmImage: 'ubuntu-16.04' steps: From 320bd067f9eca3b199d08419dc7c85b32ef222ee Mon Sep 17 00:00:00 2001 From: Xiaojian Xu Date: Wed, 19 Aug 2020 16:03:54 +0800 Subject: [PATCH 70/70] refactor config test --- .../cli/command_modules/config/tests/latest/test_config.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/config/tests/latest/test_config.py b/src/azure-cli/azure/cli/command_modules/config/tests/latest/test_config.py index a004ae00f57..4b149d94385 100644 --- a/src/azure-cli/azure/cli/command_modules/config/tests/latest/test_config.py +++ b/src/azure-cli/azure/cli/command_modules/config/tests/latest/test_config.py @@ -23,8 +23,7 @@ def test_config(self): # test_option22 = test_value22 # C:\Users\{username}\AppData\Local\Temp - tempdir = tempfile.gettempdir() - tempdir = os.path.realpath(tempdir) + tempdir = os.path.realpath(tempfile.gettempdir()) # call realpath to handle soft link problem on MAC original_path = os.getcwd() os.chdir(tempdir) print("Using temp dir: {}".format(tempdir))