Show More
@@ -16,115 +16,18 b' requires utilities, which are not available under Windows."""' | |||
|
16 | 16 | import sys, os |
|
17 | 17 | from glob import glob |
|
18 | 18 | from setupext import install_data_ext |
|
19 | ||
|
19 | 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 | 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 | 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 | 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 | 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 | 32 | # Call the setup() routine which does most of the work |
|
130 | 33 | setup(name = name, |
@@ -139,14 +42,8 b' setup(name = name,' | |||
|
139 | 42 | platforms = platforms, |
|
140 | 43 | keywords = keywords, |
|
141 | 44 | packages = ['IPython', 'IPython.Extensions'], |
|
142 | #scripts = scriptfiles, | |
|
143 | 45 | cmdclass = {'install_data': install_data_ext}, |
|
144 |
data_files = [ |
|
|
145 | ('data', os.path.join(docdirbase, 'examples'), | |
|
146 | examfiles), | |
|
147 | ('data', os.path.join(docdirbase, 'manual'), | |
|
148 | manfiles), | |
|
149 | ('data', manpagebase, manpages), | |
|
46 | data_files = [ | |
|
150 | 47 | ('lib', 'IPython/UserConfig', cfgfiles)], |
|
151 | 48 | # egg options |
|
152 | 49 | entry_points = { |
General Comments 0
You need to be logged in to leave comments.
Login now