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

Use correct attribute type instead of package_type #17943

Open
wants to merge 6 commits into
base: develop2
Choose a base branch
from

Conversation

NokiDev
Copy link

@NokiDev NokiDev commented Mar 11, 2025

Changelog: (Bugfix): _Component() has no package_type property #17942

  • Refer to the issue that supports this Pull Request.
  • If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
  • I've read the Contributing guide.
  • I've followed the PEP8 style guides for Python code.

@CLAassistant
Copy link

CLAassistant commented Mar 11, 2025

CLA assistant check
All committers have signed the CLA.

@memsharded
Copy link
Member

Hi @NokiDev

Thanks for your contribution. Lets start with the test that reproduces the issue first, as I have commented in #17942 (comment)

@NokiDev NokiDev changed the title Use correct property type instead of package_type Use correct attribute type instead of package_type Mar 12, 2025
@NokiDev NokiDev force-pushed the fix-wrong-property-usage-in-cmakedeps2 branch from fef0648 to 7777a0e Compare March 12, 2025 10:51
@@ -81,13 +81,16 @@ def _requires(self, info, components):
assert required_pkg == required_comp
comp = None
default_target = f"{dep.ref.name}::{dep.ref.name}" # replace_requires
link = pkg_type is not PackageType.SHARED
Copy link
Member

Choose a reason for hiding this comment

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

In the test that I added, this movement is not necessary.
If this is necessary for a different use case, it would be great to have yet another test that covers this scenario.

Copy link
Author

@NokiDev NokiDev Mar 12, 2025

Choose a reason for hiding this comment

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

You're right this is triggered by another use case, see new test added. That triggers the first condition dep_comp == None, and then crash when evaluating the link.

For that case evaluating the link only on the package_type seems the simpler way to fix this one

Copy link
Member

Choose a reason for hiding this comment

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

Ok, now with the test and the explanation is more clear, many thanks!
I have just fixed an indent error in the test, and CI is running.

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