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