Skip to content

Commit

Permalink
Change the automation code (#1660)
Browse files Browse the repository at this point in the history
* Change the automation code

1. Install automation code as development package
2. Add PEP8 scripts to fix PEP8 automatically

* Fix typo in automation.style.pep8
  • Loading branch information
troydai authored Jan 6, 2017
1 parent b506d12 commit 69d026a
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 4 deletions.
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 29 additions & 0 deletions scripts/automation/style/pep8.py
Original file line number Diff line number Diff line change
@@ -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 <directory>')
sys.exit(1)

fix_p2p8(sys.argv[1])
4 changes: 4 additions & 0 deletions scripts/dev_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

root_dir = os.path.abspath(os.path.join(os.path.abspath(__file__), '..', '..'))


def exec_command(command):
try:
print('Executing: ' + command)
Expand All @@ -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')
Expand Down
1 change: 0 additions & 1 deletion scripts/run_coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion scripts/run_pylint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion scripts/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
50 changes: 50 additions & 0 deletions scripts/setup.py
Original file line number Diff line number Diff line change
@@ -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
)

0 comments on commit 69d026a

Please sign in to comment.