Getting the version of an ASDF system
-
15-06-2021 - |
Question
Among other things you can set in an ASDF system is the :version
property. Is there a way to read it at runtime? Something like (system-version :my-system-name)
?
I know there are asdf:version-satisfies
, and asdf:asdf-version
, but neither do what I want in this case.
Solution
Here is the code:
(defun system-version (system-designator)
(let ((system (asdf:find-system system-designator nil)))
(when (and system (slot-boundp system 'asdf:version))
(asdf:component-version system))))
it works like this:
CL-USER> (system-version :cffi)
"0.10.7.1"
CL-USER> (system-version :foo)
NIL
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow