Skip to content

HTTPS clone URL

Subversion checkout URL

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