|
4 | 4 |
|
5 | 5 | (defclass single-file-source (http-source) ())
|
6 | 6 |
|
| 7 | +(defun asdf-external-symbol-p (thing) |
| 8 | + "Returns true if THING is a symbol exported from ASDF." |
| 9 | + (and (symbolp thing) |
| 10 | + (multiple-value-bind (symbol class) |
| 11 | + (find-symbol (symbol-name thing) :asdf) |
| 12 | + (and (eq symbol thing) |
| 13 | + (eql :external class))))) |
| 14 | + |
| 15 | +(defun print-asdf-external-symbol (stream symbol) |
| 16 | + "If SYMBOL is exported from the ASDF package, print it with ASDF: as |
| 17 | +a prefix, rather than using its actual home package as a prefix. This |
| 18 | +matters for symbols like ASDF/DEFSYSTEM:DEFSYSTEM in ASDF 3." |
| 19 | + (format stream "~A:~A" :asdf (make-symbol (symbol-name symbol)))) |
| 20 | + |
| 21 | +(defparameter *single-file-pprint-dispatch* |
| 22 | + (let ((table (copy-pprint-dispatch))) |
| 23 | + (set-pprint-dispatch '(satisfies asdf-external-symbol-p) |
| 24 | + 'print-asdf-external-symbol |
| 25 | + 0 |
| 26 | + table) |
| 27 | + table)) |
| 28 | + |
7 | 29 | (defgeneric single-file-name (source)
|
8 | 30 | (:method ((source single-file-source))
|
9 | 31 | (let ((slash (position #\/ (location source) :from-end t)))
|
|
26 | 48 |
|
27 | 49 | (defgeneric write-single-file-asd (source file)
|
28 | 50 | (:method (source file)
|
29 |
| - (with-open-file (stream file :direction :output) |
| 51 | + (with-open-file (stream file :direction :output |
| 52 | + :if-exists :supersede) |
30 | 53 | (let ((*print-case* :downcase)
|
31 |
| - (*package* (find-package :keyword))) |
| 54 | + (*package* (find-package :keyword)) |
| 55 | + (*print-pprint-dispatch* *single-file-pprint-dispatch*)) |
32 | 56 | (format stream ";;;; ~A, automatically created by quicklisp~%~%"
|
33 |
| - (project-name source)) |
| 57 | + (file-namestring file)) |
34 | 58 | (format stream "~S~%" (single-file-asd-form source))))))
|
35 | 59 |
|
36 | 60 | (defmethod make-release-tarball ((source single-file-source)
|
|
0 commit comments