From 84fb761792930bf585b3934be031021970211142 Mon Sep 17 00:00:00 2001 From: Francois-Rene Rideau <tunes@google.com> Date: Mon, 29 Jun 2015 22:38:37 -0400 Subject: [PATCH] Test OS predicates at runtime only Thus, you can test the *features* as locally bound from some target system. --- uiop/os.lisp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/uiop/os.lisp b/uiop/os.lisp index bc36d918..819c677c 100644 --- a/uiop/os.lisp +++ b/uiop/os.lisp @@ -33,32 +33,29 @@ keywords explicitly." ((eq :and (car x)) (every #'featurep (cdr x))) (t (error "Malformed feature specification ~S" x)))) - (defun os-unix-p () - "Is the underlying operating system some Unix variant?" - (or #+abcl (featurep :unix) - #+(and (not abcl) (or unix cygwin darwin)) t)) - + ;; Starting with UIOP 3.1.5, these are runtime tests. + ;; You may bind *features* with a copy of what your target system offers to test its properties. (defun os-macosx-p () "Is the underlying operating system MacOS X?" ;; OS-MACOSX is not mutually exclusive with OS-UNIX, ;; in fact the former implies the latter. - (or - #+allegro (featurep :macosx) - #+clisp (featurep :macos) - (featurep :darwin))) + (featurep '(:or :darwin (:and :allegro :macosx) (:and :clisp :macos)))) + + (defun os-unix-p () + "Is the underlying operating system some Unix variant?" + (or (featurep '(:or :unix :cygwin)) (os-macosx-p))) (defun os-windows-p () "Is the underlying operating system Microsoft Windows?" - (or #+abcl (featurep :windows) - #+(and (not (or abcl unix cygwin darwin)) (or win32 windows mswindows mingw32 mingw64)) t)) + (and (not (os-unix-p)) (featurep '(:or :win32 :windows :mswindows :mingw32 :mingw64)))) (defun os-genera-p () "Is the underlying operating system Genera (running on a Symbolics Lisp Machine)?" - (or #+genera t)) + (featurep :genera)) (defun os-oldmac-p () "Is the underlying operating system an (emulated?) MacOS 9 or earlier?" - (or #+mcl t)) + (featurep :mcl)) (defun detect-os () "Detects the current operating system. Only needs be run at compile-time, -- GitLab