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