Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions doc/sphinx/azhelpgen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@
# 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__)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why it declares namespace package. This does not look like a namespace package at all.

2 changes: 0 additions & 2 deletions doc/sphinx/cligroup/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@
# 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__)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The doc\sphinx\ folder appears related to documentation generation but hasn't been updated in a long time.

Confirmed with doc team, they only use doc\sphinx\azhelpgen\doc_source_map.json

Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@
# 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__)
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@
# 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__)
4 changes: 2 additions & 2 deletions tools/automation/verify/verify_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import filecmp
import logging
import unittest
from pkg_resources import working_set
from importlib.metadata import distributions
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

def distributions(**kwargs):
    """Get all ``Distribution`` instances in the current environment.

    :return: An iterable of ``Distribution`` instances.
    """
    return Distribution.discover(**kwargs)

Distribution doc: https://docs.python.org/3/library/importlib.metadata.html#distributions

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

importlib.metadata.distributions is not even documented by https://docs.python.org/3.15/library/importlib.metadata.html


import automation.utilities.path as automation_path
from automation.utilities.const import COMMAND_MODULE_PREFIX
Expand Down Expand Up @@ -48,7 +48,7 @@ def test_azure_cli_installation(self):
def test_azure_cli_module_installation(self):
expected_modules = set([n for n, _ in automation_path.get_command_modules_paths(include_prefix=True)])

installed_command_modules = [dist.key for dist in list(working_set) if dist.key.startswith(COMMAND_MODULE_PREFIX)]
installed_command_modules = [dist.metadata['Name'] for dist in distributions() if dist.metadata['Name'].startswith(COMMAND_MODULE_PREFIX)]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dist's type is importlib.metadata.PathDistribution, but this class is not documented by https://docs.python.org/3.15/library/importlib.metadata.html either.

Another way to access the name of the distribution is dist.name. Actually, importlib.metadata.Distribution.name is defined as

    @property
    def name(self):
        """Return the 'Name' metadata for the distribution package."""
        return self.metadata['Name']


logger.info('Installed command modules %s', installed_command_modules)

Expand Down