سؤال

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.

هل كانت مفيدة؟

المحلول

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
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top