conan-io / hooks

Official Conan client hooks
MIT License
32 stars 46 forks source link

[conan-center] Accept self.info.clear() as header-only #442

Closed uilianries closed 2 years ago

uilianries commented 2 years ago

According to the migration guide, the self.info.clear() should be used to identify header-only recipes.

Documentation https://docs.conan.io/en/latest/migrating_to_2.0/recipes.html#the-package-id-method

danimtb commented 2 years ago

Moreover, we should add a migration check to the linter to use self.info.clear() instead of self.info.header_only()

uilianries commented 2 years ago

@danimtb Yes, but still, this change id needed anyway, otherwise, conan-center hook complains about self.info.clear() usage.

danimtb commented 2 years ago

@uilianries do you have an example of that? did it happen already?

uilianries commented 2 years ago

@danimtb Yes: https://github.com/conan-io/conan-center-index/pull/11981#issuecomment-1205022505

I needed to revert to self.info.header_only because Hooks didn't recognized my recipe as header-only and complained that was missing artifacts.

jgsogo commented 2 years ago

So self.info.header_only() is something that should never be used? The linter can just remove it from info object and syntax will complain

uilianries commented 2 years ago

So self.info.header_only() is something that should never be used? The linter can just remove it from info object and syntax will complain

As soon as we run Conan 1.50 on CCI, we can apply that rule with the linter.

jgsogo commented 2 years ago

We are already running 1.50.1, so it's something we can already add.

I see in Conan codebase:

class ConanInfo(object):
    ...

    # FIXME: Rename this to "clear" in 2.0
    def header_only(self):
        self.settings.clear()
        self.options.clear()
        self.requires.clear()

    clear = header_only
uilianries commented 2 years ago

We are already running 1.50.1, so it's something we can already add.

Yes, just in case you need to revert ... 😏

Anyway, I'm using self.info.clear() here and Conan Center, including linter, accepted.