Created
April 3, 2018 10:27
-
-
Save snmsts/e9e5321c3c7a0f0c6ae6ea15656a56a9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(progn | |
(pushnew :python3 *features*) | |
(ql:quickload :burgled-batteries)) | |
(defun init () | |
(burgled-batteries:startup-python) | |
(burgled-batteries:run "import os,sys")) | |
(defun sys.version () | |
(burgled-batteries:run "sys.version")) | |
(defun os.getcwd () | |
(burgled-batteries:run "os.getcwd()")) | |
(defun dir (path) | |
(and (uiop:directory-exists-p path) | |
(native-namestring (uiop:pathname-directory-pathname path)))) | |
(defun os.chdir (path) | |
(let ((dir (dir path))) | |
(burgled-batteries:run (format nil "os.chdir(~S)" dir)))) | |
(defun push-sys.path (path) | |
(let ((dir (dir path))) | |
(burgled-batteries:run (format nil (format nil "sys.path = [ e for e in sys.path if e not in (~S)];sys.path.insert(0,~S)" dir dir))))) | |
(defun sys.path () | |
(burgled-batteries:run "sys.path")) | |
(defun import-python (path) | |
(let* ((dir (dir path)) | |
(mod (first (last (pathname-directory dir))))) | |
(push-sys.path dir) | |
(burgled-batteries:run (format nil "import ~A" mod)) | |
(burgled-batteries:run (format nil "str(~A)" mod)))) | |
(init) | |
(import-python #P"~/python/hoge_hoge/") | |
;;(burgled-batteries:run "sys.argv") | |
#| | |
(burgled-batteries:run (format nil "import sys")) | |
(burgled-batteries:run (format nil "import hoge_hoge")) | |
(burgled-batteries:run (format nil "str(type(sys))")) | |
(burgled-batteries:run (format nil "import inspect")) | |
;;(burgled-batteries:run "str(inspect.getmembers (hoge_hoge,inspect.isfunction))") | |
;;(burgled-batteries:run "str(inspect.signature (hoge_hoge.hmm))") | |
|# | |
(burgled-batteries:run "hoge_hoge.hmm()") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment