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