emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/system-packages ede298f 094/117: Add system-packages-en


From: Stefan Monnier
Subject: [elpa] externals/system-packages ede298f 094/117: Add system-packages-ensure
Date: Fri, 14 Dec 2018 17:02:15 -0500 (EST)

branch: externals/system-packages
commit ede298ff50f70143f04abbf735aea3e0075b3819
Author: Alex Branham <address@hidden>
Commit: Alex Branham <address@hidden>

    Add system-packages-ensure
    
    Also an alias for system-packages-package-installed-p to
    executable-find.  This is somewhat related to bug #26, since you can
    now do something clever with if statments: if pack-man=apt, then
    ensure blah, else if pack-man=pacman, ensure blah-foo.
    
    Obviously, there's still work to be done here.
---
 system-packages.el | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/system-packages.el b/system-packages.el
index d425198..6b3f426 100644
--- a/system-packages.el
+++ b/system-packages.el
@@ -354,6 +354,22 @@ manger."
   (system-packages--run-command 'install pack args))
 
 ;;;###autoload
+(defun system-packages-ensure (pack &optional args)
+  "Ensure PACK is installed on system.
+Search for PACK with `system-packages-package-installed-p', and
+install the package if not found.  Use ARGS to pass options to
+the package manager."
+  (if (system-packages-package-installed-p pack)
+      t
+    (system-packages-install pack args)))
+
+;;;###autoload
+(defalias 'system-packages-package-installed-p #'executable-find
+  "Return t if PACK is installed.
+Currently an alias for `executable-find', so it will give wrong
+results if the package and executable names are different.")
+
+;;;###autoload
 (defun system-packages-search (pack &optional args)
   "Search for system packages.
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]