mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Move 'package-installed-p' to package-core
* lisp/package/package-install.el (package-installed-p): Remove function from here... * lisp/package/package-core.el (package-installed-p): ...to here. This check can be done without using any functionality needed to actually install a package.
This commit is contained in:
parent
1becd0e95d
commit
65000280ac
2 changed files with 30 additions and 30 deletions
|
|
@ -1057,5 +1057,35 @@ the `Version:' header."
|
|||
(require 'lisp-mnt)
|
||||
(lm-package-version mainfile)))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun package-installed-p (package &optional min-version)
|
||||
"Return non-nil if PACKAGE, of MIN-VERSION or newer, is installed.
|
||||
If PACKAGE is a symbol, it is the package name and MIN-VERSION
|
||||
should be a version list.
|
||||
|
||||
If PACKAGE is a `package-desc' object, MIN-VERSION is ignored."
|
||||
(cond
|
||||
((package-desc-p package)
|
||||
(let ((dir (package-desc-dir package)))
|
||||
(and (stringp dir)
|
||||
(file-exists-p dir))))
|
||||
((and (not package--initialized)
|
||||
(null min-version)
|
||||
package-activated-list)
|
||||
;; We used the quickstart: make it possible to use package-installed-p
|
||||
;; even before package is fully initialized.
|
||||
(or
|
||||
(memq package package-activated-list)
|
||||
;; Also check built-in packages.
|
||||
(package-built-in-p package min-version)))
|
||||
(t
|
||||
(or
|
||||
(let ((pkg-descs (cdr (assq package (package--alist)))))
|
||||
(and pkg-descs
|
||||
(version-list-<= min-version
|
||||
(package-desc-version (car pkg-descs)))))
|
||||
;; Also check built-in packages.
|
||||
(package-built-in-p package min-version)))))
|
||||
|
||||
(provide 'package-core)
|
||||
;;; package-core.el ends here
|
||||
|
|
|
|||
|
|
@ -309,36 +309,6 @@ Signal an error if the kind is none of the above."
|
|||
package-alist))))
|
||||
(setf (package-desc-signed (car pkg-descs)) t))))))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun package-installed-p (package &optional min-version)
|
||||
"Return non-nil if PACKAGE, of MIN-VERSION or newer, is installed.
|
||||
If PACKAGE is a symbol, it is the package name and MIN-VERSION
|
||||
should be a version list.
|
||||
|
||||
If PACKAGE is a `package-desc' object, MIN-VERSION is ignored."
|
||||
(cond
|
||||
((package-desc-p package)
|
||||
(let ((dir (package-desc-dir package)))
|
||||
(and (stringp dir)
|
||||
(file-exists-p dir))))
|
||||
((and (not package--initialized)
|
||||
(null min-version)
|
||||
package-activated-list)
|
||||
;; We used the quickstart: make it possible to use package-installed-p
|
||||
;; even before package is fully initialized.
|
||||
(or
|
||||
(memq package package-activated-list)
|
||||
;; Also check built-in packages.
|
||||
(package-built-in-p package min-version)))
|
||||
(t
|
||||
(or
|
||||
(let ((pkg-descs (cdr (assq package (package--alist)))))
|
||||
(and pkg-descs
|
||||
(version-list-<= min-version
|
||||
(package-desc-version (car pkg-descs)))))
|
||||
;; Also check built-in packages.
|
||||
(package-built-in-p package min-version)))))
|
||||
|
||||
(defun package-download-transaction (packages)
|
||||
"Download and install all the packages in PACKAGES.
|
||||
PACKAGES should be a list of `package-desc'.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue