backward-driver.lisp 3.32 KB
Newer Older
1 2
;;; -------------------------------------------------------------------------
;;; Hacks for backward-compatibility with older versions of UIOP
3

4
(uiop/package:define-package :uiop/backward-driver
5 6
  (:recycle :uiop/backward-driver :asdf/backward-driver :uiop)
  (:use :uiop/common-lisp :uiop/package :uiop/utility :uiop/version
7
   :uiop/pathname :uiop/stream :uiop/os :uiop/image
8
   :uiop/run-program :uiop/lisp-build :uiop/configuration)
9
  (:export
10
   #:coerce-pathname
11 12
   #:user-configuration-directories #:system-configuration-directories
   #:in-first-directory #:in-user-configuration-directory #:in-system-configuration-directory
13
   #:version-compatible-p))
14
(in-package :uiop/backward-driver)
15

16
(eval-when (:compile-toplevel :load-toplevel :execute)
17
(with-deprecation ((version-deprecation *uiop-version* :style-warning "3.2" :warning "3.4"))
18
  ;; Backward compatibility with ASDF 2.000 to 2.26
19

20 21 22
  ;; For backward-compatibility only, for people using internals
  ;; Reported users in quicklisp 2015-11: hu.dwim.asdf (removed in next release)
  ;; Will be removed after 2015-12.
23
  (defun coerce-pathname (name &key type defaults)
24
    "DEPRECATED. Please use UIOP:PARSE-UNIX-NAMESTRING instead."
25
    (parse-unix-namestring name :type type :defaults defaults))
26

27 28
  ;; Backward compatibility for ASDF 2.27 to 3.1.4
  (defun user-configuration-directories ()
Robert Goldman's avatar
Robert Goldman committed
29 30
    "Return the current user's list of user configuration directories
for configuring common-lisp.
31
DEPRECATED. Use UIOP:XDG-CONFIG-PATHNAMES instead."
32
    (xdg-config-pathnames "common-lisp"))
33
  (defun system-configuration-directories ()
Robert Goldman's avatar
Robert Goldman committed
34
    "Return the list of system configuration directories for common-lisp.
35
DEPRECATED. Use UIOP:CONFIG-SYSTEM-PATHNAMES instead."
36
    (system-config-pathnames "common-lisp"))
37
  (defun in-first-directory (dirs x &key (direction :input))
Robert Goldman's avatar
Robert Goldman committed
38 39
    "Finds the first appropriate file named X in the list of DIRS for I/O
in DIRECTION \(which may be :INPUT, :OUTPUT, :IO, or :PROBE).
40
If direction is :INPUT or :PROBE, will return the first extant file named
Robert Goldman's avatar
Robert Goldman committed
41
X in one of the DIRS.
42
If direction is :OUTPUT or :IO, will simply return the file named X in the
Robert Goldman's avatar
Robert Goldman committed
43
first element of DIRS that exists. DEPRECATED."
44 45 46 47
    (find-preferred-file
     (mapcar #'(lambda (dir) (subpathname (ensure-directory-pathname dir) x)) dirs)
     :direction direction))
  (defun in-user-configuration-directory (x &key (direction :input))
Robert Goldman's avatar
Robert Goldman committed
48 49
    "Return the file named X in the user configuration directory for common-lisp.
DEPRECATED."
50
    (xdg-config-pathname `("common-lisp" ,x) direction))
51
  (defun in-system-configuration-directory (x &key (direction :input))
Robert Goldman's avatar
Robert Goldman committed
52 53
    "Return the pathname for the file named X under the system configuration directory
for common-lisp. DEPRECATED."
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
    (find-preferred-file (system-config-pathnames "common-lisp" x) :direction direction))


  ;; Backward compatibility with ASDF 1 to ASDF 2.32

  (defun version-compatible-p (provided-version required-version)
    "Is the provided version a compatible substitution for the required-version?
If major versions differ, it's not compatible.
If they are equal, then any later version is compatible,
with later being determined by a lexicographical comparison of minor numbers.
DEPRECATED."
    (let ((x (parse-version provided-version nil))
          (y (parse-version required-version nil)))
      (and x y (= (car x) (car y)) (lexicographic<= '< (cdr y) (cdr x)))))))