Skip to content
Newer
Older
100644 651 lines (527 sloc) 21.3 KB
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
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 Feb 19, 2011
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 May 10, 2009
10
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
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 May 10, 2009
18
19 paver bdist_wininst_simple
20
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
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 May 10, 2009
24
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
25 The superpack requires all the Atlas libraries for every arch to be installed
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
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 Feb 19, 2011
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 May 10, 2009
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 Feb 19, 2011
49 paver write_release_and_log
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
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 Feb 19, 2011
54
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
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 Feb 19, 2011
62
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
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 Feb 28, 2012
68 import warnings
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
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 May 15, 2009
86 from paver.easy import options, Bunch, task, needs, dry, sh, call_task, cmdopts
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
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 Nov 13, 2011
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 May 10, 2009
106 finally:
107 sys.path.pop(0)
108
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
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 Sep 11, 2011
115 RELEASE = 'doc/release/0.11.0-notes.rst'
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
116
117 # Start/end of the log (from git)
1f6595e @rgommers REL: master open for development of 0.11.x series.
rgommers authored Sep 11, 2011
118 LOG_START = 'v0.10.0'
cc34137 @rgommers REL: add support for building Windows binary for Python 3.2 to releas…
rgommers authored Sep 4, 2011
119 LOG_END = 'master'
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
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 Jun 5, 2009
126 # Default python version
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
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 Jun 5, 2009
152
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
153 # Wine config for win32 builds
f53f767 @cournape Fix paver file to handle bdist targets on windows.
cournape authored Jun 2, 2009
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 Nov 2, 2010
157 WINE_PY27 = [r"C:\Python27\python27.exe"]
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
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 Sep 4, 2011
159 WINE_PY32 = [r"C:\Python32\python.exe"]
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
160 WINDOWS_ENV = os.environ
493cdbe @rgommers REL: cleanups of Paver script taken from the 0.7.x branch.
rgommers authored May 8, 2010
161 MAKENSIS = ["makensis"]
f53f767 @cournape Fix paver file to handle bdist targets on windows.
cournape authored Jun 2, 2009
162 elif sys.platform == "darwin":
493cdbe @rgommers REL: cleanups of Paver script taken from the 0.7.x branch.
rgommers authored May 8, 2010
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 Nov 2, 2010
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 Feb 19, 2011
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 Sep 4, 2011
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 Feb 19, 2011
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 May 8, 2010
170 MAKENSIS = ["wine", "makensis"]
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
171 else:
493cdbe @rgommers REL: cleanups of Paver script taken from the 0.7.x branch.
rgommers authored May 8, 2010
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 Nov 2, 2010
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 Feb 19, 2011
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 Sep 4, 2011
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 Feb 19, 2011
177 WINDOWS_ENV = os.environ
493cdbe @rgommers REL: cleanups of Paver script taken from the 0.7.x branch.
rgommers authored May 8, 2010
178 MAKENSIS = ["wine", "makensis"]
cc34137 @rgommers REL: add support for building Windows binary for Python 3.2 to releas…
rgommers authored Sep 4, 2011
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 May 10, 2009
181
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
182 # Framework Python locations on OS X
b8fa0df @cournape Do not hardcode python version anymore in bdist_mpkg.
cournape authored Jun 5, 2009
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 Nov 2, 2010
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 Feb 19, 2011
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 Sep 4, 2011
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 May 10, 2009
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 Feb 19, 2011
192 #--------------------------------------
193 # Utility functions and bootstrap stuff
194 #--------------------------------------
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
195
9ae1fe1 @cournape Add function to parse numpy version in paver script.
cournape authored Jun 5, 2009
196 def parse_numpy_version(pyexec):
493cdbe @rgommers REL: cleanups of Paver script taken from the 0.7.x branch.
rgommers authored May 8, 2010
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 Jun 5, 2009
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 May 10, 2009
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 Feb 19, 2011
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 May 10, 2009
232 call_task('paver.virtual.bootstrap')
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
233 sh('cd %s; %s %s' % (bdir, sys.executable, bscript))
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
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 Feb 19, 2011
240 if os.path.exists(i):
241 shutil.rmtree(i)
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
242
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
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 May 10, 2009
246
247 @task
248 def clean_bootstrap():
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
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 May 10, 2009
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 Feb 19, 2011
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 May 10, 2009
260
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
261 #--------------------
262 # Documentation tasks
263 #--------------------
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
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 Feb 19, 2011
271 options.html.builddir.rmtree()
272 builtdocs.copytree(options.html.builddir)
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
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 Feb 19, 2011
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 May 10, 2009
287 def build_pdf():
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
288 subprocess.check_call(["make", "all-pdf"], cwd=str(bdir_latex))
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
289 dry("Build pdf doc", build_pdf)
290
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
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 May 10, 2009
294
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
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 May 10, 2009
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 Feb 19, 2011
313 if not os.path.exists(options.installers.installersdir):
314 os.makedirs(options.installers.installersdir)
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
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 Feb 19, 2011
318 target = os.path.join(options.installers.installersdir, tarball_name(t))
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
319 shutil.copy(source, target)
320
321
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
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 May 10, 2009
329
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
330 def internal_wininst_name(arch):
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
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 Feb 19, 2011
333 ext = '.exe'
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
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 Feb 19, 2011
336 def wininst_name(pyver):
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
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 Feb 19, 2011
338 ext = '.exe'
339 return "scipy-%s.win32-py%s%s" % (FULLVERSION, pyver, ext)
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
340
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
341 def bdist_wininst_arch(pyver, arch):
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
342 """Arch specific wininst build."""
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
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 May 10, 2009
346
347 def prepare_nsis_script(pyver, numver):
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
348 if not os.path.exists(options.superpack.builddir):
349 os.makedirs(options.superpack.builddir)
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
350
d426942 @cournape Fix nsis template location.
cournape authored May 11, 2009
351 tpl = os.path.join('tools/win32/build_scripts/nsis_scripts', 'scipy-superinstaller.nsi.in')
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
352 source = open(tpl, 'r')
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
353 target = open(os.path.join(options.superpack.builddir, 'scipy-superinstaller.nsi'), 'w')
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
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 May 30, 2009
357 cnt = cnt.replace('@SCIPY_INSTALLER_NAME@', installer_name)
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
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 Feb 19, 2011
366 bdist_wininst_arch(options.python_version, 'nosse')
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
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 Feb 19, 2011
371 bdist_wininst_arch(options.python_version, 'sse2')
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
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 Feb 19, 2011
376 bdist_wininst_arch(options.python_version, 'sse3')
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
377
378 @task
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
379 @cmdopts([("python-version=", "p", "python version")])
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
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 Feb 19, 2011
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 May 8, 2010
404 subprocess.check_call(MAKENSIS + ['scipy-superinstaller.nsi'],
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
405 cwd=options.superpack.builddir)
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
406
407 # Copy the superpack into installers dir
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
408 if not os.path.exists(options.installers.installersdir):
409 os.makedirs(options.installers.installersdir)
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
410
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
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 May 10, 2009
413 shutil.copy(source, target)
414
415 @task
cbb82e4 @cournape Fix bdist_wininst_simple task.
cournape authored May 15, 2009
416 @cmdopts([('python_version=', 'p', 'Python version to build the installer against')])
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
417 def bdist_wininst_simple():
418 """Simple wininst-based installer."""
cbb82e4 @cournape Fix bdist_wininst_simple task.
cournape authored May 15, 2009
419 call_task("clean")
f53f767 @cournape Fix paver file to handle bdist targets on windows.
cournape authored Jun 2, 2009
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 Feb 19, 2011
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 May 10, 2009
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 Jun 7, 2009
467 def mpkg_name(pyver):
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
468 maj, min = macosx_version()[:2]
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
469 return "scipy-%s-py%s-macosx%s.%s.mpkg" % (FULLVERSION, pyver, maj, min)
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
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 Jun 5, 2009
477 @cmdopts([('python_version=', 'p', 'Python version to build the installer against')])
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
478 def bdist_mpkg():
479 call_task("clean")
480
b8fa0df @cournape Do not hardcode python version anymore in bdist_mpkg.
cournape authored Jun 5, 2009
481 try:
482 pyver = options.bdist_mpkg.python_version
483 except AttributeError:
484 pyver = PYVER
485
62e14d7 @cournape Fix .dmg generation.
cournape authored Jun 7, 2009
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 Feb 19, 2011
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 Jun 7, 2009
493
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
494 prepare_static_gfortran_runtime("build")
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
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 May 10, 2009
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 Feb 19, 2011
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 May 10, 2009
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 Feb 19, 2011
506
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
507 @task
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
508 @cmdopts([("python_version=", "p", "python version")])
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
509 def dmg():
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
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 May 10, 2009
515
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
516 # Check if doc exists. If not, say so and quit.
dec2589 @rgommers BUG: fix one more bug in paver script.
rgommers authored Feb 28, 2012
517 docpath = options.doc.destdir_pdf
518 ref = os.path.join(docpath, "reference.pdf")
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
519 if not os.path.exists(ref):
520 warnings.warn("Docs need to be built first! \n%s not found." % docpath)
521
522 dmg_n = dmg_name(FULLVERSION, pyver)
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
523 dmg = paver.path.path('scipy-macosx-installer') / dmg_n
524 if dmg.exists():
525 dmg.remove()
526
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
527 call_task("clean")
528 _build_mpkg(pyver)
529
530 macosx_installer_dir = "tools/scipy-macosx-installer"
531 dmg = os.path.join(macosx_installer_dir, dmg_name(FULLVERSION, pyver))
532 if os.path.exists(dmg):
533 os.remove(dmg)
534
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
535 # Clean the image source
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
536 content = os.path.join(macosx_installer_dir, 'content')
537 if os.path.exists(content):
538 shutil.rmtree(content)
539 os.makedirs(content)
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
540
541 # Copy mpkg into image source
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
542 mpkg_source = os.path.join("dist", mpkg_name(pyver))
543 mpkg_target = os.path.join(content, "scipy-%s-py%s.mpkg" % (FULLVERSION, pyver))
544 shutil.copytree(mpkg_source, mpkg_target)
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
545
546 # Copy docs into image source
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
547 pdf_docs = os.path.join(content, "Documentation")
548 if os.path.exists(pdf_docs):
549 shutil.rmtree(pdf_docs)
550 os.makedirs(pdf_docs)
551 shutil.copy(ref, os.path.join(pdf_docs, "reference.pdf"))
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
552
553 # Build the dmg
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
554 cmd = ["./new-create-dmg", "--pkgname", os.path.basename(mpkg_target),
555 "--volname", "scipy", os.path.basename(dmg), "./content"]
556 st = subprocess.check_call(cmd, cwd=macosx_installer_dir)
557
558 source = dmg
559 target = os.path.join(idirs, os.path.basename(dmg))
560 if not os.path.exists(os.path.dirname(target)):
561 os.makedirs(os.path.dirname(target))
562 shutil.copy(source, target)
563
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
564
565 @task
62e14d7 @cournape Fix .dmg generation.
cournape authored Jun 7, 2009
566 @cmdopts([('python_version=', 'p', 'Python version to build the installer against')])
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
567 def simple_dmg():
62e14d7 @cournape Fix .dmg generation.
cournape authored Jun 7, 2009
568 try:
569 pyver = options.simple_dmg.python_version
570 except AttributeError:
571 pyver = PYVER
572
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
573 src_dir = "dmg-source"
62e14d7 @cournape Fix .dmg generation.
cournape authored Jun 7, 2009
574
575 # Clean the source dir
576 if os.path.exists(src_dir):
577 shutil.rmtree(src_dir)
578 os.makedirs(src_dir)
579
580 # Build the mpkg
a5eb75d @cournape Forgot to clean build directory before generating .dmg.
cournape authored Jun 7, 2009
581 clean()
62e14d7 @cournape Fix .dmg generation.
cournape authored Jun 7, 2009
582 _build_mpkg(pyver)
583
584 # Build the dmg
585 shutil.copytree(os.path.join("dist", mpkg_name(pyver)),
586 os.path.join(src_dir, mpkg_name(pyver)))
587 _create_dmg(pyver, src_dir, "Scipy Universal %s" % FULLVERSION)
588
589 def _create_dmg(pyver, src_dir, volname=None):
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
590 # Build the dmg
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
591 image_name = dmg_name(FULLVERSION, pyver)
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
592 image = paver.path.path(image_name)
593 image.remove()
62e14d7 @cournape Fix .dmg generation.
cournape authored Jun 7, 2009
594 cmd = ["hdiutil", "create", image_name, "-srcdir", src_dir]
595 if volname:
596 cmd.extend(["-volname", "'%s'" % volname])
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
597 sh(" ".join(cmd))
598
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
599
600 #----------------------------
601 # Release notes and Changelog
602 #----------------------------
603
604 def compute_md5():
605 released = paver.path.path(options.installers.installersdir).listdir()
606 checksums = []
607 for f in released:
608 if not f.endswith('DS_Store'):
609 m = md5.md5(open(f, 'r').read())
610 checksums.append('%s %s' % (m.hexdigest(), f))
611
612 return checksums
613
614 def write_release_task(filename='NOTES.txt'):
615 source = paver.path.path(RELEASE)
616 target = paver.path.path(filename)
617 if target.exists():
618 target.remove()
619 source.copy(target)
620 ftarget = open(str(target), 'a')
621 ftarget.writelines("""
622 Checksums
623 =========
624
625 """)
626 ftarget.writelines(['%s\n' % c for c in compute_md5()])
627
628
629 def write_log_task(filename='Changelog'):
630 st = subprocess.Popen(
cc34137 @rgommers REL: add support for building Windows binary for Python 3.2 to releas…
rgommers authored Sep 4, 2011
631 ['git', 'log', '%s..%s' % (LOG_START, LOG_END)],
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
632 stdout=subprocess.PIPE)
633
634 out = st.communicate()[0]
635 a = open(filename, 'w')
636 a.writelines(out)
637 a.close()
638
639 @task
640 def write_release():
641 write_release_task()
642
643 @task
644 def write_log():
645 write_log_task()
646
28a5f5f @cournape Add paver file for scipy.
cournape authored May 10, 2009
647 @task
0c0dc19 @rgommers ENH: copy improvements to release scripts from 0.9.x branch.
rgommers authored Feb 19, 2011
648 def write_release_and_log():
f3fb76e @rgommers REL: forward port changes to release scripts from 0.10.x branch.
rgommers authored Nov 13, 2011
649 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 Feb 19, 2011
650 write_log_task(os.path.join(options.installers.releasedir, 'Changelog'))
Something went wrong with that request. Please try again.