Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 635 lines (512 sloc) 21.319 kb
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
1 """
2 This paver file is intented to help with the release process as much as
3 possible. It relies on virtualenv to generate 'bootstrap' environments as
4 independent from the user system as possible (e.g. to make sure the sphinx doc
5 is built against the built scipy, not an installed one).
6
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
7 The release is assumed to be done on OS X. See release.sh for a script that
8 employs the Paver tasks defined in this file, and builds everything required
9 for a release at once.
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
10
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
11
12 Building a Windows installer from Wine
13 ======================================
14
15 The Python version the installer is for can be specified with the ``-p 2.6``
16 switch (this works for all installer tasks). To build a simple (no SSE
17 instructions) installer, do::
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
18
19 paver bdist_wininst_simple
20
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
21 This assumes that blas/lapack are in c:\local\lib inside drive_c. You will
22 have to make sure your Wine python locations (WINE_PYS) are configured
23 correctly.
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
24
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
25 The superpack requires all the Atlas libraries for every arch to be installed
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
26 (see SITECFG), and can then be built as follows::
27
28 paver bdist_superpack
29
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
30
31 Building an installer for OS X
32 ==============================
33
34 For a simple installer, which is just an mpkg inside a dmg, do::
35
36 paver simple_dmg
37
38 For a more fancy installer which includes documentation and looks better, do::
39
40 paver pdf # needs to be done only once
41 paver dmg
42
43
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
44 Building changelog + notes
45 ==========================
46
47 Assumes you have git and the binaries/tarballs in installers/::
48
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
49 paver write_release_and_log
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
50
51 This automatically put the checksum into NOTES.txt, and write the Changelog
52 which can be uploaded to sourceforge.
53
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
54
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
55 TODO
56 ====
57 - make it more easily customizable (through command line args)
58 - missing targets: install & test, sdist test, debian packaging
59 - fix bdist_mpkg: we build the same source twice -> how to make sure we use
60 the same underlying python for egg install in venv and for bdist_mpkg
61 """
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
62
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
63 import os
64 import sys
65 import subprocess
66 import re
67 import shutil
68 try:
69 from hash import md5
70 except ImportError:
71 import md5
72
73 import distutils
74
75 try:
76 from paver.tasks import VERSION as _PVER
77 if not _PVER >= '1.0':
78 raise RuntimeError("paver version >= 1.0 required (was %s)" % _PVER)
79 except ImportError, e:
80 raise RuntimeError("paver version >= 1.0 required")
81
82 import paver
83 import paver.doctools
84 import paver.path
cbb82e4 David Cournapeau Fix bdist_wininst_simple task.
cournape authored
85 from paver.easy import options, Bunch, task, needs, dry, sh, call_task, cmdopts
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
86
87 sys.path.insert(0, os.path.dirname(__file__))
88 try:
89 setup_py = __import__("setup")
90 FULLVERSION = setup_py.FULLVERSION
91 finally:
92 sys.path.pop(0)
93
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
94
95 #-----------------------------------
96 # Things to be changed for a release
97 #-----------------------------------
98
99 # Source of the release notes
cc34137 Ralf Gommers REL: add support for building Windows binary for Python 3.2 to release s...
rgommers authored
100 RELEASE = 'doc/release/0.10.0-notes.rst'
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
101
102 # Start/end of the log (from git)
cc34137 Ralf Gommers REL: add support for building Windows binary for Python 3.2 to release s...
rgommers authored
103 LOG_START = 'v0.9.0'
104 LOG_END = 'master'
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
105
106
107 #-------------------------------------------------------
108 # Hardcoded build/install dirs, virtualenv options, etc.
109 #-------------------------------------------------------
110
b8fa0df David Cournapeau Do not hardcode python version anymore in bdist_mpkg.
cournape authored
111 # Default python version
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
112 PYVER="2.6"
113
114 # Paver options object, holds all default dirs
115 options(bootstrap=Bunch(bootstrap_dir="bootstrap"),
116 virtualenv=Bunch(packages_to_install=["sphinx==1.0.4", "numpydoc"],
117 no_site_packages=False),
118 sphinx=Bunch(builddir="build", sourcedir="source", docroot='doc'),
119 superpack=Bunch(builddir="build-superpack",
120 bindir=os.path.join("build-superpack","binaries")),
121 installers=Bunch(releasedir="release",
122 installersdir=os.path.join("release", "installers")),
123 doc=Bunch(doc_root="doc",
124 sdir=os.path.join("doc", "source"),
125 bdir=os.path.join("doc", "build"),
126 bdir_latex=os.path.join("doc", "build", "latex"),
127 destdir_pdf=os.path.join("build_doc", "pdf")),
128 html=Bunch(builddir=os.path.join("build", "html")),
129 dmg=Bunch(python_version=PYVER),
130 bdist_wininst_simple=Bunch(python_version=PYVER),)
131
132 # Where we can find BLAS/LAPACK/ATLAS on Windows/Wine
133 SITECFG = {"sse3" : {'BLAS': 'None', 'LAPACK': 'None', 'ATLAS': r'C:\local\lib\yop\sse3'},
134 "sse2" : {'BLAS': 'None', 'LAPACK': 'None', 'ATLAS': r'C:\local\lib\yop\sse2'},
135 "nosse" : {'ATLAS': 'None', 'BLAS': r'C:\local\lib\yop\nosse',
136 'LAPACK': r'C:\local\lib\yop\nosse'}}
b8fa0df David Cournapeau Do not hardcode python version anymore in bdist_mpkg.
cournape authored
137
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
138 # Wine config for win32 builds
f53f767 David Cournapeau Fix paver file to handle bdist targets on windows.
cournape authored
139 if sys.platform == "win32":
140 WINE_PY25 = [r"C:\Python25\python.exe"]
141 WINE_PY26 = [r"C:\Python26\python26.exe"]
80fd3e5 Ralf Gommers REL: Update pavement.py for 0.9.0 and add paths for python 2.7.
rgommers authored
142 WINE_PY27 = [r"C:\Python27\python27.exe"]
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
143 WINE_PY31 = [r"C:\Python31\python.exe"]
cc34137 Ralf Gommers REL: add support for building Windows binary for Python 3.2 to release s...
rgommers authored
144 WINE_PY32 = [r"C:\Python32\python.exe"]
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
145 WINDOWS_ENV = os.environ
493cdbe Ralf Gommers REL: cleanups of Paver script taken from the 0.7.x branch.
rgommers authored
146 MAKENSIS = ["makensis"]
f53f767 David Cournapeau Fix paver file to handle bdist targets on windows.
cournape authored
147 elif sys.platform == "darwin":
493cdbe Ralf Gommers REL: cleanups of Paver script taken from the 0.7.x branch.
rgommers authored
148 WINE_PY25 = ["wine", os.environ['HOME'] + "/.wine/drive_c/Python25/python.exe"]
149 WINE_PY26 = ["wine", os.environ['HOME'] + "/.wine/drive_c/Python26/python.exe"]
80fd3e5 Ralf Gommers REL: Update pavement.py for 0.9.0 and add paths for python 2.7.
rgommers authored
150 WINE_PY27 = ["wine", os.environ['HOME'] + "/.wine/drive_c/Python27/python.exe"]
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
151 WINE_PY31 = ["wine", os.environ['HOME'] + "/.wine/drive_c/Python31/python.exe"]
cc34137 Ralf Gommers REL: add support for building Windows binary for Python 3.2 to release s...
rgommers authored
152 WINE_PY32 = ["wine", os.environ['HOME'] + "/.wine/drive_c/Python32/python.exe"]
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
153 WINDOWS_ENV = os.environ
154 WINDOWS_ENV["DYLD_FALLBACK_LIBRARY_PATH"] = "/usr/X11/lib:/usr/lib"
493cdbe Ralf Gommers REL: cleanups of Paver script taken from the 0.7.x branch.
rgommers authored
155 MAKENSIS = ["wine", "makensis"]
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
156 else:
493cdbe Ralf Gommers REL: cleanups of Paver script taken from the 0.7.x branch.
rgommers authored
157 WINE_PY25 = [os.environ['HOME'] + "/.wine/drive_c/Python25/python.exe"]
158 WINE_PY26 = [os.environ['HOME'] + "/.wine/drive_c/Python26/python.exe"]
80fd3e5 Ralf Gommers REL: Update pavement.py for 0.9.0 and add paths for python 2.7.
rgommers authored
159 WINE_PY27 = [os.environ['HOME'] + "/.wine/drive_c/Python27/python.exe"]
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
160 WINE_PY31 = [os.environ['HOME'] + "/.wine/drive_c/Python31/python.exe"],
cc34137 Ralf Gommers REL: add support for building Windows binary for Python 3.2 to release s...
rgommers authored
161 WINE_PY32 = [os.environ['HOME'] + "/.wine/drive_c/Python32/python.exe"],
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
162 WINDOWS_ENV = os.environ
493cdbe Ralf Gommers REL: cleanups of Paver script taken from the 0.7.x branch.
rgommers authored
163 MAKENSIS = ["wine", "makensis"]
cc34137 Ralf Gommers REL: add support for building Windows binary for Python 3.2 to release s...
rgommers authored
164 WINE_PYS = {'3.2':WINE_PY32, '3.1':WINE_PY31, '2.7':WINE_PY27,
165 '2.6':WINE_PY26, '2.5':WINE_PY25}
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
166
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
167 # Framework Python locations on OS X
b8fa0df David Cournapeau Do not hardcode python version anymore in bdist_mpkg.
cournape authored
168 MPKG_PYTHON = {"2.5": "/Library/Frameworks/Python.framework/Versions/2.5/bin/python",
80fd3e5 Ralf Gommers REL: Update pavement.py for 0.9.0 and add paths for python 2.7.
rgommers authored
169 "2.6": "/Library/Frameworks/Python.framework/Versions/2.6/bin/python",
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
170 "2.7": "/Library/Frameworks/Python.framework/Versions/2.7/bin/python",
cc34137 Ralf Gommers REL: add support for building Windows binary for Python 3.2 to release s...
rgommers authored
171 "3.1": "/Library/Frameworks/Python.framework/Versions/3.1/bin/python3",
172 "3.2": "/Library/Frameworks/Python.framework/Versions/3.2/bin/python3"}
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
173 # Full path to the *static* gfortran runtime
174 LIBGFORTRAN_A_PATH = "/usr/local/lib/libgfortran.a"
175
176
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
177 #--------------------------------------
178 # Utility functions and bootstrap stuff
179 #--------------------------------------
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
180
9ae1fe1 David Cournapeau Add function to parse numpy version in paver script.
cournape authored
181 def parse_numpy_version(pyexec):
493cdbe Ralf Gommers REL: cleanups of Paver script taken from the 0.7.x branch.
rgommers authored
182 if isinstance(pyexec, str):
183 cmd = [pyexec, "-c", "'import numpy; print numpy.version.version'"]
184 else:
185 # sequence for pyexec
186 cmd = pyexec + ["-c", "'import numpy; print numpy.version.version'"]
9ae1fe1 David Cournapeau Add function to parse numpy version in paver script.
cournape authored
187
188 # Execute in shell because launching python from python does not work
189 # (hangs)
190 p = subprocess.Popen(" ".join(cmd), stdout=subprocess.PIPE, shell=True)
191 out = p.communicate()[0]
192 if p.returncode:
193 raise RuntimeError("Command %s failed" % " ".join(cmd))
194
195 a = re.compile("^([0-9]+)\.([0-9]+)\.([0-9]+)")
196 if a:
197 return tuple([int(i) for i in a.match(out).groups()[:3]])
198 else:
199 raise ValueError("Could not parse version (%s)" % out)
200
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
201 @task
202 def bootstrap():
203 """create virtualenv in ./install"""
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
204 try:
205 import virtualenv
206 except ImportError, e:
207 raise RuntimeError("virtualenv is needed for bootstrap")
208
209 bdir = options.bootstrap_dir
210 if not os.path.exists(bdir):
211 os.makedirs(bdir)
212 bscript = "boostrap.py"
213
214 options.virtualenv.script_name = os.path.join(options.bootstrap_dir,
215 bscript)
216 options.bootstrap.no_site_packages = False
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
217 call_task('paver.virtual.bootstrap')
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
218 sh('cd %s; %s %s' % (bdir, sys.executable, bscript))
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
219
220 @task
221 def clean():
222 """Remove build, dist, egg-info garbage."""
223 d = ['build', 'dist', 'scipy.egg-info']
224 for i in d:
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
225 if os.path.exists(i):
226 shutil.rmtree(i)
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
227
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
228 bdir = os.path.join('doc', options.sphinx.builddir)
229 if os.path.exists(bdir):
230 shutil.rmtree(bdir)
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
231
232 @task
233 def clean_bootstrap():
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
234 bdir = os.path.join(options.bootstrap.bootstrap_dir)
235 if os.path.exists(bdir):
236 shutil.rmtree(bdir)
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
237
238 @task
239 @needs('clean', 'clean_bootstrap')
240 def nuke():
241 """Remove everything: build dir, installers, bootstrap dirs, etc..."""
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
242 for d in [options.superpack.builddir, options.installers.releasedir]:
243 if os.path.exists(d):
244 shutil.rmtree(d)
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
245
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
246 #--------------------
247 # Documentation tasks
248 #--------------------
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
249
250 @task
251 def html(options):
252 """Build scipy documentation and put it into build/docs"""
253 # Don't use paver html target because of scipy bootstrapping problems
254 subprocess.check_call(["make", "html"], cwd="doc")
255 builtdocs = paver.path.path("doc") / options.sphinx.builddir / "html"
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
256 options.html.builddir.rmtree()
257 builtdocs.copytree(options.html.builddir)
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
258
259 @task
260 def latex():
261 """Build scipy documentation in latex format."""
262 subprocess.check_call(["make", "latex"], cwd="doc")
263
264 @task
265 @needs('latex')
266 def pdf():
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
267 sdir = options.doc.sdir
268 bdir = options.doc.bdir
269 bdir_latex = options.doc.bdir_latex
270 destdir_pdf = options.doc.destdir_pdf
271
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
272 def build_pdf():
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
273 subprocess.check_call(["make", "all-pdf"], cwd=str(bdir_latex))
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
274 dry("Build pdf doc", build_pdf)
275
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
276 if os.path.exists(destdir_pdf):
277 shutil.rmtree(destdir_pdf)
278 os.makedirs(destdir_pdf)
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
279
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
280 ref = os.path.join(bdir_latex, "scipy-ref.pdf")
281 shutil.copy(ref, os.path.join(destdir_pdf, "reference.pdf"))
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
282
283 def tarball_name(type='gztar'):
284 root = 'scipy-%s' % FULLVERSION
285 if type == 'gztar':
286 return root + '.tar.gz'
287 elif type == 'zip':
288 return root + '.zip'
289 raise ValueError("Unknown type %s" % type)
290
291 @task
292 def sdist():
293 # To be sure to bypass paver when building sdist... paver + scipy.distutils
294 # do not play well together.
295 sh('python setup.py sdist --formats=gztar,zip')
296
297 # Copy the superpack into installers dir
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
298 if not os.path.exists(options.installers.installersdir):
299 os.makedirs(options.installers.installersdir)
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
300
301 for t in ['gztar', 'zip']:
302 source = os.path.join('dist', tarball_name(t))
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
303 target = os.path.join(options.installers.installersdir, tarball_name(t))
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
304 shutil.copy(source, target)
305
306
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
307 #---------------------------------------
308 # Windows installers (Wine-based builds)
309 #---------------------------------------
310
311 def superpack_name(pyver, numver):
312 """Return the filename of the superpack installer."""
313 return 'scipy-%s-win32-superpack-python%s.exe' % (numver, pyver)
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
314
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
315 def internal_wininst_name(arch):
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
316 """Return the name of the wininst as it will be inside the superpack (i.e.
317 with the arch encoded."""
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
318 ext = '.exe'
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
319 return "scipy-%s-%s%s" % (FULLVERSION, arch, ext)
320
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
321 def wininst_name(pyver):
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
322 """Return the name of the installer built by wininst command."""
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
323 ext = '.exe'
324 return "scipy-%s.win32-py%s%s" % (FULLVERSION, pyver, ext)
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
325
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
326 def bdist_wininst_arch(pyver, arch):
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
327 """Arch specific wininst build."""
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
328 if os.path.exists("build"):
329 shutil.rmtree("build")
330 _bdist_wininst(pyver, SITECFG[arch])
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
331
332 def prepare_nsis_script(pyver, numver):
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
333 if not os.path.exists(options.superpack.builddir):
334 os.makedirs(options.superpack.builddir)
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
335
d426942 David Cournapeau Fix nsis template location.
cournape authored
336 tpl = os.path.join('tools/win32/build_scripts/nsis_scripts', 'scipy-superinstaller.nsi.in')
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
337 source = open(tpl, 'r')
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
338 target = open(os.path.join(options.superpack.builddir, 'scipy-superinstaller.nsi'), 'w')
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
339
340 installer_name = superpack_name(pyver, numver)
341 cnt = "".join(source.readlines())
6d54df7 David Cournapeau Fix bdist_superpack paver task (forgot to change name from numpy to scip...
cournape authored
342 cnt = cnt.replace('@SCIPY_INSTALLER_NAME@', installer_name)
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
343 for arch in ['nosse', 'sse2', 'sse3']:
344 cnt = cnt.replace('@%s_BINARY@' % arch.upper(),
345 internal_wininst_name(arch))
346 target.write(cnt)
347
348 @task
349 def bdist_wininst_nosse(options):
350 """Build the nosse wininst installer."""
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
351 bdist_wininst_arch(options.python_version, 'nosse')
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
352
353 @task
354 def bdist_wininst_sse2(options):
355 """Build the sse2 wininst installer."""
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
356 bdist_wininst_arch(options.python_version, 'sse2')
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
357
358 @task
359 def bdist_wininst_sse3(options):
360 """Build the sse3 wininst installer."""
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
361 bdist_wininst_arch(options.python_version, 'sse3')
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
362
363 @task
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
364 @cmdopts([("python-version=", "p", "python version")])
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
365 def bdist_superpack(options):
366 """Build all arch specific wininst installers."""
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
367 pyver = options.python_version
368 def copy_bdist(arch):
369 # Copy the wininst in dist into the release directory
370 if int(pyver[0]) >= 3:
371 source = os.path.join('build', 'py3k', 'dist', wininst_name(pyver))
372 else:
373 source = os.path.join('dist', wininst_name(pyver))
374 target = os.path.join(options.superpack.bindir, internal_wininst_name(arch))
375 if os.path.exists(target):
376 os.remove(target)
377 if not os.path.exists(os.path.dirname(target)):
378 os.makedirs(os.path.dirname(target))
379 os.rename(source, target)
380
381 bdist_wininst_arch(pyver, 'nosse')
382 copy_bdist("nosse")
383 bdist_wininst_arch(pyver, 'sse2')
384 copy_bdist("sse2")
385 bdist_wininst_arch(pyver, 'sse3')
386 copy_bdist("sse3")
387
388 prepare_nsis_script(pyver, FULLVERSION)
493cdbe Ralf Gommers REL: cleanups of Paver script taken from the 0.7.x branch.
rgommers authored
389 subprocess.check_call(MAKENSIS + ['scipy-superinstaller.nsi'],
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
390 cwd=options.superpack.builddir)
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
391
392 # Copy the superpack into installers dir
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
393 if not os.path.exists(options.installers.installersdir):
394 os.makedirs(options.installers.installersdir)
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
395
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
396 source = os.path.join(options.superpack.builddir, superpack_name(pyver, FULLVERSION))
397 target = os.path.join(options.installers.installersdir, superpack_name(pyver, FULLVERSION))
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
398 shutil.copy(source, target)
399
400 @task
cbb82e4 David Cournapeau Fix bdist_wininst_simple task.
cournape authored
401 @cmdopts([('python_version=', 'p', 'Python version to build the installer against')])
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
402 def bdist_wininst_simple():
403 """Simple wininst-based installer."""
cbb82e4 David Cournapeau Fix bdist_wininst_simple task.
cournape authored
404 call_task("clean")
f53f767 David Cournapeau Fix paver file to handle bdist targets on windows.
cournape authored
405 env = os.environ.copy()
406 for k, v in SITECFG['nosse'].items():
407 env[k] = v
408 _bdist_wininst(options.bdist_wininst_simple.python_version, env)
409
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
410 def _bdist_wininst(pyver, cfg_env=None):
411 cmd = WINE_PYS[pyver] + ['setup.py', 'build', '-c', 'mingw32', 'bdist_wininst']
412 if cfg_env:
413 for k, v in WINDOWS_ENV.items():
414 cfg_env[k] = v
415 else:
416 cfg_env = WINDOWS_ENV
417 subprocess.check_call(cmd, env=cfg_env)
418
419
420 #--------------------
421 # Mac OS X installers
422 #--------------------
423
424 def dmg_name(fullversion, pyver, osxver=None):
425 """Return name for dmg installer.
426
427 Notes
428 -----
429 Python 2.7 has two binaries, one for 10.3 (ppc, i386) and one for 10.6
430 (i386, x86_64). All other Python versions at python.org at the moment
431 have binaries for 10.3 only. The "macosx%s" part of the dmg name should
432 correspond to the python.org naming scheme.
433 """
434 # assume that for the py2.7/osx10.6 build the deployment target is set
435 # (should be done in the release script).
436 if not osxver:
437 osxver = os.environ.get('MACOSX_DEPLOYMENT_TARGET', '10.3')
438 return "scipy-%s-py%s-python.org-macosx%s.dmg" % (fullversion, pyver,
439 osxver)
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
440
441 def macosx_version():
442 if not sys.platform == 'darwin':
443 raise ValueError("Not darwin ??")
444 st = subprocess.Popen(["sw_vers"], stdout=subprocess.PIPE)
445 out = st.stdout.readlines()
446 ver = re.compile("ProductVersion:\s+([0-9]+)\.([0-9]+)\.([0-9]+)")
447 for i in out:
448 m = ver.match(i)
449 if m:
450 return m.groups()
451
62e14d7 David Cournapeau Fix .dmg generation.
cournape authored
452 def mpkg_name(pyver):
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
453 maj, min = macosx_version()[:2]
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
454 return "scipy-%s-py%s-macosx%s.%s.mpkg" % (FULLVERSION, pyver, maj, min)
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
455
456 def prepare_static_gfortran_runtime(d):
457 if not os.path.exists(d):
458 os.makedirs(d)
459 shutil.copy(LIBGFORTRAN_A_PATH, d)
460
461 @task
b8fa0df David Cournapeau Do not hardcode python version anymore in bdist_mpkg.
cournape authored
462 @cmdopts([('python_version=', 'p', 'Python version to build the installer against')])
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
463 def bdist_mpkg():
464 call_task("clean")
465
b8fa0df David Cournapeau Do not hardcode python version anymore in bdist_mpkg.
cournape authored
466 try:
467 pyver = options.bdist_mpkg.python_version
468 except AttributeError:
469 pyver = PYVER
470
62e14d7 David Cournapeau Fix .dmg generation.
cournape authored
471 _build_mpkg(pyver)
472
473 def _build_mpkg(pyver):
474 numver = parse_numpy_version(MPKG_PYTHON[pyver])
475 numverstr = ".".join(["%i" % i for i in numver])
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
476 if not numver == (1, 5, 1):
477 raise ValueError("Scipy 0.9.x should be built against numpy 1.5.1, (detected %s)" % numverstr)
62e14d7 David Cournapeau Fix .dmg generation.
cournape authored
478
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
479 prepare_static_gfortran_runtime("build")
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
480 # account for differences between Python 2.7.1 versions from python.org
481 if os.environ.get('MACOSX_DEPLOYMENT_TARGET', None) == "10.6":
482 ldflags = "-undefined dynamic_lookup -bundle -arch i386 -arch x86_64 -Wl,-search_paths_first"
483 else:
484 ldflags = "-undefined dynamic_lookup -bundle -arch i386 -arch ppc -Wl,-search_paths_first"
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
485 ldflags += " -L%s" % os.path.join(os.path.dirname(__file__), "build")
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
486
487 if pyver == "2.5":
488 sh("CC=gcc-4.0 LDFLAGS='%s' %s setupegg.py bdist_mpkg" % (ldflags, MPKG_PYTHON[pyver]))
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
489 sh("LDFLAGS='%s' %s setupegg.py bdist_mpkg" % (ldflags, MPKG_PYTHON[pyver]))
490
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
491
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
492 @task
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
493 @cmdopts([("python_version=", "p", "python version")])
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
494 def dmg():
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
495 try:
496 pyver = options.dmg.python_version
497 except:
498 pyver = PYVER
499 idirs = options.installers.installersdir
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
500
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
501 # Check if doc exists. If not, say so and quit.
502 ref = os.path.join(options.doc.destdir_pdf, "reference.pdf")
503 if not os.path.exists(ref):
504 warnings.warn("Docs need to be built first! \n%s not found." % docpath)
505
506 dmg_n = dmg_name(FULLVERSION, pyver)
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
507 dmg = paver.path.path('scipy-macosx-installer') / dmg_n
508 if dmg.exists():
509 dmg.remove()
510
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
511 call_task("clean")
512 _build_mpkg(pyver)
513
514 macosx_installer_dir = "tools/scipy-macosx-installer"
515 dmg = os.path.join(macosx_installer_dir, dmg_name(FULLVERSION, pyver))
516 if os.path.exists(dmg):
517 os.remove(dmg)
518
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
519 # Clean the image source
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
520 content = os.path.join(macosx_installer_dir, 'content')
521 if os.path.exists(content):
522 shutil.rmtree(content)
523 os.makedirs(content)
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
524
525 # Copy mpkg into image source
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
526 mpkg_source = os.path.join("dist", mpkg_name(pyver))
527 mpkg_target = os.path.join(content, "scipy-%s-py%s.mpkg" % (FULLVERSION, pyver))
528 shutil.copytree(mpkg_source, mpkg_target)
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
529
530 # Copy docs into image source
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
531 pdf_docs = os.path.join(content, "Documentation")
532 if os.path.exists(pdf_docs):
533 shutil.rmtree(pdf_docs)
534 os.makedirs(pdf_docs)
535 shutil.copy(ref, os.path.join(pdf_docs, "reference.pdf"))
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
536
537 # Build the dmg
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
538 cmd = ["./new-create-dmg", "--pkgname", os.path.basename(mpkg_target),
539 "--volname", "scipy", os.path.basename(dmg), "./content"]
540 st = subprocess.check_call(cmd, cwd=macosx_installer_dir)
541
542 source = dmg
543 target = os.path.join(idirs, os.path.basename(dmg))
544 if not os.path.exists(os.path.dirname(target)):
545 os.makedirs(os.path.dirname(target))
546 shutil.copy(source, target)
547
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
548
549 @task
62e14d7 David Cournapeau Fix .dmg generation.
cournape authored
550 @cmdopts([('python_version=', 'p', 'Python version to build the installer against')])
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
551 def simple_dmg():
62e14d7 David Cournapeau Fix .dmg generation.
cournape authored
552 try:
553 pyver = options.simple_dmg.python_version
554 except AttributeError:
555 pyver = PYVER
556
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
557 src_dir = "dmg-source"
62e14d7 David Cournapeau Fix .dmg generation.
cournape authored
558
559 # Clean the source dir
560 if os.path.exists(src_dir):
561 shutil.rmtree(src_dir)
562 os.makedirs(src_dir)
563
564 # Build the mpkg
a5eb75d David Cournapeau Forgot to clean build directory before generating .dmg.
cournape authored
565 clean()
62e14d7 David Cournapeau Fix .dmg generation.
cournape authored
566 _build_mpkg(pyver)
567
568 # Build the dmg
569 shutil.copytree(os.path.join("dist", mpkg_name(pyver)),
570 os.path.join(src_dir, mpkg_name(pyver)))
571 _create_dmg(pyver, src_dir, "Scipy Universal %s" % FULLVERSION)
572
573 def _create_dmg(pyver, src_dir, volname=None):
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
574 # Build the dmg
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
575 image_name = dmg_name(FULLVERSION, pyver)
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
576 image = paver.path.path(image_name)
577 image.remove()
62e14d7 David Cournapeau Fix .dmg generation.
cournape authored
578 cmd = ["hdiutil", "create", image_name, "-srcdir", src_dir]
579 if volname:
580 cmd.extend(["-volname", "'%s'" % volname])
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
581 sh(" ".join(cmd))
582
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
583
584 #----------------------------
585 # Release notes and Changelog
586 #----------------------------
587
588 def compute_md5():
589 released = paver.path.path(options.installers.installersdir).listdir()
590 checksums = []
591 for f in released:
592 if not f.endswith('DS_Store'):
593 m = md5.md5(open(f, 'r').read())
594 checksums.append('%s %s' % (m.hexdigest(), f))
595
596 return checksums
597
598 def write_release_task(filename='NOTES.txt'):
599 source = paver.path.path(RELEASE)
600 target = paver.path.path(filename)
601 if target.exists():
602 target.remove()
603 source.copy(target)
604 ftarget = open(str(target), 'a')
605 ftarget.writelines("""
606 Checksums
607 =========
608
609 """)
610 ftarget.writelines(['%s\n' % c for c in compute_md5()])
611
612
613 def write_log_task(filename='Changelog'):
614 st = subprocess.Popen(
cc34137 Ralf Gommers REL: add support for building Windows binary for Python 3.2 to release s...
rgommers authored
615 ['git', 'log', '%s..%s' % (LOG_START, LOG_END)],
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
616 stdout=subprocess.PIPE)
617
618 out = st.communicate()[0]
619 a = open(filename, 'w')
620 a.writelines(out)
621 a.close()
622
623 @task
624 def write_release():
625 write_release_task()
626
627 @task
628 def write_log():
629 write_log_task()
630
28a5f5f David Cournapeau Add paver file for scipy.
cournape authored
631 @task
0c0dc19 Ralf Gommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored
632 def write_release_and_log():
633 write_release_task(os.path.join(options.installers.releasedir, 'NOTES.txt'))
634 write_log_task(os.path.join(options.installers.releasedir, 'Changelog'))
Something went wrong with that request. Please try again.