##// END OF EJS Templates
adding docs to egg because of problems in win32 easy_install == dev
vivainio -
Show More
@@ -1,171 +1,171 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
118 118 # Script to be run by the windows binary installer after the default setup
119 119 # routine, to add shortcuts and similar windows-only things. Windows
120 120 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
121 121 # doesn't find them.
122 122 if 'bdist_wininst' in sys.argv:
123 123 if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
124 124 print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting."
125 125 sys.exit(1)
126 126 scriptfiles.append('scripts/ipython_win_post_install.py')
127 127
128 128 datafiles = [('data', docdirbase, docfiles),
129 129 ('data', os.path.join(docdirbase, 'examples'),
130 130 examfiles),
131 131 ('data', os.path.join(docdirbase, 'manual'),
132 132 manfiles),
133 133 ('data', manpagebase, manpages),
134 134 ('lib', 'IPython/UserConfig', cfgfiles)]
135 135
136 136 if 'setuptools' in sys.modules:
137 137 # setuptools config for egg building
138 138 egg_extra_kwds = {
139 139 'entry_points': {
140 140 'console_scripts': [
141 141 'ipython = IPython.ipapi:launch_new_instance',
142 142 'pycolor = IPython.PyColorize:main'
143 143 ]}
144 144 }
145 145 scriptfiles = []
146 # eggs will lack docs, examples
147 datafiles = [('lib', 'IPython/UserConfig', cfgfiles)]
146 # eggs will lack docs, examples XXX not anymore
147 #datafiles = [('lib', 'IPython/UserConfig', cfgfiles)]
148 148 else:
149 149 egg_extra_kwds = {}
150 150
151 151
152 152 # Call the setup() routine which does most of the work
153 153 setup(name = name,
154 154 version = version,
155 155 description = description,
156 156 long_description = long_description,
157 157 author = authors['Fernando'][0],
158 158 author_email = authors['Fernando'][1],
159 159 url = url,
160 160 download_url = download_url,
161 161 license = license,
162 162 platforms = platforms,
163 163 keywords = keywords,
164 164 packages = ['IPython', 'IPython.Extensions'],
165 165 scripts = scriptfiles,
166 166
167 167 cmdclass = {'install_data': install_data_ext},
168 168 data_files = datafiles,
169 169 # extra params needed for eggs
170 170 **egg_extra_kwds
171 171 )
General Comments 0
You need to be logged in to leave comments. Login now