Show More
@@ -1,54 +1,53 b'' | |||||
1 | # http://travis-ci.org/#!/ipython/ipython |
|
1 | # http://travis-ci.org/#!/ipython/ipython | |
2 | language: python |
|
2 | language: python | |
3 | python: |
|
3 | python: | |
4 | - "nightly" |
|
4 | - "nightly" | |
5 | - 3.6 |
|
5 | - 3.6 | |
6 | - 3.5 |
|
6 | - 3.5 | |
7 | - 3.4 |
|
7 | - 3.4 | |
8 | - 3.3 |
|
|||
9 | sudo: false |
|
8 | sudo: false | |
10 | env: |
|
9 | env: | |
11 | global: |
|
10 | global: | |
12 | - PATH=$TRAVIS_BUILD_DIR/pandoc:$PATH |
|
11 | - PATH=$TRAVIS_BUILD_DIR/pandoc:$PATH | |
13 | group: edge |
|
12 | group: edge | |
14 | before_install: |
|
13 | before_install: | |
15 | - 'if [[ $GROUP != js* ]]; then COVERAGE=""; fi' |
|
14 | - 'if [[ $GROUP != js* ]]; then COVERAGE=""; fi' | |
16 | install: |
|
15 | install: | |
17 | - pip install setuptools pip --upgrade |
|
16 | - pip install setuptools pip --upgrade | |
18 | - pip install -e file://$PWD#egg=ipython[test] --upgrade |
|
17 | - pip install -e file://$PWD#egg=ipython[test] --upgrade | |
19 | - pip install codecov --upgrade |
|
18 | - pip install codecov --upgrade | |
20 | - sudo apt-get install graphviz |
|
19 | - sudo apt-get install graphviz | |
21 | script: |
|
20 | script: | |
22 | - cd /tmp && iptest --coverage xml && cd - |
|
21 | - cd /tmp && iptest --coverage xml && cd - | |
23 | # On the latest Python only, make sure that the docs build. |
|
22 | # On the latest Python only, make sure that the docs build. | |
24 | - | |
|
23 | - | | |
25 | if [[ "$TRAVIS_PYTHON_VERSION" == "3.6" ]]; then |
|
24 | if [[ "$TRAVIS_PYTHON_VERSION" == "3.6" ]]; then | |
26 | pip install -r docs/requirements.txt |
|
25 | pip install -r docs/requirements.txt | |
27 | make -C docs/ html SPHINXOPTS="-W" |
|
26 | make -C docs/ html SPHINXOPTS="-W" | |
28 | fi |
|
27 | fi | |
29 | after_success: |
|
28 | after_success: | |
30 | - cp /tmp/ipy_coverage.xml ./ |
|
29 | - cp /tmp/ipy_coverage.xml ./ | |
31 | - cp /tmp/.coverage ./ |
|
30 | - cp /tmp/.coverage ./ | |
32 | - codecov |
|
31 | - codecov | |
33 |
|
32 | |||
34 | matrix: |
|
33 | matrix: | |
35 | allow_failures: |
|
34 | allow_failures: | |
36 | - python: nightly |
|
35 | - python: nightly | |
37 |
|
36 | |||
38 | before_deploy: |
|
37 | before_deploy: | |
39 | - rm -rf dist/ |
|
38 | - rm -rf dist/ | |
40 | - python setup.py sdist |
|
39 | - python setup.py sdist | |
41 | - python setup.py bdist_wheel |
|
40 | - python setup.py bdist_wheel | |
42 |
|
41 | |||
43 | deploy: |
|
42 | deploy: | |
44 | provider: releases |
|
43 | provider: releases | |
45 | api_key: |
|
44 | api_key: | |
46 | secure: Y/Ae9tYs5aoBU8bDjN2YrwGG6tCbezj/h3Lcmtx8HQavSbBgXnhnZVRb2snOKD7auqnqjfT/7QMm4ZyKvaOEgyggGktKqEKYHC8KOZ7yp8I5/UMDtk6j9TnXpSqqBxPiud4MDV76SfRYEQiaDoG4tGGvSfPJ9KcNjKrNvSyyxns= |
|
45 | secure: Y/Ae9tYs5aoBU8bDjN2YrwGG6tCbezj/h3Lcmtx8HQavSbBgXnhnZVRb2snOKD7auqnqjfT/7QMm4ZyKvaOEgyggGktKqEKYHC8KOZ7yp8I5/UMDtk6j9TnXpSqqBxPiud4MDV76SfRYEQiaDoG4tGGvSfPJ9KcNjKrNvSyyxns= | |
47 | file: dist/* |
|
46 | file: dist/* | |
48 | file_glob: true |
|
47 | file_glob: true | |
49 | skip_cleanup: true |
|
48 | skip_cleanup: true | |
50 | on: |
|
49 | on: | |
51 | repo: ipython/ipython |
|
50 | repo: ipython/ipython | |
52 | all_branches: true # Backports are released from e.g. 5.x branch |
|
51 | all_branches: true # Backports are released from e.g. 5.x branch | |
53 | tags: true |
|
52 | tags: true | |
54 | python: 3.6 # Any version should work, but we only need one |
|
53 | python: 3.6 # Any version should work, but we only need one |
@@ -1,151 +1,151 b'' | |||||
1 | # encoding: utf-8 |
|
1 | # encoding: utf-8 | |
2 | """ |
|
2 | """ | |
3 | IPython: tools for interactive and parallel computing in Python. |
|
3 | IPython: tools for interactive and parallel computing in Python. | |
4 |
|
4 | |||
5 | http://ipython.org |
|
5 | http://ipython.org | |
6 | """ |
|
6 | """ | |
7 | #----------------------------------------------------------------------------- |
|
7 | #----------------------------------------------------------------------------- | |
8 | # Copyright (c) 2008-2011, IPython Development Team. |
|
8 | # Copyright (c) 2008-2011, IPython Development Team. | |
9 | # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu> |
|
9 | # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu> | |
10 | # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de> |
|
10 | # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de> | |
11 | # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu> |
|
11 | # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu> | |
12 | # |
|
12 | # | |
13 | # Distributed under the terms of the Modified BSD License. |
|
13 | # Distributed under the terms of the Modified BSD License. | |
14 | # |
|
14 | # | |
15 | # The full license is in the file COPYING.txt, distributed with this software. |
|
15 | # The full license is in the file COPYING.txt, distributed with this software. | |
16 | #----------------------------------------------------------------------------- |
|
16 | #----------------------------------------------------------------------------- | |
17 |
|
17 | |||
18 | #----------------------------------------------------------------------------- |
|
18 | #----------------------------------------------------------------------------- | |
19 | # Imports |
|
19 | # Imports | |
20 | #----------------------------------------------------------------------------- |
|
20 | #----------------------------------------------------------------------------- | |
21 |
|
21 | |||
22 | import os |
|
22 | import os | |
23 | import sys |
|
23 | import sys | |
24 |
|
24 | |||
25 | #----------------------------------------------------------------------------- |
|
25 | #----------------------------------------------------------------------------- | |
26 | # Setup everything |
|
26 | # Setup everything | |
27 | #----------------------------------------------------------------------------- |
|
27 | #----------------------------------------------------------------------------- | |
28 |
|
28 | |||
29 | # Don't forget to also update setup.py when this changes! |
|
29 | # Don't forget to also update setup.py when this changes! | |
30 |
if sys.version_info < (3, |
|
30 | if sys.version_info < (3,4): | |
31 | raise ImportError( |
|
31 | raise ImportError( | |
32 | """ |
|
32 | """ | |
33 | IPython 6.0+ does not support Python 2.6, 2.7, 3.0, 3.1, or 3.2. |
|
33 | IPython 6.3+ supports Python 3.4 and above. | |
34 | When using Python 2.7, please install IPython 5.x LTS Long Term Support version. |
|
34 | When using Python 2.7, please install IPython 5.x LTS Long Term Support version. | |
35 | Beginning with IPython 6.0, Python 3.3 and above is required. |
|
35 | Python 3.3 was supported up to IPython 6.2. | |
36 |
|
36 | |||
37 | See IPython `README.rst` file for more information: |
|
37 | See IPython `README.rst` file for more information: | |
38 |
|
38 | |||
39 | https://github.com/ipython/ipython/blob/master/README.rst |
|
39 | https://github.com/ipython/ipython/blob/master/README.rst | |
40 |
|
40 | |||
41 | """) |
|
41 | """) | |
42 |
|
42 | |||
43 | # Make it easy to import extensions - they are always directly on pythonpath. |
|
43 | # Make it easy to import extensions - they are always directly on pythonpath. | |
44 | # Therefore, non-IPython modules can be added to extensions directory. |
|
44 | # Therefore, non-IPython modules can be added to extensions directory. | |
45 | # This should probably be in ipapp.py. |
|
45 | # This should probably be in ipapp.py. | |
46 | sys.path.append(os.path.join(os.path.dirname(__file__), "extensions")) |
|
46 | sys.path.append(os.path.join(os.path.dirname(__file__), "extensions")) | |
47 |
|
47 | |||
48 | #----------------------------------------------------------------------------- |
|
48 | #----------------------------------------------------------------------------- | |
49 | # Setup the top level names |
|
49 | # Setup the top level names | |
50 | #----------------------------------------------------------------------------- |
|
50 | #----------------------------------------------------------------------------- | |
51 |
|
51 | |||
52 | from .core.getipython import get_ipython |
|
52 | from .core.getipython import get_ipython | |
53 | from .core import release |
|
53 | from .core import release | |
54 | from .core.application import Application |
|
54 | from .core.application import Application | |
55 | from .terminal.embed import embed |
|
55 | from .terminal.embed import embed | |
56 |
|
56 | |||
57 | from .core.interactiveshell import InteractiveShell |
|
57 | from .core.interactiveshell import InteractiveShell | |
58 | from .testing import test |
|
58 | from .testing import test | |
59 | from .utils.sysinfo import sys_info |
|
59 | from .utils.sysinfo import sys_info | |
60 | from .utils.frame import extract_module_locals |
|
60 | from .utils.frame import extract_module_locals | |
61 |
|
61 | |||
62 | # Release data |
|
62 | # Release data | |
63 | __author__ = '%s <%s>' % (release.author, release.author_email) |
|
63 | __author__ = '%s <%s>' % (release.author, release.author_email) | |
64 | __license__ = release.license |
|
64 | __license__ = release.license | |
65 | __version__ = release.version |
|
65 | __version__ = release.version | |
66 | version_info = release.version_info |
|
66 | version_info = release.version_info | |
67 |
|
67 | |||
68 | def embed_kernel(module=None, local_ns=None, **kwargs): |
|
68 | def embed_kernel(module=None, local_ns=None, **kwargs): | |
69 | """Embed and start an IPython kernel in a given scope. |
|
69 | """Embed and start an IPython kernel in a given scope. | |
70 |
|
70 | |||
71 | If you don't want the kernel to initialize the namespace |
|
71 | If you don't want the kernel to initialize the namespace | |
72 | from the scope of the surrounding function, |
|
72 | from the scope of the surrounding function, | |
73 | and/or you want to load full IPython configuration, |
|
73 | and/or you want to load full IPython configuration, | |
74 | you probably want `IPython.start_kernel()` instead. |
|
74 | you probably want `IPython.start_kernel()` instead. | |
75 |
|
75 | |||
76 | Parameters |
|
76 | Parameters | |
77 | ---------- |
|
77 | ---------- | |
78 | module : ModuleType, optional |
|
78 | module : ModuleType, optional | |
79 | The module to load into IPython globals (default: caller) |
|
79 | The module to load into IPython globals (default: caller) | |
80 | local_ns : dict, optional |
|
80 | local_ns : dict, optional | |
81 | The namespace to load into IPython user namespace (default: caller) |
|
81 | The namespace to load into IPython user namespace (default: caller) | |
82 |
|
82 | |||
83 | kwargs : various, optional |
|
83 | kwargs : various, optional | |
84 | Further keyword args are relayed to the IPKernelApp constructor, |
|
84 | Further keyword args are relayed to the IPKernelApp constructor, | |
85 | allowing configuration of the Kernel. Will only have an effect |
|
85 | allowing configuration of the Kernel. Will only have an effect | |
86 | on the first embed_kernel call for a given process. |
|
86 | on the first embed_kernel call for a given process. | |
87 | """ |
|
87 | """ | |
88 |
|
88 | |||
89 | (caller_module, caller_locals) = extract_module_locals(1) |
|
89 | (caller_module, caller_locals) = extract_module_locals(1) | |
90 | if module is None: |
|
90 | if module is None: | |
91 | module = caller_module |
|
91 | module = caller_module | |
92 | if local_ns is None: |
|
92 | if local_ns is None: | |
93 | local_ns = caller_locals |
|
93 | local_ns = caller_locals | |
94 |
|
94 | |||
95 | # Only import .zmq when we really need it |
|
95 | # Only import .zmq when we really need it | |
96 | from ipykernel.embed import embed_kernel as real_embed_kernel |
|
96 | from ipykernel.embed import embed_kernel as real_embed_kernel | |
97 | real_embed_kernel(module=module, local_ns=local_ns, **kwargs) |
|
97 | real_embed_kernel(module=module, local_ns=local_ns, **kwargs) | |
98 |
|
98 | |||
99 | def start_ipython(argv=None, **kwargs): |
|
99 | def start_ipython(argv=None, **kwargs): | |
100 | """Launch a normal IPython instance (as opposed to embedded) |
|
100 | """Launch a normal IPython instance (as opposed to embedded) | |
101 |
|
101 | |||
102 | `IPython.embed()` puts a shell in a particular calling scope, |
|
102 | `IPython.embed()` puts a shell in a particular calling scope, | |
103 | such as a function or method for debugging purposes, |
|
103 | such as a function or method for debugging purposes, | |
104 | which is often not desirable. |
|
104 | which is often not desirable. | |
105 |
|
105 | |||
106 | `start_ipython()` does full, regular IPython initialization, |
|
106 | `start_ipython()` does full, regular IPython initialization, | |
107 | including loading startup files, configuration, etc. |
|
107 | including loading startup files, configuration, etc. | |
108 | much of which is skipped by `embed()`. |
|
108 | much of which is skipped by `embed()`. | |
109 |
|
109 | |||
110 | This is a public API method, and will survive implementation changes. |
|
110 | This is a public API method, and will survive implementation changes. | |
111 |
|
111 | |||
112 | Parameters |
|
112 | Parameters | |
113 | ---------- |
|
113 | ---------- | |
114 |
|
114 | |||
115 | argv : list or None, optional |
|
115 | argv : list or None, optional | |
116 | If unspecified or None, IPython will parse command-line options from sys.argv. |
|
116 | If unspecified or None, IPython will parse command-line options from sys.argv. | |
117 | To prevent any command-line parsing, pass an empty list: `argv=[]`. |
|
117 | To prevent any command-line parsing, pass an empty list: `argv=[]`. | |
118 | user_ns : dict, optional |
|
118 | user_ns : dict, optional | |
119 | specify this dictionary to initialize the IPython user namespace with particular values. |
|
119 | specify this dictionary to initialize the IPython user namespace with particular values. | |
120 | kwargs : various, optional |
|
120 | kwargs : various, optional | |
121 | Any other kwargs will be passed to the Application constructor, |
|
121 | Any other kwargs will be passed to the Application constructor, | |
122 | such as `config`. |
|
122 | such as `config`. | |
123 | """ |
|
123 | """ | |
124 | from IPython.terminal.ipapp import launch_new_instance |
|
124 | from IPython.terminal.ipapp import launch_new_instance | |
125 | return launch_new_instance(argv=argv, **kwargs) |
|
125 | return launch_new_instance(argv=argv, **kwargs) | |
126 |
|
126 | |||
127 | def start_kernel(argv=None, **kwargs): |
|
127 | def start_kernel(argv=None, **kwargs): | |
128 | """Launch a normal IPython kernel instance (as opposed to embedded) |
|
128 | """Launch a normal IPython kernel instance (as opposed to embedded) | |
129 |
|
129 | |||
130 | `IPython.embed_kernel()` puts a shell in a particular calling scope, |
|
130 | `IPython.embed_kernel()` puts a shell in a particular calling scope, | |
131 | such as a function or method for debugging purposes, |
|
131 | such as a function or method for debugging purposes, | |
132 | which is often not desirable. |
|
132 | which is often not desirable. | |
133 |
|
133 | |||
134 | `start_kernel()` does full, regular IPython initialization, |
|
134 | `start_kernel()` does full, regular IPython initialization, | |
135 | including loading startup files, configuration, etc. |
|
135 | including loading startup files, configuration, etc. | |
136 | much of which is skipped by `embed()`. |
|
136 | much of which is skipped by `embed()`. | |
137 |
|
137 | |||
138 | Parameters |
|
138 | Parameters | |
139 | ---------- |
|
139 | ---------- | |
140 |
|
140 | |||
141 | argv : list or None, optional |
|
141 | argv : list or None, optional | |
142 | If unspecified or None, IPython will parse command-line options from sys.argv. |
|
142 | If unspecified or None, IPython will parse command-line options from sys.argv. | |
143 | To prevent any command-line parsing, pass an empty list: `argv=[]`. |
|
143 | To prevent any command-line parsing, pass an empty list: `argv=[]`. | |
144 | user_ns : dict, optional |
|
144 | user_ns : dict, optional | |
145 | specify this dictionary to initialize the IPython user namespace with particular values. |
|
145 | specify this dictionary to initialize the IPython user namespace with particular values. | |
146 | kwargs : various, optional |
|
146 | kwargs : various, optional | |
147 | Any other kwargs will be passed to the Application constructor, |
|
147 | Any other kwargs will be passed to the Application constructor, | |
148 | such as `config`. |
|
148 | such as `config`. | |
149 | """ |
|
149 | """ | |
150 | from IPython.kernel.zmq.kernelapp import launch_new_instance |
|
150 | from IPython.kernel.zmq.kernelapp import launch_new_instance | |
151 | return launch_new_instance(argv=argv, **kwargs) |
|
151 | return launch_new_instance(argv=argv, **kwargs) |
@@ -1,266 +1,264 b'' | |||||
1 | #!/usr/bin/env python3 |
|
1 | #!/usr/bin/env python3 | |
2 | # -*- coding: utf-8 -*- |
|
2 | # -*- coding: utf-8 -*- | |
3 | """Setup script for IPython. |
|
3 | """Setup script for IPython. | |
4 |
|
4 | |||
5 | Under Posix environments it works like a typical setup.py script. |
|
5 | Under Posix environments it works like a typical setup.py script. | |
6 | Under Windows, the command sdist is not supported, since IPython |
|
6 | Under Windows, the command sdist is not supported, since IPython | |
7 | requires utilities which are not available under Windows.""" |
|
7 | requires utilities which are not available under Windows.""" | |
8 |
|
8 | |||
9 | #----------------------------------------------------------------------------- |
|
9 | #----------------------------------------------------------------------------- | |
10 | # Copyright (c) 2008-2011, IPython Development Team. |
|
10 | # Copyright (c) 2008-2011, IPython Development Team. | |
11 | # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu> |
|
11 | # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu> | |
12 | # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de> |
|
12 | # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de> | |
13 | # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu> |
|
13 | # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu> | |
14 | # |
|
14 | # | |
15 | # Distributed under the terms of the Modified BSD License. |
|
15 | # Distributed under the terms of the Modified BSD License. | |
16 | # |
|
16 | # | |
17 | # The full license is in the file COPYING.rst, distributed with this software. |
|
17 | # The full license is in the file COPYING.rst, distributed with this software. | |
18 | #----------------------------------------------------------------------------- |
|
18 | #----------------------------------------------------------------------------- | |
19 |
|
19 | |||
20 | from __future__ import print_function |
|
20 | from __future__ import print_function | |
21 |
|
21 | |||
22 | import os |
|
22 | import os | |
23 | import sys |
|
23 | import sys | |
24 |
|
24 | |||
25 | # **Python version check** |
|
25 | # **Python version check** | |
26 | # |
|
26 | # | |
27 | # This check is also made in IPython/__init__, don't forget to update both when |
|
27 | # This check is also made in IPython/__init__, don't forget to update both when | |
28 | # changing Python version requirements. |
|
28 | # changing Python version requirements. | |
29 |
if sys.version_info < (3, |
|
29 | if sys.version_info < (3, 4): | |
30 | pip_message = 'This may be due to an out of date pip. Make sure you have pip >= 9.0.1.' |
|
30 | pip_message = 'This may be due to an out of date pip. Make sure you have pip >= 9.0.1.' | |
31 | try: |
|
31 | try: | |
32 | import pip |
|
32 | import pip | |
33 | pip_version = tuple([int(x) for x in pip.__version__.split('.')[:3]]) |
|
33 | pip_version = tuple([int(x) for x in pip.__version__.split('.')[:3]]) | |
34 | if pip_version < (9, 0, 1) : |
|
34 | if pip_version < (9, 0, 1) : | |
35 | pip_message = 'Your pip version is out of date, please install pip >= 9.0.1. '\ |
|
35 | pip_message = 'Your pip version is out of date, please install pip >= 9.0.1. '\ | |
36 | 'pip {} detected.'.format(pip.__version__) |
|
36 | 'pip {} detected.'.format(pip.__version__) | |
37 | else: |
|
37 | else: | |
38 | # pip is new enough - it must be something else |
|
38 | # pip is new enough - it must be something else | |
39 | pip_message = '' |
|
39 | pip_message = '' | |
40 | except Exception: |
|
40 | except Exception: | |
41 | pass |
|
41 | pass | |
42 |
|
42 | |||
43 |
|
43 | |||
44 | error = """ |
|
44 | error = """ | |
45 | IPython 6.0+ does not support Python 2.6, 2.7, 3.0, 3.1, or 3.2. |
|
45 | IPython 6.0+ does not support Python 2.6, 2.7, 3.0, 3.1, or 3.2. | |
46 | When using Python 2.7, please install IPython 5.x LTS Long Term Support version. |
|
46 | When using Python 2.7, please install IPython 5.x LTS Long Term Support version. | |
47 | Beginning with IPython 6.0, Python 3.3 and above is required. |
|
47 | Beginning with IPython 6.0, Python 3.3 and above is required. | |
48 |
|
48 | |||
49 | See IPython `README.rst` file for more information: |
|
49 | See IPython `README.rst` file for more information: | |
50 |
|
50 | |||
51 | https://github.com/ipython/ipython/blob/master/README.rst |
|
51 | https://github.com/ipython/ipython/blob/master/README.rst | |
52 |
|
52 | |||
53 | Python {py} detected. |
|
53 | Python {py} detected. | |
54 | {pip} |
|
54 | {pip} | |
55 | """.format(py=sys.version_info, pip=pip_message ) |
|
55 | """.format(py=sys.version_info, pip=pip_message ) | |
56 |
|
56 | |||
57 | print(error, file=sys.stderr) |
|
57 | print(error, file=sys.stderr) | |
58 | sys.exit(1) |
|
58 | sys.exit(1) | |
59 |
|
59 | |||
60 | # At least we're on the python version we need, move on. |
|
60 | # At least we're on the python version we need, move on. | |
61 |
|
61 | |||
62 | # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly |
|
62 | # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly | |
63 | # update it when the contents of directories change. |
|
63 | # update it when the contents of directories change. | |
64 | if os.path.exists('MANIFEST'): os.remove('MANIFEST') |
|
64 | if os.path.exists('MANIFEST'): os.remove('MANIFEST') | |
65 |
|
65 | |||
66 | from distutils.core import setup |
|
66 | from distutils.core import setup | |
67 |
|
67 | |||
68 | # Our own imports |
|
68 | # Our own imports | |
69 | from setupbase import target_update |
|
69 | from setupbase import target_update | |
70 |
|
70 | |||
71 | from setupbase import ( |
|
71 | from setupbase import ( | |
72 | setup_args, |
|
72 | setup_args, | |
73 | find_packages, |
|
73 | find_packages, | |
74 | find_package_data, |
|
74 | find_package_data, | |
75 | check_package_data_first, |
|
75 | check_package_data_first, | |
76 | find_entry_points, |
|
76 | find_entry_points, | |
77 | build_scripts_entrypt, |
|
77 | build_scripts_entrypt, | |
78 | find_data_files, |
|
78 | find_data_files, | |
79 | git_prebuild, |
|
79 | git_prebuild, | |
80 | install_symlinked, |
|
80 | install_symlinked, | |
81 | install_lib_symlink, |
|
81 | install_lib_symlink, | |
82 | install_scripts_for_symlink, |
|
82 | install_scripts_for_symlink, | |
83 | unsymlink, |
|
83 | unsymlink, | |
84 | ) |
|
84 | ) | |
85 |
|
85 | |||
86 | isfile = os.path.isfile |
|
86 | isfile = os.path.isfile | |
87 | pjoin = os.path.join |
|
87 | pjoin = os.path.join | |
88 |
|
88 | |||
89 | #------------------------------------------------------------------------------- |
|
89 | #------------------------------------------------------------------------------- | |
90 | # Handle OS specific things |
|
90 | # Handle OS specific things | |
91 | #------------------------------------------------------------------------------- |
|
91 | #------------------------------------------------------------------------------- | |
92 |
|
92 | |||
93 | if os.name in ('nt','dos'): |
|
93 | if os.name in ('nt','dos'): | |
94 | os_name = 'windows' |
|
94 | os_name = 'windows' | |
95 | else: |
|
95 | else: | |
96 | os_name = os.name |
|
96 | os_name = os.name | |
97 |
|
97 | |||
98 | # Under Windows, 'sdist' has not been supported. Now that the docs build with |
|
98 | # Under Windows, 'sdist' has not been supported. Now that the docs build with | |
99 | # Sphinx it might work, but let's not turn it on until someone confirms that it |
|
99 | # Sphinx it might work, but let's not turn it on until someone confirms that it | |
100 | # actually works. |
|
100 | # actually works. | |
101 | if os_name == 'windows' and 'sdist' in sys.argv: |
|
101 | if os_name == 'windows' and 'sdist' in sys.argv: | |
102 | print('The sdist command is not available under Windows. Exiting.') |
|
102 | print('The sdist command is not available under Windows. Exiting.') | |
103 | sys.exit(1) |
|
103 | sys.exit(1) | |
104 |
|
104 | |||
105 |
|
105 | |||
106 | #------------------------------------------------------------------------------- |
|
106 | #------------------------------------------------------------------------------- | |
107 | # Things related to the IPython documentation |
|
107 | # Things related to the IPython documentation | |
108 | #------------------------------------------------------------------------------- |
|
108 | #------------------------------------------------------------------------------- | |
109 |
|
109 | |||
110 | # update the manuals when building a source dist |
|
110 | # update the manuals when building a source dist | |
111 | if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'): |
|
111 | if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'): | |
112 |
|
112 | |||
113 | # List of things to be updated. Each entry is a triplet of args for |
|
113 | # List of things to be updated. Each entry is a triplet of args for | |
114 | # target_update() |
|
114 | # target_update() | |
115 | to_update = [ |
|
115 | to_update = [ | |
116 | ('docs/man/ipython.1.gz', |
|
116 | ('docs/man/ipython.1.gz', | |
117 | ['docs/man/ipython.1'], |
|
117 | ['docs/man/ipython.1'], | |
118 | 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'), |
|
118 | 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'), | |
119 | ] |
|
119 | ] | |
120 |
|
120 | |||
121 |
|
121 | |||
122 | [ target_update(*t) for t in to_update ] |
|
122 | [ target_update(*t) for t in to_update ] | |
123 |
|
123 | |||
124 | #--------------------------------------------------------------------------- |
|
124 | #--------------------------------------------------------------------------- | |
125 | # Find all the packages, package data, and data_files |
|
125 | # Find all the packages, package data, and data_files | |
126 | #--------------------------------------------------------------------------- |
|
126 | #--------------------------------------------------------------------------- | |
127 |
|
127 | |||
128 | packages = find_packages() |
|
128 | packages = find_packages() | |
129 | package_data = find_package_data() |
|
129 | package_data = find_package_data() | |
130 |
|
130 | |||
131 | data_files = find_data_files() |
|
131 | data_files = find_data_files() | |
132 |
|
132 | |||
133 | setup_args['packages'] = packages |
|
133 | setup_args['packages'] = packages | |
134 | setup_args['package_data'] = package_data |
|
134 | setup_args['package_data'] = package_data | |
135 | setup_args['data_files'] = data_files |
|
135 | setup_args['data_files'] = data_files | |
136 |
|
136 | |||
137 | #--------------------------------------------------------------------------- |
|
137 | #--------------------------------------------------------------------------- | |
138 | # custom distutils commands |
|
138 | # custom distutils commands | |
139 | #--------------------------------------------------------------------------- |
|
139 | #--------------------------------------------------------------------------- | |
140 | # imports here, so they are after setuptools import if there was one |
|
140 | # imports here, so they are after setuptools import if there was one | |
141 | from distutils.command.sdist import sdist |
|
141 | from distutils.command.sdist import sdist | |
142 |
|
142 | |||
143 | setup_args['cmdclass'] = { |
|
143 | setup_args['cmdclass'] = { | |
144 | 'build_py': \ |
|
144 | 'build_py': \ | |
145 | check_package_data_first(git_prebuild('IPython')), |
|
145 | check_package_data_first(git_prebuild('IPython')), | |
146 | 'sdist' : git_prebuild('IPython', sdist), |
|
146 | 'sdist' : git_prebuild('IPython', sdist), | |
147 | 'symlink': install_symlinked, |
|
147 | 'symlink': install_symlinked, | |
148 | 'install_lib_symlink': install_lib_symlink, |
|
148 | 'install_lib_symlink': install_lib_symlink, | |
149 | 'install_scripts_sym': install_scripts_for_symlink, |
|
149 | 'install_scripts_sym': install_scripts_for_symlink, | |
150 | 'unsymlink': unsymlink, |
|
150 | 'unsymlink': unsymlink, | |
151 | } |
|
151 | } | |
152 |
|
152 | |||
153 |
|
153 | |||
154 | #--------------------------------------------------------------------------- |
|
154 | #--------------------------------------------------------------------------- | |
155 | # Handle scripts, dependencies, and setuptools specific things |
|
155 | # Handle scripts, dependencies, and setuptools specific things | |
156 | #--------------------------------------------------------------------------- |
|
156 | #--------------------------------------------------------------------------- | |
157 |
|
157 | |||
158 | # For some commands, use setuptools. Note that we do NOT list install here! |
|
158 | # For some commands, use setuptools. Note that we do NOT list install here! | |
159 | # If you want a setuptools-enhanced install, just run 'setupegg.py install' |
|
159 | # If you want a setuptools-enhanced install, just run 'setupegg.py install' | |
160 | needs_setuptools = {'develop', 'release', 'bdist_egg', 'bdist_rpm', |
|
160 | needs_setuptools = {'develop', 'release', 'bdist_egg', 'bdist_rpm', | |
161 | 'bdist', 'bdist_dumb', 'bdist_wininst', 'bdist_wheel', |
|
161 | 'bdist', 'bdist_dumb', 'bdist_wininst', 'bdist_wheel', | |
162 | 'egg_info', 'easy_install', 'upload', 'install_egg_info', |
|
162 | 'egg_info', 'easy_install', 'upload', 'install_egg_info', | |
163 | } |
|
163 | } | |
164 |
|
164 | |||
165 | if len(needs_setuptools.intersection(sys.argv)) > 0: |
|
165 | if len(needs_setuptools.intersection(sys.argv)) > 0: | |
166 | import setuptools |
|
166 | import setuptools | |
167 |
|
167 | |||
168 | # This dict is used for passing extra arguments that are setuptools |
|
168 | # This dict is used for passing extra arguments that are setuptools | |
169 | # specific to setup |
|
169 | # specific to setup | |
170 | setuptools_extra_args = {} |
|
170 | setuptools_extra_args = {} | |
171 |
|
171 | |||
172 | # setuptools requirements |
|
172 | # setuptools requirements | |
173 |
|
173 | |||
174 | extras_require = dict( |
|
174 | extras_require = dict( | |
175 | parallel = ['ipyparallel'], |
|
175 | parallel = ['ipyparallel'], | |
176 | qtconsole = ['qtconsole'], |
|
176 | qtconsole = ['qtconsole'], | |
177 | doc = ['Sphinx>=1.3'], |
|
177 | doc = ['Sphinx>=1.3'], | |
178 | test = ['nose>=0.10.1', 'requests', 'testpath', 'pygments', 'nbformat', 'ipykernel'], |
|
178 | test = ['nose>=0.10.1', 'requests', 'testpath', 'pygments', 'nbformat', 'ipykernel', 'numpy'], | |
179 | terminal = [], |
|
179 | terminal = [], | |
180 | kernel = ['ipykernel'], |
|
180 | kernel = ['ipykernel'], | |
181 | nbformat = ['nbformat'], |
|
181 | nbformat = ['nbformat'], | |
182 | notebook = ['notebook', 'ipywidgets'], |
|
182 | notebook = ['notebook', 'ipywidgets'], | |
183 | nbconvert = ['nbconvert'], |
|
183 | nbconvert = ['nbconvert'], | |
184 | ) |
|
184 | ) | |
185 |
|
185 | |||
186 | install_requires = [ |
|
186 | install_requires = [ | |
187 | 'setuptools>=18.5', |
|
187 | 'setuptools>=18.5', | |
188 | 'jedi>=0.10', |
|
188 | 'jedi>=0.10', | |
189 | 'decorator', |
|
189 | 'decorator', | |
190 | 'pickleshare', |
|
190 | 'pickleshare', | |
191 | 'simplegeneric>0.8', |
|
191 | 'simplegeneric>0.8', | |
192 | 'traitlets>=4.2', |
|
192 | 'traitlets>=4.2', | |
193 | 'prompt_toolkit>=1.0.15,<2.0.0', |
|
193 | 'prompt_toolkit>=1.0.15,<2.0.0', | |
194 | 'pygments', |
|
194 | 'pygments', | |
195 | 'backcall', |
|
195 | 'backcall', | |
196 | ] |
|
196 | ] | |
197 |
|
197 | |||
198 | # Platform-specific dependencies: |
|
198 | # Platform-specific dependencies: | |
199 | # This is the correct way to specify these, |
|
199 | # This is the correct way to specify these, | |
200 | # but requires pip >= 6. pip < 6 ignores these. |
|
200 | # but requires pip >= 6. pip < 6 ignores these. | |
201 |
|
201 | |||
202 | extras_require.update({ |
|
202 | extras_require.update({ | |
203 | 'test:python_version >= "3.4"': ['numpy'], |
|
|||
204 | ':python_version == "3.3"': ['pathlib2'], |
|
|||
205 | ':python_version <= "3.4"': ['typing'], |
|
203 | ':python_version <= "3.4"': ['typing'], | |
206 | ':sys_platform != "win32"': ['pexpect'], |
|
204 | ':sys_platform != "win32"': ['pexpect'], | |
207 | ':sys_platform == "darwin"': ['appnope'], |
|
205 | ':sys_platform == "darwin"': ['appnope'], | |
208 | ':sys_platform == "win32"': ['colorama'], |
|
206 | ':sys_platform == "win32"': ['colorama'], | |
209 | ':sys_platform == "win32" and python_version < "3.6"': ['win_unicode_console>=0.5'], |
|
207 | ':sys_platform == "win32" and python_version < "3.6"': ['win_unicode_console>=0.5'], | |
210 | }) |
|
208 | }) | |
211 | # FIXME: re-specify above platform dependencies for pip < 6 |
|
209 | # FIXME: re-specify above platform dependencies for pip < 6 | |
212 | # These would result in non-portable bdists. |
|
210 | # These would result in non-portable bdists. | |
213 | if not any(arg.startswith('bdist') for arg in sys.argv): |
|
211 | if not any(arg.startswith('bdist') for arg in sys.argv): | |
214 | if sys.platform == 'darwin': |
|
212 | if sys.platform == 'darwin': | |
215 | install_requires.extend(['appnope']) |
|
213 | install_requires.extend(['appnope']) | |
216 |
|
214 | |||
217 | if not sys.platform.startswith('win'): |
|
215 | if not sys.platform.startswith('win'): | |
218 | install_requires.append('pexpect') |
|
216 | install_requires.append('pexpect') | |
219 |
|
217 | |||
220 | # workaround pypa/setuptools#147, where setuptools misspells |
|
218 | # workaround pypa/setuptools#147, where setuptools misspells | |
221 | # platform_python_implementation as python_implementation |
|
219 | # platform_python_implementation as python_implementation | |
222 | if 'setuptools' in sys.modules: |
|
220 | if 'setuptools' in sys.modules: | |
223 | for key in list(extras_require): |
|
221 | for key in list(extras_require): | |
224 | if 'platform_python_implementation' in key: |
|
222 | if 'platform_python_implementation' in key: | |
225 | new_key = key.replace('platform_python_implementation', 'python_implementation') |
|
223 | new_key = key.replace('platform_python_implementation', 'python_implementation') | |
226 | extras_require[new_key] = extras_require.pop(key) |
|
224 | extras_require[new_key] = extras_require.pop(key) | |
227 |
|
225 | |||
228 | everything = set() |
|
226 | everything = set() | |
229 | for key, deps in extras_require.items(): |
|
227 | for key, deps in extras_require.items(): | |
230 | if ':' not in key: |
|
228 | if ':' not in key: | |
231 | everything.update(deps) |
|
229 | everything.update(deps) | |
232 | extras_require['all'] = everything |
|
230 | extras_require['all'] = everything | |
233 |
|
231 | |||
234 | if 'setuptools' in sys.modules: |
|
232 | if 'setuptools' in sys.modules: | |
235 |
setuptools_extra_args['python_requires'] = '>=3. |
|
233 | setuptools_extra_args['python_requires'] = '>=3.4' | |
236 | setuptools_extra_args['zip_safe'] = False |
|
234 | setuptools_extra_args['zip_safe'] = False | |
237 | setuptools_extra_args['entry_points'] = { |
|
235 | setuptools_extra_args['entry_points'] = { | |
238 | 'console_scripts': find_entry_points(), |
|
236 | 'console_scripts': find_entry_points(), | |
239 | 'pygments.lexers': [ |
|
237 | 'pygments.lexers': [ | |
240 | 'ipythonconsole = IPython.lib.lexers:IPythonConsoleLexer', |
|
238 | 'ipythonconsole = IPython.lib.lexers:IPythonConsoleLexer', | |
241 | 'ipython = IPython.lib.lexers:IPythonLexer', |
|
239 | 'ipython = IPython.lib.lexers:IPythonLexer', | |
242 | 'ipython3 = IPython.lib.lexers:IPython3Lexer', |
|
240 | 'ipython3 = IPython.lib.lexers:IPython3Lexer', | |
243 | ], |
|
241 | ], | |
244 | } |
|
242 | } | |
245 | setup_args['extras_require'] = extras_require |
|
243 | setup_args['extras_require'] = extras_require | |
246 | setup_args['install_requires'] = install_requires |
|
244 | setup_args['install_requires'] = install_requires | |
247 |
|
245 | |||
248 | else: |
|
246 | else: | |
249 | # scripts has to be a non-empty list, or install_scripts isn't called |
|
247 | # scripts has to be a non-empty list, or install_scripts isn't called | |
250 | setup_args['scripts'] = [e.split('=')[0].strip() for e in find_entry_points()] |
|
248 | setup_args['scripts'] = [e.split('=')[0].strip() for e in find_entry_points()] | |
251 |
|
249 | |||
252 | setup_args['cmdclass']['build_scripts'] = build_scripts_entrypt |
|
250 | setup_args['cmdclass']['build_scripts'] = build_scripts_entrypt | |
253 |
|
251 | |||
254 | #--------------------------------------------------------------------------- |
|
252 | #--------------------------------------------------------------------------- | |
255 | # Do the actual setup now |
|
253 | # Do the actual setup now | |
256 | #--------------------------------------------------------------------------- |
|
254 | #--------------------------------------------------------------------------- | |
257 |
|
255 | |||
258 | setup_args.update(setuptools_extra_args) |
|
256 | setup_args.update(setuptools_extra_args) | |
259 |
|
257 | |||
260 |
|
258 | |||
261 |
|
259 | |||
262 | def main(): |
|
260 | def main(): | |
263 | setup(**setup_args) |
|
261 | setup(**setup_args) | |
264 |
|
262 | |||
265 | if __name__ == '__main__': |
|
263 | if __name__ == '__main__': | |
266 | main() |
|
264 | main() |
General Comments 0
You need to be logged in to leave comments.
Login now