Show More
@@ -1,158 +1,158 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | """Setup script for IPython. |
|
2 | """Setup script for IPython. | |
3 |
|
3 | |||
4 | Under Posix environments it works like a typical setup.py script. |
|
4 | Under Posix environments it works like a typical setup.py script. | |
5 | Under Windows, the command sdist is not supported, since IPython |
|
5 | Under Windows, the command sdist is not supported, since IPython | |
6 | requires utilities which are not available under Windows.""" |
|
6 | requires utilities which are not available under Windows.""" | |
7 |
|
7 | |||
8 | #----------------------------------------------------------------------------- |
|
8 | #----------------------------------------------------------------------------- | |
9 | # Copyright (c) 2008-2011, IPython Development Team. |
|
9 | # Copyright (c) 2008-2011, IPython Development Team. | |
10 | # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu> |
|
10 | # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu> | |
11 | # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de> |
|
11 | # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de> | |
12 | # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu> |
|
12 | # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu> | |
13 | # |
|
13 | # | |
14 | # Distributed under the terms of the Modified BSD License. |
|
14 | # Distributed under the terms of the Modified BSD License. | |
15 | # |
|
15 | # | |
16 | # The full license is in the file COPYING.rst, distributed with this software. |
|
16 | # The full license is in the file COPYING.rst, distributed with this software. | |
17 | #----------------------------------------------------------------------------- |
|
17 | #----------------------------------------------------------------------------- | |
18 |
|
18 | |||
19 | import os |
|
19 | import os | |
20 | import sys |
|
20 | import sys | |
21 |
|
21 | |||
22 | # **Python version check** |
|
22 | # **Python version check** | |
23 | # |
|
23 | # | |
24 | # This check is also made in IPython/__init__, don't forget to update both when |
|
24 | # This check is also made in IPython/__init__, don't forget to update both when | |
25 | # changing Python version requirements. |
|
25 | # changing Python version requirements. | |
26 | if sys.version_info < (3, 9): |
|
26 | if sys.version_info < (3, 9): | |
27 | pip_message = 'This may be due to an out of date pip. Make sure you have pip >= 9.0.1.' |
|
27 | pip_message = 'This may be due to an out of date pip. Make sure you have pip >= 9.0.1.' | |
28 | try: |
|
28 | try: | |
29 | import pip |
|
29 | import pip | |
30 | pip_version = tuple([int(x) for x in pip.__version__.split('.')[:3]]) |
|
30 | pip_version = tuple([int(x) for x in pip.__version__.split('.')[:3]]) | |
31 | if pip_version < (9, 0, 1) : |
|
31 | if pip_version < (9, 0, 1) : | |
32 | pip_message = 'Your pip version is out of date, please install pip >= 9.0.1. '\ |
|
32 | pip_message = 'Your pip version is out of date, please install pip >= 9.0.1. '\ | |
33 | 'pip {} detected.'.format(pip.__version__) |
|
33 | 'pip {} detected.'.format(pip.__version__) | |
34 | else: |
|
34 | else: | |
35 | # pip is new enough - it must be something else |
|
35 | # pip is new enough - it must be something else | |
36 | pip_message = '' |
|
36 | pip_message = '' | |
37 | except Exception: |
|
37 | except Exception: | |
38 | pass |
|
38 | pass | |
39 |
|
39 | |||
40 |
|
40 | |||
41 | error = """ |
|
41 | error = """ | |
42 |
IPython 8.13+ supports Python 3. |
|
42 | IPython 8.13+ supports Python 3.9 and above, following NEP 29. | |
43 | IPython 8.0-8.12 supports Python 3.8 and above, following NEP 29. |
|
43 | IPython 8.0-8.12 supports Python 3.8 and above, following NEP 29. | |
44 | When using Python 2.7, please install IPython 5.x LTS Long Term Support version. |
|
44 | When using Python 2.7, please install IPython 5.x LTS Long Term Support version. | |
45 | Python 3.3 and 3.4 were supported up to IPython 6.x. |
|
45 | Python 3.3 and 3.4 were supported up to IPython 6.x. | |
46 | Python 3.5 was supported with IPython 7.0 to 7.9. |
|
46 | Python 3.5 was supported with IPython 7.0 to 7.9. | |
47 | Python 3.6 was supported with IPython up to 7.16. |
|
47 | Python 3.6 was supported with IPython up to 7.16. | |
48 | Python 3.7 was still supported with the 7.x branch. |
|
48 | Python 3.7 was still supported with the 7.x branch. | |
49 |
|
49 | |||
50 | See IPython `README.rst` file for more information: |
|
50 | See IPython `README.rst` file for more information: | |
51 |
|
51 | |||
52 | https://github.com/ipython/ipython/blob/main/README.rst |
|
52 | https://github.com/ipython/ipython/blob/main/README.rst | |
53 |
|
53 | |||
54 | Python {py} detected. |
|
54 | Python {py} detected. | |
55 | {pip} |
|
55 | {pip} | |
56 | """.format( |
|
56 | """.format( | |
57 | py=sys.version_info, pip=pip_message |
|
57 | py=sys.version_info, pip=pip_message | |
58 | ) |
|
58 | ) | |
59 |
|
59 | |||
60 | print(error, file=sys.stderr) |
|
60 | print(error, file=sys.stderr) | |
61 | sys.exit(1) |
|
61 | sys.exit(1) | |
62 |
|
62 | |||
63 | # At least we're on the python version we need, move on. |
|
63 | # At least we're on the python version we need, move on. | |
64 |
|
64 | |||
65 | from setuptools import setup |
|
65 | from setuptools import setup | |
66 |
|
66 | |||
67 | # Our own imports |
|
67 | # Our own imports | |
68 | sys.path.insert(0, ".") |
|
68 | sys.path.insert(0, ".") | |
69 |
|
69 | |||
70 | from setupbase import target_update, find_entry_points |
|
70 | from setupbase import target_update, find_entry_points | |
71 |
|
71 | |||
72 | from setupbase import ( |
|
72 | from setupbase import ( | |
73 | setup_args, |
|
73 | setup_args, | |
74 | check_package_data_first, |
|
74 | check_package_data_first, | |
75 | find_data_files, |
|
75 | find_data_files, | |
76 | git_prebuild, |
|
76 | git_prebuild, | |
77 | install_symlinked, |
|
77 | install_symlinked, | |
78 | install_lib_symlink, |
|
78 | install_lib_symlink, | |
79 | install_scripts_for_symlink, |
|
79 | install_scripts_for_symlink, | |
80 | unsymlink, |
|
80 | unsymlink, | |
81 | ) |
|
81 | ) | |
82 |
|
82 | |||
83 | #------------------------------------------------------------------------------- |
|
83 | #------------------------------------------------------------------------------- | |
84 | # Handle OS specific things |
|
84 | # Handle OS specific things | |
85 | #------------------------------------------------------------------------------- |
|
85 | #------------------------------------------------------------------------------- | |
86 |
|
86 | |||
87 | if os.name in ('nt','dos'): |
|
87 | if os.name in ('nt','dos'): | |
88 | os_name = 'windows' |
|
88 | os_name = 'windows' | |
89 | else: |
|
89 | else: | |
90 | os_name = os.name |
|
90 | os_name = os.name | |
91 |
|
91 | |||
92 | # Under Windows, 'sdist' has not been supported. Now that the docs build with |
|
92 | # Under Windows, 'sdist' has not been supported. Now that the docs build with | |
93 | # Sphinx it might work, but let's not turn it on until someone confirms that it |
|
93 | # Sphinx it might work, but let's not turn it on until someone confirms that it | |
94 | # actually works. |
|
94 | # actually works. | |
95 | if os_name == 'windows' and 'sdist' in sys.argv: |
|
95 | if os_name == 'windows' and 'sdist' in sys.argv: | |
96 | print('The sdist command is not available under Windows. Exiting.') |
|
96 | print('The sdist command is not available under Windows. Exiting.') | |
97 | sys.exit(1) |
|
97 | sys.exit(1) | |
98 |
|
98 | |||
99 |
|
99 | |||
100 | #------------------------------------------------------------------------------- |
|
100 | #------------------------------------------------------------------------------- | |
101 | # Things related to the IPython documentation |
|
101 | # Things related to the IPython documentation | |
102 | #------------------------------------------------------------------------------- |
|
102 | #------------------------------------------------------------------------------- | |
103 |
|
103 | |||
104 | # update the manuals when building a source dist |
|
104 | # update the manuals when building a source dist | |
105 | if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'): |
|
105 | if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'): | |
106 |
|
106 | |||
107 | # List of things to be updated. Each entry is a triplet of args for |
|
107 | # List of things to be updated. Each entry is a triplet of args for | |
108 | # target_update() |
|
108 | # target_update() | |
109 | to_update = [ |
|
109 | to_update = [ | |
110 | ( |
|
110 | ( | |
111 | "docs/man/ipython.1.gz", |
|
111 | "docs/man/ipython.1.gz", | |
112 | ["docs/man/ipython.1"], |
|
112 | ["docs/man/ipython.1"], | |
113 | "cd docs/man && python -m gzip --best ipython.1", |
|
113 | "cd docs/man && python -m gzip --best ipython.1", | |
114 | ), |
|
114 | ), | |
115 | ] |
|
115 | ] | |
116 |
|
116 | |||
117 |
|
117 | |||
118 | [ target_update(*t) for t in to_update ] |
|
118 | [ target_update(*t) for t in to_update ] | |
119 |
|
119 | |||
120 | #--------------------------------------------------------------------------- |
|
120 | #--------------------------------------------------------------------------- | |
121 | # Find all the packages, package data, and data_files |
|
121 | # Find all the packages, package data, and data_files | |
122 | #--------------------------------------------------------------------------- |
|
122 | #--------------------------------------------------------------------------- | |
123 |
|
123 | |||
124 | data_files = find_data_files() |
|
124 | data_files = find_data_files() | |
125 |
|
125 | |||
126 | setup_args['data_files'] = data_files |
|
126 | setup_args['data_files'] = data_files | |
127 |
|
127 | |||
128 | #--------------------------------------------------------------------------- |
|
128 | #--------------------------------------------------------------------------- | |
129 | # custom distutils commands |
|
129 | # custom distutils commands | |
130 | #--------------------------------------------------------------------------- |
|
130 | #--------------------------------------------------------------------------- | |
131 | # imports here, so they are after setuptools import if there was one |
|
131 | # imports here, so they are after setuptools import if there was one | |
132 | from setuptools.command.sdist import sdist |
|
132 | from setuptools.command.sdist import sdist | |
133 |
|
133 | |||
134 | setup_args['cmdclass'] = { |
|
134 | setup_args['cmdclass'] = { | |
135 | 'build_py': \ |
|
135 | 'build_py': \ | |
136 | check_package_data_first(git_prebuild('IPython')), |
|
136 | check_package_data_first(git_prebuild('IPython')), | |
137 | 'sdist' : git_prebuild('IPython', sdist), |
|
137 | 'sdist' : git_prebuild('IPython', sdist), | |
138 | 'symlink': install_symlinked, |
|
138 | 'symlink': install_symlinked, | |
139 | 'install_lib_symlink': install_lib_symlink, |
|
139 | 'install_lib_symlink': install_lib_symlink, | |
140 | 'install_scripts_sym': install_scripts_for_symlink, |
|
140 | 'install_scripts_sym': install_scripts_for_symlink, | |
141 | 'unsymlink': unsymlink, |
|
141 | 'unsymlink': unsymlink, | |
142 | } |
|
142 | } | |
143 |
|
143 | |||
144 | setup_args["entry_points"] = { |
|
144 | setup_args["entry_points"] = { | |
145 | "console_scripts": find_entry_points(), |
|
145 | "console_scripts": find_entry_points(), | |
146 | "pygments.lexers": [ |
|
146 | "pygments.lexers": [ | |
147 | "ipythonconsole = IPython.lib.lexers:IPythonConsoleLexer", |
|
147 | "ipythonconsole = IPython.lib.lexers:IPythonConsoleLexer", | |
148 | "ipython = IPython.lib.lexers:IPythonLexer", |
|
148 | "ipython = IPython.lib.lexers:IPythonLexer", | |
149 | "ipython3 = IPython.lib.lexers:IPython3Lexer", |
|
149 | "ipython3 = IPython.lib.lexers:IPython3Lexer", | |
150 | ], |
|
150 | ], | |
151 | } |
|
151 | } | |
152 |
|
152 | |||
153 | #--------------------------------------------------------------------------- |
|
153 | #--------------------------------------------------------------------------- | |
154 | # Do the actual setup now |
|
154 | # Do the actual setup now | |
155 | #--------------------------------------------------------------------------- |
|
155 | #--------------------------------------------------------------------------- | |
156 |
|
156 | |||
157 | if __name__ == "__main__": |
|
157 | if __name__ == "__main__": | |
158 | setup(**setup_args) |
|
158 | setup(**setup_args) |
General Comments 0
You need to be logged in to leave comments.
Login now