##// END OF EJS Templates
remove all datafiles from the egg
vivainio -
Show More
@@ -1,178 +1,180 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-%s' % version
107 docdirbase = 'share/doc/ipython-%s' % version
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),
139 ('lib', 'IPython/UserConfig', cfgfiles),
140 ('data',pjoin(docdirbase, 'extensions'),igridhelpfiles),
140 ('data',pjoin(docdirbase, 'extensions'),igridhelpfiles),
141 ]
141 ]
142
142
143 if 'setuptools' in sys.modules:
143 if 'setuptools' in sys.modules:
144 # setuptools config for egg building
144 # setuptools config for egg building
145 egg_extra_kwds = {
145 egg_extra_kwds = {
146 'entry_points': {
146 'entry_points': {
147 'console_scripts': [
147 'console_scripts': [
148 'ipython = IPython.ipapi:launch_new_instance',
148 'ipython = IPython.ipapi:launch_new_instance',
149 'pycolor = IPython.PyColorize:main'
149 'pycolor = IPython.PyColorize:main'
150 ]}
150 ]}
151 }
151 }
152 scriptfiles = []
152 scriptfiles = []
153 # eggs will lack docs, examples XXX not anymore
153 # eggs will lack docs, eaxmples
154 datafiles = []
155
154 #datafiles = [('lib', 'IPython/UserConfig', cfgfiles)]
156 #datafiles = [('lib', 'IPython/UserConfig', cfgfiles)]
155 else:
157 else:
156 egg_extra_kwds = {}
158 egg_extra_kwds = {}
157
159
158
160
159 # Call the setup() routine which does most of the work
161 # Call the setup() routine which does most of the work
160 setup(name = name,
162 setup(name = name,
161 version = version,
163 version = version,
162 description = description,
164 description = description,
163 long_description = long_description,
165 long_description = long_description,
164 author = authors['Fernando'][0],
166 author = authors['Fernando'][0],
165 author_email = authors['Fernando'][1],
167 author_email = authors['Fernando'][1],
166 url = url,
168 url = url,
167 download_url = download_url,
169 download_url = download_url,
168 license = license,
170 license = license,
169 platforms = platforms,
171 platforms = platforms,
170 keywords = keywords,
172 keywords = keywords,
171 packages = ['IPython', 'IPython.Extensions', 'IPython.external'],
173 packages = ['IPython', 'IPython.Extensions', 'IPython.external'],
172 scripts = scriptfiles,
174 scripts = scriptfiles,
173
175
174 cmdclass = {'install_data': install_data_ext},
176 cmdclass = {'install_data': install_data_ext},
175 data_files = datafiles,
177 data_files = datafiles,
176 # extra params needed for eggs
178 # extra params needed for eggs
177 **egg_extra_kwds
179 **egg_extra_kwds
178 )
180 )
General Comments 0
You need to be logged in to leave comments. Login now