Function: inversion-check-version

inversion-check-version is a byte-compiled function defined in inversion.el.gz.

Signature

(inversion-check-version VERSION INCOMPATIBLE-VERSION MINIMUM &rest RESERVED)

Documentation

Check that a given version meets the minimum requirement.

VERSION, INCOMPATIBLE-VERSION and MINIMUM are of similar format to return entries of inversion-decode-version, or a classic version string. INCOMPATIBLE-VERSION can be nil. RESERVED arguments are kept for a later use. Return:
- nil if everything is ok.
- outdated if VERSION is less than MINIMUM.
- incompatible if VERSION is not backward compatible with MINIMUM.
- t if the check failed.

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/inversion.el.gz
(defun inversion-check-version (version incompatible-version
                                minimum &rest _reserved)
  "Check that a given version meets the minimum requirement.
VERSION, INCOMPATIBLE-VERSION and MINIMUM are of similar format to
return entries of `inversion-decode-version', or a classic version
string.  INCOMPATIBLE-VERSION can be nil.
RESERVED arguments are kept for a later use.
Return:
- nil if everything is ok.
- `outdated' if VERSION is less than MINIMUM.
- `incompatible' if VERSION is not backward compatible with MINIMUM.
- t if the check failed."
  (let ((code (if (stringp version)
		  (inversion-decode-version version)
		version))
	(req (if (stringp minimum)
		 (inversion-decode-version minimum)
	       minimum))
	)
    ;; Perform a test.
    (cond
     ((inversion-= code req)
      ;; Same version.. Yay!
      nil)
     ((inversion-< code req)
      ;; Version is too old!
      'outdated)
     ((inversion-< req code)
      ;; Newer is installed.  What to do?
      (let ((incompatible
	     (if (stringp incompatible-version)
		 (inversion-decode-version incompatible-version)
	       incompatible-version)))
	(cond
	 ((not incompatible) nil)
	 ((or (inversion-= req incompatible)
	      (inversion-< req incompatible))
	  ;; The requested version is = or < than what the package
	  ;; maintainer says is incompatible.
	  'incompatible)
	 ;; Things are ok.
	 (t nil))))
     ;; Check failed
     (t t))))