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