Skip to content

Conversation

@fengzhou-msft
Copy link
Member

Description

az extension add -n rdbms-connect failed with the latest MSI. It's caused by the removal of dist-info folder of setuptools,
failing the installation of the configobject package from source code. The entry_points.txt file under dist-info folder of setuptools is needed during python source package installation. Without it, the following error will be thrown:

Running command python setup.py egg_info
C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'install_requires'
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'egg_info'

There are also some other packages that use entry_points.txt. This PR changes the packaging script to only remove dist-info folder of azure packages which should only have some metadata and not used when the packages are called.

Testing Guide

Download and install the MSI in this PR and run az extension add -n rdbms-connect.

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change.
[Component Name 2] az command b: Add some customer-facing feature.


This checklist is used to make sure that common guidelines for a pull request are followed.

@fengzhou-msft fengzhou-msft changed the title {Packaging} Hotfix: Only remove dist-info for azure packages {Packaging} Hotfix: Only remove dist-info for azure packages in MSI Mar 24, 2021
Comment on lines +39 to +44
#az self-test --debug
#if [ $? != 0 ]
#then
# exit_code=1
# echo "Failed to verify:" $ext
#fi
Copy link
Member Author

Choose a reason for hiding this comment

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

Comment az self-test as it cannot pass on ADO. The issue is caused by extensions azure-iot and arcappliance both have jsonschema dependency but with different versions. On ADO, azure-iot is now always installed before arcappliance (the install order is decided by os.listdir(ext_dir) which is related to the order of how files are stored in the file system). Their directory are both appended to sys.path, and azure-iot is in front of arcappliance. Therefore, in arcappliance, when importing jsonschema, it will import from the one (version 3.0.2) installed in azure-iot and this line of code caused an import issue: __version__ = get_distribution(__name__).version.

If on some system, arcappliance is installed before azure-iot, no error will be thrown as arcappliance uses jsonschema version 3.2.0 and the code to get version changes to __version__ = metadata.version("jsonschema").

Actually, az self-test should not load all extensions together, sys.path will append all extension directories, and causing issues like above for the same dependency but with different versions in different extensions.

Copy link
Member

Choose a reason for hiding this comment

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

The issue is caused by extensions azure-iot and arcappliance both have jsonschema dependency but with different versions.

Yes, azure-iot/jsonschema (3.0.2) overriding arcappliance/jsonschema (3.2.0) is an important contributing factor. I provided more detail at #17456

Actually, az self-test should not load all extensions together

It is possible for CLI to load multiple extensions at the same time - when command index has not been built yet.

@fengzhou-msft fengzhou-msft merged commit f721fd3 into Azure:release Mar 24, 2021
jiasli added a commit that referenced this pull request Mar 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants