move setenv/unsetenv -> roswell.util

This commit is contained in:
SANO Masatoshi 2017-02-17 02:28:03 +09:00
parent 04d9aeab40
commit a2f4cd1006
2 changed files with 25 additions and 25 deletions

View file

@ -28,7 +28,7 @@ have the latest asdf, and this file has a workaround for this.
(:shadow :load :eval :package :restart :print :write)
(:export :run :*argv* :*main* :quit :script :quicklisp :getenv :opt
:ignore-shebang :asdf :include :ensure-asdf
:roswell :exec :setenv :unsetenv :version :swank :verbose)
:roswell :exec :version :swank :verbose)
(:documentation "Roswell backend."))
(in-package :ros)
@ -114,26 +114,6 @@ have the latest asdf, and this file has a workaround for this.
(error "execvp(3) failed. (Code=~D)" errno))))))
(sb-alien:free-alien a-args)))))
(defun setenv (name value)
(declare (ignorable name value))
#+sbcl(funcall (read-from-string "sb-posix:setenv") name value 1)
#+ccl(ccl:setenv name value t)
#+clasp(ext:setenv name value t)
#+clisp(system::setenv name value)
#+cmucl(let ((f (ignore-errors (symbol-function (read-from-string "unix:unix-setenv")))))
(when f (funcall f name value 1)))
#+ecl(ext:setenv name value)
value)
(defun unsetenv (name)
(declare (ignorable name))
#+sbcl(funcall (read-from-string "sb-posix:unsetenv") name)
#+ccl(ccl:unsetenv name)
#+clisp(system::setenv name nil)
#+cmucl(let ((f (ignore-errors (symbol-function (read-from-string "unix:unix-unsetenv")))))
(when f (funcall f name)))
nil)
(defun quit (&optional (return-code 0) &rest rest)
(let ((ret (or (and (numberp return-code) return-code) (first rest) 0)))
#+sbcl (ignore-errors (funcall (read-from-string "cl-user::exit") :code ret))

View file

@ -6,9 +6,29 @@
:uname :uname-m :homedir :config :impl :which :list% :config-env
:parse-version-spec :download :expand :sh :chdir :system :module
:core-extention :clone-github :opt :read-call :set-opt :copy-dir
:roswell-installable-searcher))
:roswell-installable-searcher :setenv :unsetenv))
(in-package :roswell.util)
(defun setenv (name value)
(declare (ignorable name value))
#+sbcl(funcall (read-from-string "sb-posix:setenv") name value 1)
#+ccl(ccl:setenv name value t)
#+clasp(ext:setenv name value t)
#+clisp(system::setenv name value)
#+cmucl(let ((f (ignore-errors (symbol-function (read-from-string "unix:unix-setenv")))))
(when f (funcall f name value 1)))
#+ecl(ext:setenv name value)
value)
(defun unsetenv (name)
(declare (ignorable name))
#+sbcl(funcall (read-from-string "sb-posix:unsetenv") name)
#+ccl(ccl:unsetenv name)
#+clisp(system::setenv name nil)
#+cmucl(let ((f (ignore-errors (symbol-function (read-from-string "unix:unix-unsetenv")))))
(when f (funcall f name)))
nil)
(defun read-call (func &rest params)
(ignore-errors (apply (let (*read-eval*) (read-from-string func)) params)))
@ -167,9 +187,9 @@ ccl-bin -> (\"ccl-bin\" nil)
(setq bits (cond (bits)
((equal uname-m "x86-64") 64)
((equal uname-m "x86") 32)))
(ros:setenv "MSYSTEM" (if (= bits 32) "MINGW32" "MINGW64"))
(ros:setenv "MSYS2_PATH_TYPE" "inherit")
(ros:setenv "PATH" (format nil "~A;~A\\.roswell\\bin;~A"
(setenv "MSYSTEM" (if (= bits 32) "MINGW32" "MINGW64"))
(setenv "MSYS2_PATH_TYPE" "inherit")
(setenv "PATH" (format nil "~A;~A\\.roswell\\bin;~A"
(subseq path 0 (1- (length path)))
(ros:getenv "USERPROFILE")
(ros:getenv "PATH")))))