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

Verify briefcase.integrations.__all__ is accurate #972

Merged
merged 2 commits into from
Nov 18, 2022

Conversation

rmartin16
Copy link
Member

@rmartin16 rmartin16 commented Nov 15, 2022

After I merged the ToolCache typing changes in to my Windows codesigning PR, I expected the new tests to fail. When they didn't fail, adding this additional check seemed prudent....since we're already this far in.

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

@rmartin16 rmartin16 changed the title Verify briefcase.integrations.__all__ is accurate Verify briefcase.integrations.__all__ is accurate Nov 15, 2022
@rmartin16 rmartin16 force-pushed the additional-tool-type-check branch from 5308cbf to 0707130 Compare November 15, 2022 02:02
@rmartin16 rmartin16 marked this pull request as ready for review November 15, 2022 02:11
@rmartin16 rmartin16 marked this pull request as draft November 15, 2022 02:20
@rmartin16
Copy link
Member Author

Actually....do not merge this.

The call to inspect.getmembers() operates on briefcase.integrations.__dict__.....which is influenced by the setting of briefcase.integrations.__all__.

I'll need to investigate further....something like pkgutil.iter_modules looks promising.

@rmartin16
Copy link
Member Author

Ok. pkgutil reports all modules in a package.

>>> pprint(list(m.name for m in pkgutil.iter_modules([os.path.dirname(briefcase.integrations.__file__)])))
['android_sdk',
 'base',
 'cookiecutter',
 'docker',
 'download',
 'flatpak',
 'git',
 'java',
 'linuxdeploy',
 'rcedit',
 'subprocess',
 'windows_sdk',
 'wix',
 'xcode']

Unlike inspect.getmembers():

>>> for module, _ in inspect.getmembers(sys.modules[f"briefcase.integrations"], inspect.ismodule):
...     if module not in nontool_modules:
...         print(f"{module=}")
...
module='android_sdk'
module='cookiecutter'
module='docker'
module='download'
module='flatpak'
module='git'
module='java'
module='linuxdeploy'
module='rcedit'
module='subprocess'
module='visualstudio'
module='wix'
module='xcode'

@rmartin16 rmartin16 marked this pull request as ready for review November 15, 2022 02:52
Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

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

👍 A good safety check to add - thanks!

@freakboy3742 freakboy3742 merged commit bcb1daa into beeware:main Nov 18, 2022
@rmartin16 rmartin16 deleted the additional-tool-type-check branch November 18, 2022 16:18
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.

2 participants