##// END OF EJS Templates
Incorporating review comments
anantkaushik89 -
Show More
@@ -0,0 +1,9 b''
1 Functions Removed in 6.x Development cycle
2 ------------------------------------------
3
4 The following functions have been removed in the
5 development cycle marked for the development cycle
6 marked for Milestone 6.0.
7
8 * is_cmd_found
9 * pycmd2argv
@@ -1,74 +1,70 b''
1 1 # encoding: utf-8
2 2 """
3 3 Utilities for working with external processes.
4 4 """
5 5
6 6 # Copyright (c) IPython Development Team.
7 7 # Distributed under the terms of the Modified BSD License.
8 8
9 9 from __future__ import print_function
10 10
11 11 import os
12 12 import sys
13 13
14 14 if sys.platform == 'win32':
15 15 from ._process_win32 import system, getoutput, arg_split, check_pid
16 16 elif sys.platform == 'cli':
17 17 from ._process_cli import system, getoutput, arg_split, check_pid
18 18 else:
19 19 from ._process_posix import system, getoutput, arg_split, check_pid
20 20
21 21 from ._process_common import getoutputerror, get_output_error_code, process_handler
22 22 from . import py3compat
23 23
24 24
25 25 class FindCmdError(Exception):
26 26 pass
27 27
28 28
29 29 def find_cmd(cmd):
30 30 """Find absolute path to executable cmd in a cross platform manner.
31 31
32 32 This function tries to determine the full path to a command line program
33 33 using `which` on Unix/Linux/OS X and `win32api` on Windows. Most of the
34 34 time it will use the version that is first on the users `PATH`.
35 35
36 36 Warning, don't use this to find IPython command line programs as there
37 37 is a risk you will find the wrong one. Instead find those using the
38 38 following code and looking for the application itself::
39 39
40 from IPython.utils.path import get_ipython_module_path
41 from IPython.utils.process import pycmd2argv
42 argv = pycmd2argv(get_ipython_module_path('IPython.terminal.ipapp'))
43
44 Note, The code for pycmd2argv has been removed now as it was not used
45 anywhere. get_ipython_module_path should give us that same result.
40 import sys
41 argv = [sys.executable, '-m', 'IPython.terminal']
46 42
47 43 Parameters
48 44 ----------
49 45 cmd : str
50 46 The command line program to look for.
51 47 """
52 48 path = py3compat.which(cmd)
53 49 if path is None:
54 50 raise FindCmdError('command could not be found: %s' % cmd)
55 51 return path
56 52
57 53
58 54 def abbrev_cwd():
59 55 """ Return abbreviated version of cwd, e.g. d:mydir """
60 56 cwd = py3compat.getcwd().replace('\\','/')
61 57 drivepart = ''
62 58 tail = cwd
63 59 if sys.platform == 'win32':
64 60 if len(cwd) < 4:
65 61 return cwd
66 62 drivepart,tail = os.path.splitdrive(cwd)
67 63
68 64
69 65 parts = tail.split('/')
70 66 if len(parts) > 2:
71 67 tail = '/'.join(parts[-2:])
72 68
73 69 return (drivepart + (
74 70 cwd == '/' and '/' or tail))
General Comments 0
You need to be logged in to leave comments. Login now