|
From: rtoy <rt...@us...> - 2025-11-18 23:37:02
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Maxima CAS".
The branch, rtoy-lisp-list-avail-consistently has been created
at 7f57f45cce15f7fbf3119227a6025845c110ba99 (commit)
- Log -----------------------------------------------------------------
commit 7f57f45cce15f7fbf3119227a6025845c110ba99
Author: Raymond Toy <toy...@gm...>
Date: Tue Nov 18 15:30:48 2025 -0800
Make --list-avail show correct version and be consistent
Currently, "maxima-local --list-avail" would print the version as the
Lisp version of the default lisp. This is not the Maxima version that
would be expected to be printed.
To fix this, modify maxima-local.in to get the version from the
autoconf variable VERSION, which is the Maxima version.
Next, "maxima-local -g --list-avail" would use Lisp to print out the
available lisps, but the paths used don't work for a local build.
Modify maxima-local.ing to define the envvar "MAXIMA_LOCAL" so that
maxima knows that it's being run from the maxima-local script instead
of maxima.
Modify `list-avail-action` to look for this envvar and search for
pathnames of the form "src/binary-*". If we find it, print out the
lisp name along with the version, as done by the script in
maxima-local.
This makes "maxima-local -g --list-avail" produce results that are
consistent with just "maxima-local --list-avail".
diff --git a/maxima-local.in b/maxima-local.in
index 8f8b0b1d3..ceb735c08 100755
--- a/maxima-local.in
+++ b/maxima-local.in
@@ -12,10 +12,14 @@ MAXIMA_OBJDIR="@abs_top_builddir@/binary"
export MAXIMA_OBJDIR
MAXIMA_HTMLDIR=${MAXIMA_DOC_PREFIX}
export MAXIMA_HTMLDIR
+# Tell lisp that we're running maxima-local. Primarily so Lisp can
+# produce the right values with --list-avail. Any value is OK.
+MAXIMA_LOCAL=yes
+export MAXIMA_LOCAL
# report the compiled in Lisp versions
if [ x"$1" = "x--list-avail" ]; then
- V=`./maxima-local --version | sed s/Maxima.//`
+ V="@VERSION@"
echo "Available versions:"
for i in src/binary-* ; do
L=`echo $i | sed s/src.binary-//`
diff --git a/src/init-cl.lisp b/src/init-cl.lisp
index 239ddff77..697348948 100644
--- a/src/init-cl.lisp
+++ b/src/init-cl.lisp
@@ -326,25 +326,61 @@ maxima [options] --batch-string='batch_answers_from_file:false; ...'
(setq *maxima-lang-subdir* nil)))
(defun list-avail-action ()
- (let* ((maxima-verpkglibdir (if (maxima-getenv "MAXIMA-VERPKGLIBDIR")
- (maxima-getenv "MAXIMA-VERPKGLIBDIR")
- (if (maxima-getenv "MAXIMA_PREFIX")
- (combine-path (maxima-getenv "MAXIMA_PREFIX") "lib"
- *autoconf-package* *autoconf-version*)
- (combine-path (maxima-parse-dirstring *autoconf-libdir*)
- *autoconf-package* *autoconf-version*))))
- (len (length maxima-verpkglibdir))
- (lisp-string nil))
- (format t "Available versions:~%")
- (unless (equal (subseq maxima-verpkglibdir (- len 1) len) "/")
- (setf maxima-verpkglibdir (concatenate 'string maxima-verpkglibdir "/")))
- (dolist (version (get-dirs (unix-like-dirname maxima-verpkglibdir)))
- (dolist (lisp (get-dirs version))
- (setf lisp-string (unix-like-basename lisp))
- (when (search "binary-" lisp-string)
- (setf lisp-string (subseq lisp-string (length "binary-") (length lisp-string)))
- (format t "version ~a, lisp ~a~%" (unix-like-basename version) lisp-string))))
- (bye)))
+ (cond
+ #+nil
+ ((maxima-getenv "MAXIMA_LOCAL")
+ ;; We're running maxima-local in the src tree.
+ (let ((maxima-dir (if (maxima-getenv "MAXIMA_PREFIX")
+ (combine-path (maxima-getenv "MAXIMA_PREFIX") "src")
+ (combine-path (maxima-parse-dirstring *autoconf-libdir*)
+ *autoconf-package* *autoconf-version*))))
+ (dolist (p (directory (concatenate 'string maxima-dir "/*")))
+ (let* ((pname (namestring p))
+ (binary-dir-posn (search "src/binary-" pname)))
+ (when binary-dir-posn
+ (let ((name (subseq pname (+ binary-dir-posn 11))))
+ (format t "version ~a, lisp ~a~%" *autoconf-version* name)))))))
+ ((maxima-getenv "MAXIMA_LOCAL")
+ ;; We're running maxima-local in the src tree.
+ (let ((maxima-dir (if (maxima-getenv "MAXIMA_PREFIX")
+ (combine-path (maxima-getenv "MAXIMA_PREFIX") "src")
+ (combine-path (maxima-parse-dirstring *autoconf-libdir*)
+ *autoconf-package*)))
+ ;; I (rtoy) am lazy. Just use regexp to match
+ ;; "src/binary-foo" which is the directory containing the
+ ;; build using lisp "foo".
+ (pattern (pregexp:pregexp "src/binary-([^/]+)")))
+ (format t "Available versions:~%")
+ (dolist (p (directory (concatenate 'string maxima-dir "/*")))
+ (destructuring-bind (&optional whole-match lisp-name)
+ (pregexp:pregexp-match pattern (namestring p))
+ (declare (ignore whole-match))
+ (when lisp-name
+ (format t "version ~a, lisp ~a~%" *autoconf-version* lisp-name))))))
+ (t
+ (let* ((maxima-verpkglibdir (if (maxima-getenv "MAXIMA-VERPKGLIBDIR")
+ (maxima-getenv "MAXIMA-VERPKGLIBDIR")
+ (if (maxima-getenv "MAXIMA_PREFIX")
+ (combine-path (maxima-getenv "MAXIMA_PREFIX") "lib"
+ *autoconf-package* *autoconf-version*)
+ (combine-path (maxima-parse-dirstring *autoconf-libdir*)
+ *autoconf-package* *autoconf-version*))))
+ (len (length maxima-verpkglibdir))
+ (lisp-string nil))
+ (format t "Available versions:~%")
+ (unless (equal (subseq maxima-verpkglibdir (- len 1) len) "/")
+ (setf maxima-verpkglibdir (concatenate 'string maxima-verpkglibdir "/")))
+ (format t "maxima-verpkglibdir = ~A~%" maxima-verpkglibdir)
+ (format t "unix-like-dirname = ~A~%" (unix-like-dirname maxima-verpkglibdir))
+ (format t "get-dirs = ~A~%" (get-dirs (unix-like-dirname maxima-verpkglibdir)))
+ (dolist (version (get-dirs (unix-like-dirname maxima-verpkglibdir)))
+ (format t "version = ~A~%" version)
+ (dolist (lisp (get-dirs version))
+ (setf lisp-string (unix-like-basename lisp))
+ (when (search "binary-" lisp-string)
+ (setf lisp-string (subseq lisp-string (length "binary-") (length lisp-string)))
+ (format t "version ~a, lisp ~a~%" (unix-like-basename version) lisp-string)))))))
+ (bye))
(defvar *maxima-commandline-options* nil
"All of the recognized command line options for maxima")
-----------------------------------------------------------------------
hooks/post-receive
--
Maxima CAS
|