jwiegley / use-package

A use-package declaration for simplifying your .emacs
https://jwiegley.github.io/use-package
GNU General Public License v3.0
4.39k stars 259 forks source link

Use system-packages-get-info to test if system package is installed #745

Open ncsalgado opened 5 years ago

ncsalgado commented 5 years ago

I have the following command: (use-package pdf-tools :ensure-system-package (libpng-dev zlib1g-dev libpoppler-glib-dev libpoppler-private-dev imagemagick) ) Every time I start emacs it asks me to install all system packages mentioned above. "(use-package-ensure-system-package-exists? PACKAGE-NAME)" also fails. Why not use the "(system-packages-get-info PACKAGE-NAME)" to test if a system package is already installed instead of testing the existence of a file? - I tried that but its to early for me to know how to do it...

waymondo commented 5 years ago

Under the hood (use-package-ensure-system-package-exists?) uses (executable-find) in your example which means those packages are not available on Emacs' exec-path, at least by the time that (use-package) declaration is evaluated. You'll need to copy/import your shell's path to Emacs. (exec-path-from-shell) is what I use to do this on macOS for example.

(system-packages-get-info) only works on some package managers, and since use-package-ensure-system-package can also accept paths to files as strings and alternate installation methods as strings, it doesn't make sense for that to be used to determine whether the "system package" is installed or not.