Show More
@@ -1,158 +1,55 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 | import sys, os |
|
16 | import sys, os | |
17 | from glob import glob |
|
17 | from glob import glob | |
18 | from setupext import install_data_ext |
|
18 | from setupext import install_data_ext | |
|
19 | ||||
19 | isfile = os.path.isfile |
|
20 | isfile = os.path.isfile | |
20 |
|
21 | |||
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') |
|
22 | if os.path.exists('MANIFEST'): os.remove('MANIFEST') | |
24 |
|
23 | |||
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 |
|
24 | from setuptools import setup | |
41 |
|
25 | |||
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 |
|
26 | |||
83 | # Release.py contains version, authors, license, url, keywords, etc. |
|
|||
84 | execfile(os.path.join('IPython','Release.py')) |
|
27 | execfile(os.path.join('IPython','Release.py')) | |
85 |
|
28 | |||
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/*')) |
|
29 | cfgfiles = filter(isfile, glob('IPython/UserConfig/*')) | |
117 | scriptfiles = filter(isfile, ['scripts/ipython','scripts/pycolor']) |
|
|||
118 |
|
30 | |||
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 |
|
31 | |||
129 | # Call the setup() routine which does most of the work |
|
32 | # Call the setup() routine which does most of the work | |
130 | setup(name = name, |
|
33 | setup(name = name, | |
131 | version = version, |
|
34 | version = version, | |
132 | description = description, |
|
35 | description = description, | |
133 | long_description = long_description, |
|
36 | long_description = long_description, | |
134 | author = authors['Fernando'][0], |
|
37 | author = authors['Fernando'][0], | |
135 | author_email = authors['Fernando'][1], |
|
38 | author_email = authors['Fernando'][1], | |
136 | url = url, |
|
39 | url = url, | |
137 | download_url = download_url, |
|
40 | download_url = download_url, | |
138 | license = license, |
|
41 | license = license, | |
139 | platforms = platforms, |
|
42 | platforms = platforms, | |
140 | keywords = keywords, |
|
43 | keywords = keywords, | |
141 | packages = ['IPython', 'IPython.Extensions'], |
|
44 | packages = ['IPython', 'IPython.Extensions'], | |
142 | #scripts = scriptfiles, |
|
|||
143 | cmdclass = {'install_data': install_data_ext}, |
|
45 | cmdclass = {'install_data': install_data_ext}, | |
144 |
data_files = [ |
|
46 | data_files = [ | |
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)], |
|
47 | ('lib', 'IPython/UserConfig', cfgfiles)], | |
151 | # egg options |
|
48 | # egg options | |
152 | entry_points = { |
|
49 | entry_points = { | |
153 | 'console_scripts': [ |
|
50 | 'console_scripts': [ | |
154 | 'ipython = IPython.ipapi:launch_new_instance', |
|
51 | 'ipython = IPython.ipapi:launch_new_instance', | |
155 | 'pycolor = IPython.PyColorize:main' |
|
52 | 'pycolor = IPython.PyColorize:main' | |
156 | ], |
|
53 | ], | |
157 | } |
|
54 | } | |
158 | ) |
|
55 | ) |
General Comments 0
You need to be logged in to leave comments.
Login now