Show More
@@ -1,180 +1,185 b'' | |||||
1 | #!/usr/bin/env python |
|
1 | #!/usr/bin/env python | |
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) 2001-2005 Fernando Perez <fperez@colorado.edu> |
|
10 | # Copyright (C) 2001-2005 Fernando Perez <fperez@colorado.edu> | |
11 | # |
|
11 | # | |
12 | # Distributed under the terms of the BSD License. The full license is in |
|
12 | # Distributed under the terms of the BSD License. The full license is in | |
13 | # the file COPYING, distributed as part of this software. |
|
13 | # the file COPYING, distributed as part of this software. | |
14 | #***************************************************************************** |
|
14 | #***************************************************************************** | |
15 |
|
15 | |||
16 | # Stdlib imports |
|
16 | # Stdlib imports | |
17 | import os |
|
17 | import os | |
18 | import sys |
|
18 | import sys | |
19 |
|
19 | |||
20 | from glob import glob |
|
20 | from glob import glob | |
21 | from setupext import install_data_ext |
|
21 | from setupext import install_data_ext | |
22 |
|
22 | |||
23 | # A few handy globals |
|
23 | # A few handy globals | |
24 | isfile = os.path.isfile |
|
24 | isfile = os.path.isfile | |
25 | pjoin = os.path.join |
|
25 | pjoin = os.path.join | |
26 |
|
26 | |||
27 | # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly |
|
27 | # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly | |
28 | # update it when the contents of directories change. |
|
28 | # update it when the contents of directories change. | |
29 | if os.path.exists('MANIFEST'): os.remove('MANIFEST') |
|
29 | if os.path.exists('MANIFEST'): os.remove('MANIFEST') | |
30 |
|
30 | |||
31 | if os.name == 'posix': |
|
31 | if os.name == 'posix': | |
32 | os_name = 'posix' |
|
32 | os_name = 'posix' | |
33 | elif os.name in ['nt','dos']: |
|
33 | elif os.name in ['nt','dos']: | |
34 | os_name = 'windows' |
|
34 | os_name = 'windows' | |
35 | else: |
|
35 | else: | |
36 | print 'Unsupported operating system:',os.name |
|
36 | print 'Unsupported operating system:',os.name | |
37 | sys.exit(1) |
|
37 | sys.exit(1) | |
38 |
|
38 | |||
39 | # Under Windows, 'sdist' is not supported, since it requires lyxport (and |
|
39 | # Under Windows, 'sdist' is not supported, since it requires lyxport (and | |
40 | # hence lyx,perl,latex,pdflatex,latex2html,sh,...) |
|
40 | # hence lyx,perl,latex,pdflatex,latex2html,sh,...) | |
41 | if os_name == 'windows' and 'sdist' in sys.argv: |
|
41 | if os_name == 'windows' and 'sdist' in sys.argv: | |
42 | print 'The sdist command is not available under Windows. Exiting.' |
|
42 | print 'The sdist command is not available under Windows. Exiting.' | |
43 | sys.exit(1) |
|
43 | sys.exit(1) | |
44 |
|
44 | |||
45 | from distutils.core import setup |
|
45 | from distutils.core import setup | |
46 |
|
46 | |||
47 | # update the manuals when building a source dist |
|
47 | # update the manuals when building a source dist | |
48 | if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'): |
|
48 | if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'): | |
49 | from IPython.genutils import target_update |
|
49 | from IPython.genutils import target_update | |
50 | # list of things to be updated. Each entry is a triplet of args for |
|
50 | # list of things to be updated. Each entry is a triplet of args for | |
51 | # target_update() |
|
51 | # target_update() | |
52 | to_update = [('doc/magic.tex', |
|
52 | to_update = [('doc/magic.tex', | |
53 | ['IPython/Magic.py'], |
|
53 | ['IPython/Magic.py'], | |
54 | "cd doc && ./update_magic.sh" ), |
|
54 | "cd doc && ./update_magic.sh" ), | |
55 |
|
55 | |||
56 | ('doc/manual.lyx', |
|
56 | ('doc/manual.lyx', | |
57 | ['IPython/Release.py','doc/manual_base.lyx'], |
|
57 | ['IPython/Release.py','doc/manual_base.lyx'], | |
58 | "cd doc && ./update_version.sh" ), |
|
58 | "cd doc && ./update_version.sh" ), | |
59 |
|
59 | |||
60 | ('doc/manual/manual.html', |
|
60 | ('doc/manual/manual.html', | |
61 | ['doc/manual.lyx', |
|
61 | ['doc/manual.lyx', | |
62 | 'doc/magic.tex', |
|
62 | 'doc/magic.tex', | |
63 | 'doc/examples/example-gnuplot.py', |
|
63 | 'doc/examples/example-gnuplot.py', | |
64 | 'doc/examples/example-embed.py', |
|
64 | 'doc/examples/example-embed.py', | |
65 | 'doc/examples/example-embed-short.py', |
|
65 | 'doc/examples/example-embed-short.py', | |
66 | 'IPython/UserConfig/ipythonrc', |
|
66 | 'IPython/UserConfig/ipythonrc', | |
67 | ], |
|
67 | ], | |
68 | "cd doc && " |
|
68 | "cd doc && " | |
69 | "lyxport -tt --leave --pdf " |
|
69 | "lyxport -tt --leave --pdf " | |
70 | "--html -o '-noinfo -split +1 -local_icons' manual.lyx"), |
|
70 | "--html -o '-noinfo -split +1 -local_icons' manual.lyx"), | |
71 |
|
71 | |||
72 | ('doc/new_design.pdf', |
|
72 | ('doc/new_design.pdf', | |
73 | ['doc/new_design.lyx'], |
|
73 | ['doc/new_design.lyx'], | |
74 | "cd doc && lyxport -tt --pdf new_design.lyx"), |
|
74 | "cd doc && lyxport -tt --pdf new_design.lyx"), | |
75 |
|
75 | |||
76 | ('doc/ipython.1.gz', |
|
76 | ('doc/ipython.1.gz', | |
77 | ['doc/ipython.1'], |
|
77 | ['doc/ipython.1'], | |
78 | "cd doc && gzip -9c ipython.1 > ipython.1.gz"), |
|
78 | "cd doc && gzip -9c ipython.1 > ipython.1.gz"), | |
79 |
|
79 | |||
80 | ('doc/pycolor.1.gz', |
|
80 | ('doc/pycolor.1.gz', | |
81 | ['doc/pycolor.1'], |
|
81 | ['doc/pycolor.1'], | |
82 | "cd doc && gzip -9c pycolor.1 > pycolor.1.gz"), |
|
82 | "cd doc && gzip -9c pycolor.1 > pycolor.1.gz"), | |
83 | ] |
|
83 | ] | |
84 | for target in to_update: |
|
84 | for target in to_update: | |
85 | target_update(*target) |
|
85 | target_update(*target) | |
86 |
|
86 | |||
87 | # Release.py contains version, authors, license, url, keywords, etc. |
|
87 | # Release.py contains version, authors, license, url, keywords, etc. | |
88 | execfile(pjoin('IPython','Release.py')) |
|
88 | execfile(pjoin('IPython','Release.py')) | |
89 |
|
89 | |||
90 | # A little utility we'll need below, since glob() does NOT allow you to do |
|
90 | # A little utility we'll need below, since glob() does NOT allow you to do | |
91 | # exclusion on multiple endings! |
|
91 | # exclusion on multiple endings! | |
92 | def file_doesnt_endwith(test,endings): |
|
92 | def file_doesnt_endwith(test,endings): | |
93 | """Return true if test is a file and its name does NOT end with any |
|
93 | """Return true if test is a file and its name does NOT end with any | |
94 | of the strings listed in endings.""" |
|
94 | of the strings listed in endings.""" | |
95 | if not isfile(test): |
|
95 | if not isfile(test): | |
96 | return False |
|
96 | return False | |
97 | for e in endings: |
|
97 | for e in endings: | |
98 | if test.endswith(e): |
|
98 | if test.endswith(e): | |
99 | return False |
|
99 | return False | |
100 | return True |
|
100 | return True | |
101 |
|
101 | |||
102 | # I can't find how to make distutils create a nested dir. structure, so |
|
102 | # I can't find how to make distutils create a nested dir. structure, so | |
103 | # in the meantime do it manually. Butt ugly. |
|
103 | # in the meantime do it manually. Butt ugly. | |
104 | # Note that http://www.redbrick.dcu.ie/~noel/distutils.html, ex. 2/3, contain |
|
104 | # Note that http://www.redbrick.dcu.ie/~noel/distutils.html, ex. 2/3, contain | |
105 | # information on how to do this more cleanly once python 2.4 can be assumed. |
|
105 | # information on how to do this more cleanly once python 2.4 can be assumed. | |
106 | # Thanks to Noel for the tip. |
|
106 | # Thanks to Noel for the tip. | |
107 |
docdirbase = 'share/doc/ipython |
|
107 | docdirbase = 'share/doc/ipython' | |
108 | manpagebase = 'share/man/man1' |
|
108 | manpagebase = 'share/man/man1' | |
109 |
|
109 | |||
110 | # We only need to exclude from this things NOT already excluded in the |
|
110 | # We only need to exclude from this things NOT already excluded in the | |
111 | # MANIFEST.in file. |
|
111 | # MANIFEST.in file. | |
112 | exclude = ('.sh','.1.gz') |
|
112 | exclude = ('.sh','.1.gz') | |
113 | docfiles = filter(lambda f:file_doesnt_endwith(f,exclude),glob('doc/*')) |
|
113 | docfiles = filter(lambda f:file_doesnt_endwith(f,exclude),glob('doc/*')) | |
114 |
|
114 | |||
115 | examfiles = filter(isfile, glob('doc/examples/*.py')) |
|
115 | examfiles = filter(isfile, glob('doc/examples/*.py')) | |
116 | manfiles = filter(isfile, glob('doc/manual/*.html')) + \ |
|
116 | manfiles = filter(isfile, glob('doc/manual/*.html')) + \ | |
117 | filter(isfile, glob('doc/manual/*.css')) + \ |
|
117 | filter(isfile, glob('doc/manual/*.css')) + \ | |
118 | filter(isfile, glob('doc/manual/*.png')) |
|
118 | filter(isfile, glob('doc/manual/*.png')) | |
119 | manpages = filter(isfile, glob('doc/*.1.gz')) |
|
119 | manpages = filter(isfile, glob('doc/*.1.gz')) | |
120 | cfgfiles = filter(isfile, glob('IPython/UserConfig/*')) |
|
120 | cfgfiles = filter(isfile, glob('IPython/UserConfig/*')) | |
121 | scriptfiles = filter(isfile, ['scripts/ipython','scripts/pycolor', |
|
121 | scriptfiles = filter(isfile, ['scripts/ipython','scripts/pycolor', | |
122 | 'scripts/irunner']) |
|
122 | 'scripts/irunner']) | |
123 | igridhelpfiles = filter(isfile, glob('IPython/Extensions/igrid_help.*')) |
|
123 | igridhelpfiles = filter(isfile, glob('IPython/Extensions/igrid_help.*')) | |
124 |
|
124 | |||
125 | # Script to be run by the windows binary installer after the default setup |
|
125 | # Script to be run by the windows binary installer after the default setup | |
126 | # routine, to add shortcuts and similar windows-only things. Windows |
|
126 | # routine, to add shortcuts and similar windows-only things. Windows | |
127 | # post-install scripts MUST reside in the scripts/ dir, otherwise distutils |
|
127 | # post-install scripts MUST reside in the scripts/ dir, otherwise distutils | |
128 | # doesn't find them. |
|
128 | # doesn't find them. | |
129 | if 'bdist_wininst' in sys.argv: |
|
129 | if 'bdist_wininst' in sys.argv: | |
130 | if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv): |
|
130 | if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv): | |
131 | print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting." |
|
131 | print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting." | |
132 | sys.exit(1) |
|
132 | sys.exit(1) | |
133 | scriptfiles.append('scripts/ipython_win_post_install.py') |
|
133 | scriptfiles.append('scripts/ipython_win_post_install.py') | |
134 |
|
134 | |||
135 | datafiles = [('data', docdirbase, docfiles), |
|
135 | datafiles = [('data', docdirbase, docfiles), | |
136 | ('data', pjoin(docdirbase, 'examples'),examfiles), |
|
136 | ('data', pjoin(docdirbase, 'examples'),examfiles), | |
137 | ('data', pjoin(docdirbase, 'manual'),manfiles), |
|
137 | ('data', pjoin(docdirbase, 'manual'),manfiles), | |
138 | ('data', manpagebase, manpages), |
|
138 | ('data', manpagebase, manpages), | |
139 | ('lib', 'IPython/UserConfig', cfgfiles), |
|
|||
140 | ('data',pjoin(docdirbase, 'extensions'),igridhelpfiles), |
|
139 | ('data',pjoin(docdirbase, 'extensions'),igridhelpfiles), | |
141 | ] |
|
140 | ] | |
142 |
|
141 | |||
143 | if 'setuptools' in sys.modules: |
|
142 | if 'setuptools' in sys.modules: | |
144 | # setuptools config for egg building |
|
143 | # setuptools config for egg building | |
145 | egg_extra_kwds = { |
|
144 | egg_extra_kwds = { | |
146 | 'entry_points': { |
|
145 | 'entry_points': { | |
147 | 'console_scripts': [ |
|
146 | 'console_scripts': [ | |
148 | 'ipython = IPython.ipapi:launch_new_instance', |
|
147 | 'ipython = IPython.ipapi:launch_new_instance', | |
149 | 'pycolor = IPython.PyColorize:main' |
|
148 | 'pycolor = IPython.PyColorize:main' | |
150 | ]} |
|
149 | ]} | |
151 | } |
|
150 | } | |
152 | scriptfiles = [] |
|
151 | scriptfiles = [] | |
153 | # eggs will lack docs, eaxmples |
|
152 | # eggs will lack docs, eaxmples | |
154 | datafiles = [] |
|
153 | datafiles = [] | |
155 |
|
154 | |||
156 | #datafiles = [('lib', 'IPython/UserConfig', cfgfiles)] |
|
155 | #datafiles = [('lib', 'IPython/UserConfig', cfgfiles)] | |
157 | else: |
|
156 | else: | |
158 | egg_extra_kwds = {} |
|
157 | egg_extra_kwds = {} | |
|
158 | # package_data of setuptools was introduced to distutils in 2.4 | |||
|
159 | if sys.version_info < (2,4): | |||
|
160 | datafiles.append(('lib', 'IPython/UserConfig', cfgfiles)) | |||
|
161 | ||||
|
162 | ||||
159 |
|
163 | |||
160 |
|
164 | |||
161 | # Call the setup() routine which does most of the work |
|
165 | # Call the setup() routine which does most of the work | |
162 | setup(name = name, |
|
166 | setup(name = name, | |
163 | version = version, |
|
167 | version = version, | |
164 | description = description, |
|
168 | description = description, | |
165 | long_description = long_description, |
|
169 | long_description = long_description, | |
166 | author = authors['Fernando'][0], |
|
170 | author = authors['Fernando'][0], | |
167 | author_email = authors['Fernando'][1], |
|
171 | author_email = authors['Fernando'][1], | |
168 | url = url, |
|
172 | url = url, | |
169 | download_url = download_url, |
|
173 | download_url = download_url, | |
170 | license = license, |
|
174 | license = license, | |
171 | platforms = platforms, |
|
175 | platforms = platforms, | |
172 | keywords = keywords, |
|
176 | keywords = keywords, | |
173 | packages = ['IPython', 'IPython.Extensions', 'IPython.external', 'IPython.gui', 'IPython.gui.wx'], |
|
177 | packages = ['IPython', 'IPython.Extensions', 'IPython.external', 'IPython.gui', 'IPython.gui.wx', 'IPython.UserConfig'], | |
174 | scripts = scriptfiles, |
|
178 | scripts = scriptfiles, | |
|
179 | package_data = {'IPython.UserConfig' : ['*'] }, | |||
175 |
|
180 | |||
176 | cmdclass = {'install_data': install_data_ext}, |
|
181 | cmdclass = {'install_data': install_data_ext}, | |
177 | data_files = datafiles, |
|
182 | data_files = datafiles, | |
178 | # extra params needed for eggs |
|
183 | # extra params needed for eggs | |
179 | **egg_extra_kwds |
|
184 | **egg_extra_kwds | |
180 | ) |
|
185 | ) |
General Comments 0
You need to be logged in to leave comments.
Login now