backward-driver.lisp 3.6 KB
Newer Older
1 2 3
;;;; -------------------------------------------------------------------------
;;; Hacks for backward-compatibility of the driver

4 5 6 7 8
(uiop/package:define-package :uiop/backward-driver
  (:nicknames :asdf/backward-driver)
  (:recycle :uiop/backward-driver :asdf/backward-driver :asdf)
  (:use :uiop/common-lisp :uiop/package :uiop/utility
   :uiop/pathname :uiop/stream :uiop/os :uiop/image
9
   :uiop/run-program :uiop/lisp-build :uiop/configuration)
10
  (:export
11
   #:coerce-pathname #:component-name-to-pathname-components
Francois-Rene Rideau's avatar
Francois-Rene Rideau committed
12
   #+(or clasp ecl mkcl) #:compile-file-keeping-object
13 14
   #:user-configuration-directories #:system-configuration-directories
   #:in-first-directory #:in-user-configuration-directory #:in-system-configuration-directory
15
   ))
16
(in-package :uiop/backward-driver)
17 18 19

;;;; Backward compatibility with various pathname functions.

20 21 22 23 24 25 26
(with-upgradability ()
  (defun coerce-pathname (name &key type defaults)
    ;; For backward-compatibility only, for people using internals
    ;; Reported users in quicklisp: hu.dwim.asdf, asdf-utils, xcvb
    ;; Will be removed after 2014-01-16.
    ;;(warn "Please don't use ASDF::COERCE-PATHNAME. Use ASDF/PATHNAME:PARSE-UNIX-NAMESTRING.")
    (parse-unix-namestring name :type type :defaults defaults))
27

28 29 30 31 32 33 34 35 36 37 38 39
  (defun component-name-to-pathname-components (unix-style-namestring
                                                 &key force-directory force-relative)
    ;; Will be removed after 2014-01-16.
    ;; (warn "Please don't use ASDF::COMPONENT-NAME-TO-PATHNAME-COMPONENTS, use SPLIT-UNIX-NAMESTRING-DIRECTORY-COMPONENTS")
    (multiple-value-bind (relabs path filename file-only)
        (split-unix-namestring-directory-components
         unix-style-namestring :ensure-directory force-directory)
      (declare (ignore file-only))
      (when (and force-relative (not (eq relabs :relative)))
        (error (compatfmt "~@<Absolute pathname designator not allowed: ~3i~_~S~@:>")
               unix-style-namestring))
      (values relabs path filename)))
40

Francois-Rene Rideau's avatar
Francois-Rene Rideau committed
41
  #+(or clasp ecl mkcl)
42 43 44 45
  (defun compile-file-keeping-object (&rest args) (apply #'compile-file* args))

  ;; Backward compatibility for ASDF 2.27 to 3.1.4
  (defun user-configuration-directories ()
Robert Goldman's avatar
Robert Goldman committed
46 47
    "Return the current user's list of user configuration directories
for configuring common-lisp.
48 49
    DEPRECATED. Use uiop:xdg-config-pathnames instead."
    (xdg-config-pathnames "common-lisp"))
50
  (defun system-configuration-directories ()
Robert Goldman's avatar
Robert Goldman committed
51 52
    "Return the list of system configuration directories for common-lisp.
    DEPRECATED. Use uiop:config-system-pathnames instead."
53
    (system-config-pathnames "common-lisp"))
54
  (defun in-first-directory (dirs x &key (direction :input))
Robert Goldman's avatar
Robert Goldman committed
55 56 57 58 59 60
    "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).
   If direction is :INPUT or :PROBE, will return the first extant file named
X in one of the DIRS.
   If direction is :OUTPUT or :IO, will simply return the file named X in the
first element of DIRS that exists. DEPRECATED."
61 62 63 64
    (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
65 66
    "Return the file named X in the user configuration directory for common-lisp.
DEPRECATED."
67
    (xdg-config-pathname "common-lisp" x direction))
68
  (defun in-system-configuration-directory (x &key (direction :input))
Robert Goldman's avatar
Robert Goldman committed
69 70
    "Return the pathname for the file named X under the system configuration directory
for common-lisp. DEPRECATED."
71
    (find-preferred-file (system-config-pathnames "common-lisp" x) :direction direction)))