NICHOLAS85 / z-a-eval

A Zsh-Zinit annex (i.e. an extension), which caches arbitrarily slow command output to speed up shell startup.
Other
22 stars 7 forks source link

No files for compliation found #4

Open HeroCC opened 9 months ago

HeroCC commented 9 months ago
# before
zinit lucid wait has'pyenv-virtualenv-init' atclone'pyenv virtualenv-init - > pyenv-venv.zsh' atpull'%atclone' pick'pyenv-venv.zsh' nocompile'!' id-as'pyenv-venv2' for @zdharma-continuum/null

Downloading zdharma-continuum/null… (at label: pyenv-venv2…)
Cloning into '$HOME/.local/share/zinit/plugins/pyenv-venv2'...
==> Compiling pyenv-venv.zsh [OK]

# after 
zinit lucid wait has'pyenv-virtualenv-init' eval'pyenv virtualenv-init -' id-as'pyenv-venv1' for @zdharma-continuum/null

Downloading zdharma-continuum/null… (at label: pyenv-venv1…)
Cloning into '$HOME/.local/share/zinit/plugins/pyenv-venv1'...
==> No files for compilation found
Warning: ∞zinit-compile-plugin-hook hook returned with 1
[eval] Caching output of (`pyenv virtualenv-init -…')

I notice the "No files for compilation found" warning when using the eval ice. However, the zwc file does exist:

ls $HOME/.local/share/zinit/plugins/pyenv-venv1
LICENSE.md  evalcache.zsh  evalcache.zsh.zwc  readme.md

Is there a way to make sure zinit loaded the complied version? Is this error benign / can it be fixed?

NICHOLAS85 commented 9 months ago

Zinit by default attempts to compile a plugin before the atclone ice runs. In your original command, you used the ice nocompile'!', which forces compilation to occur after your atclone ice.

When using zdharma-continuum/null, Zinit throws that error by default due to no files being available to compile, this may be a bug/feature introduced at some point as I believe Zinit used to not throw this error when using zdharma-continuum/null

The cache generation in z-a-eval runs during the atclone process of loading a plugin and thus when used with zdharma-continuum/null Zinit attempts to compile the plugin before z-a-eval creates the cache. To avoid this error message for now, you can add nocompile'!' as you used in your first example.

zinit lucid wait has'pyenv-virtualenv-init' eval'pyenv virtualenv-init -' nocompile'!' id-as'pyenv-venv1' for @zdharma-continuum/null

Regardless the message is harmless as the cache is still being sourced during a plugin load and Zsh always uses the compiled version when it is available. I'll do some research to see if there is anything I can do about the error but the above should solve your problem if you care about hiding that error message.

HeroCC commented 9 months ago

Great, thank you! I'll leave the ticket open for your investigation, but your workaround worked successfully.