Conan: Conan install ignores top-level hooks

Created on 28 Jan 2019  ยท  8Comments  ยท  Source: conan-io/conan

To help us debug your issue please explain:

  • [x] I've read the CONTRIBUTING guide.
  • [x] I've specified the Conan version, operating system version and any tool that can be relevant.
  • [x] I've explained the steps to reproduce the error or the motivation/use case of the question/suggestion.

I'm using Conan version 1.11.2 on Windows 10. While trying out the new "hooks" feature I had problems installing them using "conan install".

I did the following:

  • Create a folder with the following folder structure
โ”œโ”€โ”€ hooks
โ”‚   โ”œโ”€โ”€ my-hook.py
โ”‚   
โ””โ”€โ”€ conan.conf
  • Call conan config install myconfig

I would expect, that the "my-hook.py" will be copied in to the ".conan/hooks" directory.
Instead, nothing is copied.

I noticed, that it works, if the hook is in a subfolder, i.e. a structure like

โ”œโ”€โ”€ hooks
โ”‚   โ”œโ”€โ”€ my-hook
โ”‚       |---- my-hook.py
โ””โ”€โ”€ conan.conf

is copied properly.

Did I miss something? Is it now required to use subfolders in the hooks directory?

Feedback please!

Most helpful comment

Thanks a lot. Its awesome how fast you guys react!
The fix also looks good as far as I can tell.

All 8 comments

Hi @jokoala !

Hooks are considered part of Conan client, so the best option is conan config as described on Hooks documentation:

https://docs.conan.io/en/latest/extending/hooks.html#storage-activation-and-sharing

Regards!

Citing from the page you mentioned.

Hooks are considered part of the Conan client configuration and can be shared as usual with the conan config install command.

This is the reason I experimented with conan config install. I want to roll out a certain hook to all developers on my project.

Sorry, you listed conan install, it's another command.

Now I'm confuse, did you run conan install myconfig or conan config install myconfig ?

Oh, sorry, my mistake. I've updated my request. I ran conan config install as described and it is unable to copy the files, if there is a flat file hierarchy inside the "hooks" folder.

Seems like there is a bug when installing hooks by conan config install. I can reproduce your error:

mkdir -p foo/hooks
touch foo/hooks/dummy.py
conan config install foo
Installing hooks:

Nothing is copied.

Thanks a lot. Its awesome how fast you guys react!
The fix also looks good as far as I can tell.

I tried the new conan version and it seems to behave correctly. Shall I close the issue or is there an automatic process doing that?

You can close it now, thanks for your feedback!

Was this page helpful?
0 / 5 - 0 ratings