diff --git a/requirements.txt b/requirements.txt index c8767dda4ca..61cba4bc9c3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,6 @@ adal==0.4.3 applicationinsights==0.10.0 argcomplete==1.3.0 colorama==0.3.7 -coverage==4.2 jmespath mock==1.3.0 nose==1.3.7 diff --git a/scripts/automation/style/pep8.py b/scripts/automation/style/pep8.py new file mode 100644 index 00000000000..2c44af06a31 --- /dev/null +++ b/scripts/automation/style/pep8.py @@ -0,0 +1,29 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +def fix_p2p8(directory): + import autopep8 + import multiprocessing + + autopep8.fix_multiple_files([directory], + options=autopep8._get_options( + { + 'jobs': multiprocessing.cpu_count(), + 'verbose': True, + 'recursive': True, + 'in_place': True, + 'max_line_length': 100 + }, False)) + + +if __name__ == '__main__': + import sys + + if len(sys.argv) < 2: + print('usage: python automation.style.pep8 ') + sys.exit(1) + + fix_p2p8(sys.argv[1]) diff --git a/scripts/dev_setup.py b/scripts/dev_setup.py index a854fe45b18..6bae103f496 100755 --- a/scripts/dev_setup.py +++ b/scripts/dev_setup.py @@ -13,6 +13,7 @@ root_dir = os.path.abspath(os.path.join(os.path.abspath(__file__), '..', '..')) + def exec_command(command): try: print('Executing: ' + command) @@ -28,6 +29,9 @@ def exec_command(command): # install general requirements exec_command('pip install -r requirements.txt') +# install automation package +exec_command('pip install -e ./scripts') + # command modules have dependency on azure-cli-core so install this first exec_command('pip install -e src/azure-cli-nspkg') exec_command('pip install -e src/azure-cli-core') diff --git a/scripts/run_coverage.sh b/scripts/run_coverage.sh index 44d0b509de9..fc46693bd12 100644 --- a/scripts/run_coverage.sh +++ b/scripts/run_coverage.sh @@ -5,5 +5,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -export PYTHONPATH=${PYTHONPATH}:$(cd $(dirname $0); pwd) python -m automation.coverage.run diff --git a/scripts/run_pylint.sh b/scripts/run_pylint.sh index 2ccc265bb36..0085c62e2b0 100755 --- a/scripts/run_pylint.sh +++ b/scripts/run_pylint.sh @@ -5,5 +5,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -export PYTHONPATH=${PYTHONPATH}:$(cd $(dirname $0); pwd) python -m automation.style.run diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh index e8aded94f33..ce0f69b46bd 100755 --- a/scripts/run_tests.sh +++ b/scripts/run_tests.sh @@ -5,5 +5,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -export PYTHONPATH=${PYTHONPATH}:$(cd $(dirname $0); pwd) python -m automation.tests.run diff --git a/scripts/setup.py b/scripts/setup.py new file mode 100644 index 00000000000..14619e481d7 --- /dev/null +++ b/scripts/setup.py @@ -0,0 +1,50 @@ +#!/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 setuptools import setup + +VERSION = "0.1.0" + +CLASSIFIERS = [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Intended Audience :: System Administrators', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'License :: OSI Approved :: MIT License', +] + +DEPENDENCIES = [ + 'autopep8==1.2.4', + 'coverage==4.2', + 'pycodestyle==2.2.0' +] + +setup( + name='automation', + version=VERSION, + description='Microsoft Azure Command-Line Tools - Automation Utility', + long_description='', + license='MIT', + author='Microsoft Corporation', + author_email='azpycli@microsoft.com', + url='https://github.com/Azure/azure-cli', + namespace_packages=[ + ], + packages=[ + 'automation', + 'automation.style', + 'automation.tests', + 'automation.setup', + 'automation.coverage' + ], + install_requires=DEPENDENCIES +)