Skip to content

Commit

Permalink
Performance: Stop using pkg_resources/declare_namespace (#2951)
Browse files Browse the repository at this point in the history
* Performance: fix up namespace

* Exclude azure_bdist_wheel.py from flak8 verification

* Ignore remaining azure_bdist_wheel.py files from flake8 and stop running pylint on azure-cli-nspkg namespace package

* Temporarily fix up flake8 script to exclude the azure_bdist_wheel.py files

* Add missing azure_bdist_wheel file for the testsdk

* Allow empty __init__.py files and exclude azure_bdist_wheel.py files from check for valid license header

* Add azure_bdist_wheel.py files to project file

* Bump minor version for all modules

* Accidentally bumped the dependency on the azure-nspkg to 3.0.0 or later (which obviously can't be found)

* Revert version bump - we'll do that when we release instead.

* Partial add of azure-cli-command_modules-nspkg to allow reuse of the same azure_bdist_wheel.py file that the azure sdk is using

* - Change things so we use an identical azure_bdist_wheel.py/setup.cfg file as the rest of the azure sdk. This required adding an azure-cli-command_modules-nspkg package since the sdk version uses the name of the package as the path in which to look for/exclude __init__.py files.

* Update actual name of src/azure-cli-command_modules-nspkg to azure-cli-command-module-nspkg since that makes setuptools happier.

* Stop building sdists

* Address code review feedback:
- set correct version requirement for azure-cli-nspkg in the command_modules nspkg setup.py
- Remove hard-coded dependency on azure cli nspkg from azure cli core and let the bdist_wheel extension added it required.
  • Loading branch information
johanste authored Apr 25, 2017
1 parent e2802f4 commit c1684ea
Show file tree
Hide file tree
Showing 104 changed files with 15,866 additions and 148 deletions.
44 changes: 44 additions & 0 deletions azure-cli.pyproj

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions scripts/automation/style/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

def run_pylint(modules):
print('\n\nRun pylint')
print('Modules: {}'.format(', '.join(name for name, _ in modules)))
print('Modules: {}'.format(', '.join([name for name, _ in modules if not name.endswith('-nspkg')])))

modules_list = ' '.join(os.path.join(path, 'azure') for _, path in modules)
modules_list = ' '.join([os.path.join(path, 'azure') for name, path in modules if not name.endswith('-nspkg')])
arguments = '{} --rcfile={} -j {} -r n -d I0013'.format(
modules_list,
os.path.join(automation_path.get_repo_root(), 'pylintrc'),
Expand All @@ -36,7 +36,7 @@ def run_pep8(modules):
print('\n\nRun flake8 for PEP8 compliance')
print('Modules: {}'.format(', '.join(name for name, _ in modules)))

command = 'flake8 --statistics --append-config={} {}'.format(
command = 'flake8 --statistics --exclude=azure_bdist_wheel.py --append-config={} {}'.format(
os.path.join(automation_path.get_repo_root(), '.flake8'),
' '.join(path for _, path in modules))

Expand Down
2 changes: 1 addition & 1 deletion scripts/automation/tests/verify_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def build_package(path_to_package, dist_dir):
print_heading('Building {}'.format(path_to_package))
path_to_setup = os.path.join(path_to_package, 'setup.py')
set_version(path_to_setup)
cmd_success = exec_command('python setup.py sdist -d {0} bdist_wheel -d {0}'.format(dist_dir), cwd=path_to_package)
cmd_success = exec_command('python setup.py bdist_wheel -d {0}'.format(dist_dir), cwd=path_to_package)
if not cmd_success:
print_heading('Error building {}!'.format(path_to_package), f=sys.stderr)
sys.exit(1)
Expand Down
2 changes: 1 addition & 1 deletion scripts/license/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ def get_files_without_header():
with open(cur_file_path, 'r') as f:
file_text = f.read()

if not contains_header(file_text):
if len(file_text) > 0 and not contains_header(file_text):
files_without_header.append((cur_file_path, file_text))
return files_without_header
2 changes: 1 addition & 1 deletion scripts/license/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from _common import get_files_without_header

files_without_header = [file_path for file_path, file_contents in get_files_without_header()]
files_without_header = [file_path for file_path, file_contents in get_files_without_header() if not file_path.endswith('azure_bdist_wheel.py')]

if files_without_header:
print("Error: The following files don't have the required license headers:", file=sys.stderr)
Expand Down
6 changes: 6 additions & 0 deletions src/azure-cli-command_modules-nspkg/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.. :changelog:
Release History
===============

* Initial release
1 change: 1 addition & 0 deletions src/azure-cli-command_modules-nspkg/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include *.rst
8 changes: 8 additions & 0 deletions src/azure-cli-command_modules-nspkg/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
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.
Empty file.
2 changes: 2 additions & 0 deletions src/azure-cli-command_modules-nspkg/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[bdist_wheel]
universal=1
51 changes: 51 additions & 0 deletions src/azure-cli-command_modules-nspkg/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/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.0+dev"

CLASSIFIERS = [
'Development Status :: 5 - Production/Stable',
'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',
'Programming Language :: Python :: 3.6',
'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'
],
)
2 changes: 0 additions & 2 deletions src/azure-cli-core/azure/cli/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
# --------------------------------------------------------------------------------------------
import pkg_resources
pkg_resources.declare_namespace(__name__)

__version__ = "2.0.3+dev"
Loading

0 comments on commit c1684ea

Please sign in to comment.