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