Function: package--incompatible-p

package--incompatible-p is a byte-compiled function defined in package.el.gz.

Signature

(package--incompatible-p PKG &optional SHALLOW)

Documentation

Return non-nil if PKG has no chance of being installable.

PKG is a package-desc object.

If SHALLOW is non-nil, this only checks if PKG depends on a higher emacs-version(var)/emacs-version(fun) than the one being used. Otherwise, also checks the viability of dependencies, according to package--compatibility-table.

If PKG requires an incompatible Emacs version, the return value is this version (as a string). If PKG requires incompatible packages, the return value is a list of these dependencies, similar to the list returned by package-desc-reqs.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/package.el.gz
(defun package--incompatible-p (pkg &optional shallow)
  "Return non-nil if PKG has no chance of being installable.
PKG is a `package-desc' object.

If SHALLOW is non-nil, this only checks if PKG depends on a
higher `emacs-version' than the one being used.  Otherwise, also
checks the viability of dependencies, according to
`package--compatibility-table'.

If PKG requires an incompatible Emacs version, the return value
is this version (as a string).
If PKG requires incompatible packages, the return value is a list
of these dependencies, similar to the list returned by
`package-desc-reqs'."
  (let* ((reqs    (package-desc-reqs pkg))
         (version (cadr (assq 'emacs reqs))))
    (if (and version (version-list-< package--emacs-version-list version))
        (package-version-join version)
      (unless shallow
        (let (out)
          (dolist (dep (package-desc-reqs pkg) out)
            (let ((dep-name (car dep)))
              (unless (eq 'emacs dep-name)
                (let ((cv (gethash dep-name package--compatibility-table)))
                  (when (version-list-< (or cv '(0)) (or (cadr dep) '(0)))
                    (push dep out)))))))))))