FS#73024 - [python-black] Ship vim plugin from black source code on installation

Attached to Project: Community Packages
Opened by Matthew Armand (heylookmatt) - Tuesday, 14 December 2021, 16:32 GMT
Last edited by Maxim Baz (maximbaz) - Friday, 11 February 2022, 23:30 GMT
Task Type Feature Request
Category Packages
Status Closed
Assigned To Daniel M. Capella (polyzen)
Maxim Baz (maximbaz)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:

Upstream, Black's developers write and maintain a Vim plugin in the same code repository as the tool itself. However on installing with pacman, this is not included in the file list. Compare this to `fzf`, another program which co-develops an associated vim plugin, and IS packaged by the PKGBUILD for Arch.

Could we have the Black plugin shipped with the Arch Linux package in a similar way that fzf is?

Black upstream repo: https://github.com/psf/black/
Black vim plugin: https://github.com/psf/black/blob/main/plugin/black.vim
Black PKGBUILD: https://github.com/archlinux/svntogit-community/blob/packages/python-black/trunk/PKGBUILD
Black package file list: https://archlinux.org/packages/community/any/python-black/

Fzf upstream repo: https://github.com/junegunn/fzf
Fzf vim plugin: https://github.com/junegunn/fzf/blob/master/plugin/fzf.vim
Fzf PKGBUILD for vim plugin installation: https://github.com/archlinux/svntogit-community/blob/packages/fzf/trunk/PKGBUILD
Fzf package file list: https://archlinux.org/packages/community/x86_64/fzf/

Additional info:
* fzf version: 0.28.0-1
* black version: 21.12b0-2

Steps to reproduce: N/A, feature request

Using fzf as a template, I believe it'd be relatively easy and straightforward to do this with the following PKGBUILD changes:
* add vim to `optdepends` for the plugin
* In the `package` step, Add the following lines:

```
## Vim plugin
install -Dm644 plugin/black.vim "$pkgdir"/usr/share/vim/vimfiles/plugin/black.vim
```
This task depends upon

Closed by  Maxim Baz (maximbaz)
Friday, 11 February 2022, 23:30 GMT
Reason for closing:  Implemented
Additional comments about closing:  Closing, but do let me know if something is still not perfect!
Comment by Matthew Armand (heylookmatt) - Monday, 07 February 2022, 14:25 GMT
  • Field changed: Percent Complete (100% → 0%)
Hi, thanks for the addition! Your optdepends reasoning makes sense to me, I don't have a ton of knowledge there so obviously don't have much of a strong opinion about that there.

I would like to reopen this to make one more change... Apologies, I probably could have seen the need for this if I'd looked closer but the way the vim plugin is installed/organized is a bit different than fzf. Looking at vim-fugitive (PKGBUILD: https://github.com/archlinux/svntogit-community/blob/packages/vim-fugitive/trunk/PKGBUILD#L26) as another example, the bulk of the vim plugin functionality lives in the autoload directory for black as well. So I think in addition to the plugin directory, I think we need the following:

install -Dm644 autoload/black.vim "$pkgdir"/usr/share/vim/vimfiles/autoload/black.vim

And I THINK that'll give us all the files upstream for the plugin to work, at least according to their docs here: https://github.com/psf/black/blob/main/docs/integrations/editors.md#vim

Thanks again, apologies again for not including this in the original request.
Comment by Maxim Baz (maximbaz) - Monday, 07 February 2022, 17:04 GMT
Thanks :) Done in 22.1.0-2, please confirm that it works for you now

Loading...