File tree Expand file tree Collapse file tree 2 files changed +82
-0
lines changed
Expand file tree Collapse file tree 2 files changed +82
-0
lines changed Original file line number Diff line number Diff line change @@ -98,6 +98,60 @@ Determine if python environment has been changed since PROCESS was started.
9898 :process "pythonic"
9999 :args '("-V")))
100100
101+ pythonic-remote-p
102+ ~~~~~~~~~~~~~~~~~
103+
104+ Determine remote or local virtual environment.
105+
106+ .. code :: lisp
107+
108+ (pythonic-remote-p)
109+
110+ pythonic-remote-docker-p
111+ ~~~~~~~~~~~~~~~~~~~~~~~~
112+
113+ Determine docker remote virtual environment.
114+
115+ .. code :: lisp
116+
117+ (pythonic-remote-docker-p)
118+
119+ pythonic-remote-vagrant-p
120+ ~~~~~~~~~~~~~~~~~~~~~~~~~
121+
122+ Determine vagrant remote virtual environment.
123+
124+ .. code :: lisp
125+
126+ (pythonic-remote-vagrant-p)
127+
128+ pythonic-remote-user
129+ ~~~~~~~~~~~~~~~~~~~~
130+
131+ Get user of the connection to the remote python interpreter.
132+
133+ .. code :: lisp
134+
135+ (pythonic-remote-user)
136+
137+ pythonic-remote-host
138+ ~~~~~~~~~~~~~~~~~~~~
139+
140+ Get host of the connection to the remote python interpreter.
141+
142+ .. code :: lisp
143+
144+ (pythonic-remote-host)
145+
146+ pythonic-remote-port
147+ ~~~~~~~~~~~~~~~~~~~~
148+
149+ Get port of the connection to the remote python interpreter.
150+
151+ .. code :: lisp
152+
153+ (pythonic-remote-port)
154+
101155 Commands
102156--------
103157
Original file line number Diff line number Diff line change 5151 (and (pythonic-remote-p)
5252 (s-starts-with-p " /docker:" (pythonic-tramp-connection))))
5353
54+ (defun pythonic-remote-vagrant-p ()
55+ " Determine vagrant remote virtual environment."
56+ (and (pythonic-remote-p)
57+ (s-equals-p (pythonic-remote-host) " localhost" )
58+ (s-equals-p (pythonic-remote-user) " vagrant" )))
59+
60+ (defun pythonic-remote-user ()
61+ " Get user of the connection to the remote python interpreter."
62+ (tramp-file-name-user
63+ (tramp-dissect-file-name
64+ (pythonic-tramp-connection))))
65+
66+ (defun pythonic-remote-host ()
67+ " Get host of the connection to the remote python interpreter."
68+ (replace-regexp-in-string
69+ " #.*\\ '" " "
70+ (tramp-file-name-host
71+ (tramp-dissect-file-name
72+ (pythonic-tramp-connection)))))
73+
74+ (defun pythonic-remote-port ()
75+ " Get port of the connection to the remote python interpreter."
76+ (let ((hostname (tramp-file-name-host
77+ (tramp-dissect-file-name
78+ (pythonic-tramp-connection)))))
79+ (when (s-contains-p " #" hostname)
80+ (string-to-number (replace-regexp-in-string " \\ `.*#" " " hostname)))))
81+
5482(defun pythonic-file-name (file )
5583 " Normalized FILE location with out tramp prefix."
5684 (if (tramp-tramp-file-p file)
You can’t perform that action at this time.
0 commit comments