##// END OF EJS Templates
IPython/utils/_process_emscripten.py: New (#14316)...
M Bussonnier -
r28620:d73fcbdb merge
parent child Browse files
Show More
@@ -0,0 +1,21 b''
1 """Emscripten-specific implementation of process utilities.
2
3 This file is only meant to be imported by process.py, not by end-users.
4 """
5
6
7 def system(cmd):
8 raise OSError("Not available")
9
10
11 def getoutput(cmd):
12 raise OSError("Not available")
13
14
15 def check_pid(cmd):
16 raise OSError("Not available")
17
18
19 def arg_split(s, posix=False, strict=True):
20 """This one could be made to work but it's not clear if it would be useful..."""
21 raise OSError("Not available")
@@ -1,69 +1,71 b''
1 # encoding: utf-8
1 # encoding: utf-8
2 """
2 """
3 Utilities for working with external processes.
3 Utilities for working with external processes.
4 """
4 """
5
5
6 # Copyright (c) IPython Development Team.
6 # Copyright (c) IPython Development Team.
7 # Distributed under the terms of the Modified BSD License.
7 # Distributed under the terms of the Modified BSD License.
8
8
9
9
10 import os
10 import os
11 import shutil
11 import shutil
12 import sys
12 import sys
13
13
14 if sys.platform == 'win32':
14 if sys.platform == 'win32':
15 from ._process_win32 import system, getoutput, arg_split, check_pid
15 from ._process_win32 import system, getoutput, arg_split, check_pid
16 elif sys.platform == 'cli':
16 elif sys.platform == 'cli':
17 from ._process_cli import system, getoutput, arg_split, check_pid
17 from ._process_cli import system, getoutput, arg_split, check_pid
18 elif sys.platform == "emscripten":
19 from ._process_emscripten import system, getoutput, arg_split, check_pid
18 else:
20 else:
19 from ._process_posix import system, getoutput, arg_split, check_pid
21 from ._process_posix import system, getoutput, arg_split, check_pid
20
22
21 from ._process_common import getoutputerror, get_output_error_code, process_handler
23 from ._process_common import getoutputerror, get_output_error_code, process_handler
22
24
23
25
24 class FindCmdError(Exception):
26 class FindCmdError(Exception):
25 pass
27 pass
26
28
27
29
28 def find_cmd(cmd):
30 def find_cmd(cmd):
29 """Find absolute path to executable cmd in a cross platform manner.
31 """Find absolute path to executable cmd in a cross platform manner.
30
32
31 This function tries to determine the full path to a command line program
33 This function tries to determine the full path to a command line program
32 using `which` on Unix/Linux/OS X and `win32api` on Windows. Most of the
34 using `which` on Unix/Linux/OS X and `win32api` on Windows. Most of the
33 time it will use the version that is first on the users `PATH`.
35 time it will use the version that is first on the users `PATH`.
34
36
35 Warning, don't use this to find IPython command line programs as there
37 Warning, don't use this to find IPython command line programs as there
36 is a risk you will find the wrong one. Instead find those using the
38 is a risk you will find the wrong one. Instead find those using the
37 following code and looking for the application itself::
39 following code and looking for the application itself::
38
40
39 import sys
41 import sys
40 argv = [sys.executable, '-m', 'IPython']
42 argv = [sys.executable, '-m', 'IPython']
41
43
42 Parameters
44 Parameters
43 ----------
45 ----------
44 cmd : str
46 cmd : str
45 The command line program to look for.
47 The command line program to look for.
46 """
48 """
47 path = shutil.which(cmd)
49 path = shutil.which(cmd)
48 if path is None:
50 if path is None:
49 raise FindCmdError('command could not be found: %s' % cmd)
51 raise FindCmdError('command could not be found: %s' % cmd)
50 return path
52 return path
51
53
52
54
53 def abbrev_cwd():
55 def abbrev_cwd():
54 """ Return abbreviated version of cwd, e.g. d:mydir """
56 """ Return abbreviated version of cwd, e.g. d:mydir """
55 cwd = os.getcwd().replace('\\','/')
57 cwd = os.getcwd().replace('\\','/')
56 drivepart = ''
58 drivepart = ''
57 tail = cwd
59 tail = cwd
58 if sys.platform == 'win32':
60 if sys.platform == 'win32':
59 if len(cwd) < 4:
61 if len(cwd) < 4:
60 return cwd
62 return cwd
61 drivepart,tail = os.path.splitdrive(cwd)
63 drivepart,tail = os.path.splitdrive(cwd)
62
64
63
65
64 parts = tail.split('/')
66 parts = tail.split('/')
65 if len(parts) > 2:
67 if len(parts) > 2:
66 tail = '/'.join(parts[-2:])
68 tail = '/'.join(parts[-2:])
67
69
68 return (drivepart + (
70 return (drivepart + (
69 cwd == '/' and '/' or tail))
71 cwd == '/' and '/' or tail))
@@ -1,115 +1,115 b''
1 [metadata]
1 [metadata]
2 name = ipython
2 name = ipython
3 version = attr: IPython.core.release.__version__
3 version = attr: IPython.core.release.__version__
4 url = https://ipython.org
4 url = https://ipython.org
5 description = IPython: Productive Interactive Computing
5 description = IPython: Productive Interactive Computing
6 long_description_content_type = text/x-rst
6 long_description_content_type = text/x-rst
7 long_description = file: long_description.rst
7 long_description = file: long_description.rst
8 license_file = LICENSE
8 license_file = LICENSE
9 project_urls =
9 project_urls =
10 Documentation = https://ipython.readthedocs.io/
10 Documentation = https://ipython.readthedocs.io/
11 Funding = https://numfocus.org/
11 Funding = https://numfocus.org/
12 Source = https://github.com/ipython/ipython
12 Source = https://github.com/ipython/ipython
13 Tracker = https://github.com/ipython/ipython/issues
13 Tracker = https://github.com/ipython/ipython/issues
14 keywords = Interactive, Interpreter, Shell, Embedding
14 keywords = Interactive, Interpreter, Shell, Embedding
15 platforms = Linux, Mac OSX, Windows
15 platforms = Linux, Mac OSX, Windows
16 classifiers =
16 classifiers =
17 Framework :: IPython
17 Framework :: IPython
18 Framework :: Jupyter
18 Framework :: Jupyter
19 Intended Audience :: Developers
19 Intended Audience :: Developers
20 Intended Audience :: Science/Research
20 Intended Audience :: Science/Research
21 License :: OSI Approved :: BSD License
21 License :: OSI Approved :: BSD License
22 Programming Language :: Python
22 Programming Language :: Python
23 Programming Language :: Python :: 3
23 Programming Language :: Python :: 3
24 Programming Language :: Python :: 3 :: Only
24 Programming Language :: Python :: 3 :: Only
25 Topic :: System :: Shells
25 Topic :: System :: Shells
26
26
27 [options]
27 [options]
28 packages = find:
28 packages = find:
29 python_requires = >=3.10
29 python_requires = >=3.10
30 zip_safe = False
30 zip_safe = False
31 install_requires =
31 install_requires =
32 colorama; sys_platform == "win32"
32 colorama; sys_platform == "win32"
33 decorator
33 decorator
34 exceptiongroup; python_version<'3.11'
34 exceptiongroup; python_version<'3.11'
35 jedi>=0.16
35 jedi>=0.16
36 matplotlib-inline
36 matplotlib-inline
37 pexpect>4.3; sys_platform != "win32"
37 pexpect>4.3; sys_platform != "win32" and sys_platform != "emscripten"
38 prompt_toolkit>=3.0.41,<3.1.0
38 prompt_toolkit>=3.0.41,<3.1.0
39 pygments>=2.4.0
39 pygments>=2.4.0
40 stack_data
40 stack_data
41 traitlets>=5
41 traitlets>=5
42 typing_extensions ; python_version<'3.10'
42 typing_extensions ; python_version<'3.10'
43
43
44 [options.extras_require]
44 [options.extras_require]
45 black =
45 black =
46 black
46 black
47 doc =
47 doc =
48 ipykernel
48 ipykernel
49 setuptools>=18.5
49 setuptools>=18.5
50 sphinx>=1.3
50 sphinx>=1.3
51 sphinx-rtd-theme
51 sphinx-rtd-theme
52 docrepr
52 docrepr
53 matplotlib
53 matplotlib
54 stack_data
54 stack_data
55 typing_extensions
55 typing_extensions
56 exceptiongroup
56 exceptiongroup
57 %(test)s
57 %(test)s
58 kernel =
58 kernel =
59 ipykernel
59 ipykernel
60 nbconvert =
60 nbconvert =
61 nbconvert
61 nbconvert
62 nbformat =
62 nbformat =
63 nbformat
63 nbformat
64 notebook =
64 notebook =
65 ipywidgets
65 ipywidgets
66 notebook
66 notebook
67 parallel =
67 parallel =
68 ipyparallel
68 ipyparallel
69 qtconsole =
69 qtconsole =
70 qtconsole
70 qtconsole
71 terminal =
71 terminal =
72 test =
72 test =
73 pytest<8
73 pytest<8
74 pytest-asyncio<0.22
74 pytest-asyncio<0.22
75 testpath
75 testpath
76 pickleshare
76 pickleshare
77 test_extra =
77 test_extra =
78 %(test)s
78 %(test)s
79 curio
79 curio
80 matplotlib!=3.2.0
80 matplotlib!=3.2.0
81 nbformat
81 nbformat
82 numpy>=1.23
82 numpy>=1.23
83 pandas
83 pandas
84 trio
84 trio
85 all =
85 all =
86 %(black)s
86 %(black)s
87 %(doc)s
87 %(doc)s
88 %(kernel)s
88 %(kernel)s
89 %(nbconvert)s
89 %(nbconvert)s
90 %(nbformat)s
90 %(nbformat)s
91 %(notebook)s
91 %(notebook)s
92 %(parallel)s
92 %(parallel)s
93 %(qtconsole)s
93 %(qtconsole)s
94 %(terminal)s
94 %(terminal)s
95 %(test_extra)s
95 %(test_extra)s
96 %(test)s
96 %(test)s
97
97
98 [options.packages.find]
98 [options.packages.find]
99 exclude =
99 exclude =
100 setupext
100 setupext
101
101
102 [options.package_data]
102 [options.package_data]
103 IPython = py.typed
103 IPython = py.typed
104 IPython.core = profile/README*
104 IPython.core = profile/README*
105 IPython.core.tests = *.png, *.jpg, daft_extension/*.py
105 IPython.core.tests = *.png, *.jpg, daft_extension/*.py
106 IPython.lib.tests = *.wav
106 IPython.lib.tests = *.wav
107 IPython.testing.plugin = *.txt
107 IPython.testing.plugin = *.txt
108
108
109 [velin]
109 [velin]
110 ignore_patterns =
110 ignore_patterns =
111 IPython/core/tests
111 IPython/core/tests
112 IPython/testing
112 IPython/testing
113
113
114 [tool.black]
114 [tool.black]
115 exclude = 'timing\.py'
115 exclude = 'timing\.py'
General Comments 0
You need to be logged in to leave comments. Login now