Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{CI} Fix #5408: Miss a __init__.py file in src/reservation/azext_reservation/vendored_sdks directory #5421

Merged
merged 3 commits into from
Oct 7, 2022

Conversation

wangzelin007
Copy link
Member

@wangzelin007 wangzelin007 commented Oct 6, 2022

The pull request #5408 miss a __init__.py file in src/reservation/azext_reservation/vendored_sdks directory.
So the vendored_sdks directory will not include when buliding wheel package.
That will cause azure-cli pipeline error:

    invoker.commands_loader.load_arguments()
  File "/opt/hostedtoolcache/Python/3.10.7/x64/lib/python3.10/site-packages/azure/cli/core/__init__.py", line 502, in load_arguments
    cmd.load_arguments()  # this loads the arguments via reflection
  File "/opt/hostedtoolcache/Python/3.10.7/x64/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 318, in load_arguments
    super(AzCliCommand, self).load_arguments()
  File "/opt/hostedtoolcache/Python/3.10.7/x64/lib/python3.10/site-packages/knack/commands.py", line 104, in load_arguments
    cmd_args = self.arguments_loader()
  File "/opt/hostedtoolcache/Python/3.10.7/x64/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 125, in arguments_loader
    op = self.get_op_handler(self.op_path)
  File "/opt/hostedtoolcache/Python/3.10.7/x64/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 59, in get_op_handler
    handler = import_module(mod_to_import)
  File "/opt/hostedtoolcache/Python/3.10.7/x64/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'azext_reservation.vendored_sdks'

and azure-cli-extension pipeline error:

======================================================================
ERROR: test_ref_doc_reservation (__main__.IndexRefDocs)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/mnt/vss/_work/1/s/./scripts/ci/index_ref_doc.py", line 65, in test
    raise e
  File "/mnt/vss/_work/1/s/./scripts/ci/index_ref_doc.py", line 62, in test
    check_call(script_args)
  File "/opt/hostedtoolcache/Python/3.10.7/x64/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/opt/hostedtoolcache/Python/3.10.7/x64/bin/python', '/mnt/vss/_work/1/s/scripts/refdoc/generate.py', '--extension-file', '/tmp/tmp555o1sit/reservation-0.1.0-py3-none-any.whl', '--output-dir', '/tmp/tmpcw7mvox6/reservation']' returned non-zero exit status 1.

Test screenshot:
before change
image
after change
image

@ghost ghost added Auto-Assign Auto assign by bot CI labels Oct 6, 2022
@ghost ghost requested a review from yonzhan October 6, 2022 06:09
@ghost ghost assigned wangzelin007 Oct 6, 2022
@ghost ghost added this to the Oct 2022 (2022-11-01) milestone Oct 6, 2022
@wangzelin007 wangzelin007 changed the title {CI} Fix pull request #5408 {CI} Fix #5408: missing a __init__.py file in src/reservation/azext_reservation/vendored_sdks directory Oct 6, 2022
@wangzelin007 wangzelin007 changed the title {CI} Fix #5408: missing a __init__.py file in src/reservation/azext_reservation/vendored_sdks directory {CI} Fix #5408: Missing a __init__.py file in src/reservation/azext_reservation/vendored_sdks directory Oct 6, 2022
@wangzelin007 wangzelin007 changed the title {CI} Fix #5408: Missing a __init__.py file in src/reservation/azext_reservation/vendored_sdks directory {CI} Fix #5408: Miss a __init__.py file in src/reservation/azext_reservation/vendored_sdks directory Oct 6, 2022
# regenerated.
# --------------------------------------------------------------------------

__path__ = __import__('pkgutil').extend_path(__path__, __name__)
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps an empty __init__.py will work? Since this vendored_sdks doesn't need to be a namespace package.

Copy link
Member Author

@wangzelin007 wangzelin007 Oct 7, 2022

Choose a reason for hiding this comment

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

I copied this file from another extension just to be safe.
There is no problem with using an empty __init__.py file.

@yonzhan
Copy link
Collaborator

yonzhan commented Oct 6, 2022

Really good catch!

@zhoxing-ms zhoxing-ms mentioned this pull request Oct 6, 2022
3 tasks
@wangzelin007 wangzelin007 merged commit de9254e into Azure:main Oct 7, 2022
@azclibot
Copy link
Collaborator

azclibot commented Oct 7, 2022

[Release] Update index.json for extension [ reservation ] : https://dev.azure.com/azclitools/internal/_build/results?buildId=7493&view=results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants