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