Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 618 lines (519 sloc) 21.18 kb
6b94248 @cournape Add some doc to the paver script.
cournape authored
1 """
0b0dbdf @cournape Update paver script file doc + TODO.
cournape authored
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 numpy, not an installed one).
6
6b94248 @cournape Add some doc to the paver script.
cournape authored
7 Building a fancy dmg from scratch
8 =================================
9
10 Clone the numpy-macosx-installer git repo from on github into the source tree
11 (numpy-macosx-installer should be in the same directory as setup.py). Then, do
12 as follows::
13
0b0dbdf @cournape Update paver script file doc + TODO.
cournape authored
14 git clone git://github.com/cournape/macosx-numpy-installer
15 # remove build dir, and everything generated by previous paver calls
16 # (included generated installers). Use with care !
17 paver nuke
22becbb @rgommers ENH: Several changes to Paver script taken from 1.4.x branch.
rgommers authored
18 paver bootstrap && source bootstrap/bin/activate
0b0dbdf @cournape Update paver script file doc + TODO.
cournape authored
19 # Installing numpy is necessary to build the correct documentation (because
20 # of autodoc)
6b94248 @cournape Add some doc to the paver script.
cournape authored
21 python setupegg.py install
22 paver dmg
23
24 Building a simple (no-superpack) windows installer from wine
25 ============================================================
26
27 It assumes that blas/lapack are in c:\local\lib inside drive_c. Build python
28 2.5 and python 2.6 installers.
29
0b0dbdf @cournape Update paver script file doc + TODO.
cournape authored
30 paver bdist_wininst_simple
31
32 You will have to configure your wine python locations (WINE_PYS).
33
34 The superpack requires all the atlas libraries for every arch to be installed
35 (see SITECFG), and can then be built as follows::
36
37 paver bdist_superpack
6b94248 @cournape Add some doc to the paver script.
cournape authored
38
39 Building changelog + notes
40 ==========================
41
42 Assumes you have git and the binaries/tarballs in installers/::
43
44 paver write_release
45 paver write_note
46
47 This automatically put the checksum into NOTES.txt, and write the Changelog
48 which can be uploaded to sourceforge.
0b0dbdf @cournape Update paver script file doc + TODO.
cournape authored
49
50 TODO
51 ====
52 - the script is messy, lots of global variables
53 - make it more easily customizable (through command line args)
54 - missing targets: install & test, sdist test, debian packaging
fe23881 @cournape HACK: Make sure we use python.org interpreter to build the mpkg in paver
cournape authored
55 - fix bdist_mpkg: we build the same source twice -> how to make sure we use
56 the same underlying python for egg install in venv and for bdist_mpkg
6b94248 @cournape Add some doc to the paver script.
cournape authored
57 """
7b2d3ba @cournape REL: new, better paver file.
cournape authored
58
59 # What need to be installed to build everything on mac os x:
60 # - wine: python 2.6 and 2.5 + makensis + cpuid plugin + mingw, all in the PATH
61 # - paver + virtualenv
62 # - full texlive
874a405 @cournape Start a paver file to help for release purpose.
cournape authored
63 import os
57fc6f5 @cournape Add bootstrap task.
cournape authored
64 import sys
7b2d3ba @cournape REL: new, better paver file.
cournape authored
65 import shutil
874a405 @cournape Start a paver file to help for release purpose.
cournape authored
66 import subprocess
89d874e @cournape Add simple .dmg build to paver.
cournape authored
67 import re
874a405 @cournape Start a paver file to help for release purpose.
cournape authored
68 try:
6dce852 @cournape BUG: fix md5 import for python 2.6 in paver file.
cournape authored
69 from hashlib import md5
874a405 @cournape Start a paver file to help for release purpose.
cournape authored
70 except ImportError:
6dce852 @cournape BUG: fix md5 import for python 2.6 in paver file.
cournape authored
71 from md5 import md5
874a405 @cournape Start a paver file to help for release purpose.
cournape authored
72
7b2d3ba @cournape REL: new, better paver file.
cournape authored
73 import paver
74 from paver.easy import \
75 options, Bunch, task, call_task, sh, needs, cmdopts, dry
874a405 @cournape Start a paver file to help for release purpose.
cournape authored
76
7b2d3ba @cournape REL: new, better paver file.
cournape authored
77 sys.path.insert(0, os.path.dirname(__file__))
874a405 @cournape Start a paver file to help for release purpose.
cournape authored
78 try:
7b2d3ba @cournape REL: new, better paver file.
cournape authored
79 setup_py = __import__("setup")
87e12c1 @rgommers BUG: Py3K: fix setup.py to work from a released tarball.
rgommers authored
80 FULLVERSION = setup_py.VERSION
81 # This is duplicated from setup.py
82 if os.path.exists('.git'):
83 GIT_REVISION = setup_py.git_version()
84 elif os.path.exists('numpy/version.py'):
85 # must be a source distribution, use existing version file
86 from numpy.version import git_revision as GIT_REVISION
87 else:
88 GIT_REVISION = "Unknown"
89
90 if not setup_py.ISRELEASED:
91 FULLVERSION += '.dev-' + GIT_REVISION[:7]
7b2d3ba @cournape REL: new, better paver file.
cournape authored
92 finally:
93 sys.path.pop(0)
874a405 @cournape Start a paver file to help for release purpose.
cournape authored
94
cbf7407 @rgommers DOC: update notes in release script and reorganize paver script a lit…
rgommers authored
95
96 #-----------------------------------
97 # Things to be changed for a release
98 #-----------------------------------
99
100 # Source of the release notes
101 RELEASE_NOTES = 'doc/release/2.0.0-notes.rst'
102
103 # Start/end of the log (from git)
e2af7b7 @rgommers REL: forward port changes to release scripts from 1.6.x branch.
rgommers authored
104 LOG_START = 'v1.6.0'
cbf7407 @rgommers DOC: update notes in release script and reorganize paver script a lit…
rgommers authored
105 LOG_END = 'master'
106
107
108 #-------------------------------------------------------
109 # Hardcoded build/install dirs, virtualenv options, etc.
110 #-------------------------------------------------------
7b2d3ba @cournape REL: new, better paver file.
cournape authored
111 DEFAULT_PYTHON = "2.6"
112
113 # Where to put the final installers, as put on sourceforge
313f272 @cournape Superpack can now be built from wine, bye bye windows pain.
cournape authored
114 SUPERPACK_BUILD = 'build-superpack'
115 SUPERPACK_BINDIR = os.path.join(SUPERPACK_BUILD, 'binaries')
db3320c @cournape Add wine-based bdist_wininst installers.
cournape authored
116
7b2d3ba @cournape REL: new, better paver file.
cournape authored
117 options(bootstrap=Bunch(bootstrap_dir="bootstrap"),
d609dff @rgommers REL: change Sphinx version in release script to 1.1.3.
rgommers authored
118 virtualenv=Bunch(packages_to_install=["sphinx==1.1.3", "numpydoc"],
782ba88 @rgommers DOC: BLD: fix some doc build warnings.
rgommers authored
119 no_site_packages=False),
7b2d3ba @cournape REL: new, better paver file.
cournape authored
120 sphinx=Bunch(builddir="build", sourcedir="source", docroot='doc'),
121 superpack=Bunch(builddir="build-superpack"),
122 installers=Bunch(releasedir="release",
123 installersdir=os.path.join("release", "installers")),
22becbb @rgommers ENH: Several changes to Paver script taken from 1.4.x branch.
rgommers authored
124 doc=Bunch(doc_root="doc",
7b2d3ba @cournape REL: new, better paver file.
cournape authored
125 sdir=os.path.join("doc", "source"),
126 bdir=os.path.join("doc", "build"),
127 bdir_latex=os.path.join("doc", "build", "latex"),
e0abf3b @cournape REL: fix dmg name and dmg build.
cournape authored
128 destdir_pdf=os.path.join("build_doc", "pdf")
7b2d3ba @cournape REL: new, better paver file.
cournape authored
129 ),
130 html=Bunch(builddir=os.path.join("build", "html")),
131 dmg=Bunch(python_version=DEFAULT_PYTHON),
132 bdist_wininst_simple=Bunch(python_version=DEFAULT_PYTHON),
133 )
134
135 MPKG_PYTHON = {
136 "2.5": ["/Library/Frameworks/Python.framework/Versions/2.5/bin/python"],
3c3d423 @rgommers REL: Apply changes to release notes and paver script in 1.5.x branch …
rgommers authored
137 "2.6": ["/Library/Frameworks/Python.framework/Versions/2.6/bin/python"],
138 "2.7": ["/Library/Frameworks/Python.framework/Versions/2.7/bin/python"],
139 "3.1": ["/Library/Frameworks/Python.framework/Versions/3.1/bin/python3"],
702ae6a @rgommers REL: update release scripts for Python 3.2.
rgommers authored
140 "3.2": ["/Library/Frameworks/Python.framework/Versions/3.2/bin/python3"],
7b2d3ba @cournape REL: new, better paver file.
cournape authored
141 }
958f4a4 @cournape Add task to build html doc.
cournape authored
142
fb2df76 @certik pavement.py: rename "yop" to "atlas"
certik authored
143 SSE3_CFG = {'ATLAS': r'C:\local\lib\atlas\sse3'}
144 SSE2_CFG = {'ATLAS': r'C:\local\lib\atlas\sse2'}
145 NOSSE_CFG = {'BLAS': r'C:\local\lib\atlas\nosse', 'LAPACK': r'C:\local\lib\atlas\nosse'}
7b2d3ba @cournape REL: new, better paver file.
cournape authored
146
147 SITECFG = {"sse2" : SSE2_CFG, "sse3" : SSE3_CFG, "nosse" : NOSSE_CFG}
148
149 if sys.platform =="darwin":
150 WINDOWS_PYTHON = {
702ae6a @rgommers REL: update release scripts for Python 3.2.
rgommers authored
151 "3.2": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python32/python.exe"],
3c3d423 @rgommers REL: Apply changes to release notes and paver script in 1.5.x branch …
rgommers authored
152 "3.1": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python31/python.exe"],
153 "2.7": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python27/python.exe"],
22becbb @rgommers ENH: Several changes to Paver script taken from 1.4.x branch.
rgommers authored
154 "2.6": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python26/python.exe"],
155 "2.5": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python25/python.exe"]
7b2d3ba @cournape REL: new, better paver file.
cournape authored
156 }
157 WINDOWS_ENV = os.environ
158 WINDOWS_ENV["DYLD_FALLBACK_LIBRARY_PATH"] = "/usr/X11/lib:/usr/lib"
159 MAKENSIS = ["wine", "makensis"]
160 elif sys.platform == "win32":
161 WINDOWS_PYTHON = {
702ae6a @rgommers REL: update release scripts for Python 3.2.
rgommers authored
162 "3.2": ["C:\Python32\python.exe"],
163 "3.1": ["C:\Python31\python.exe"],
3c3d423 @rgommers REL: Apply changes to release notes and paver script in 1.5.x branch …
rgommers authored
164 "2.7": ["C:\Python27\python.exe"],
7b2d3ba @cournape REL: new, better paver file.
cournape authored
165 "2.6": ["C:\Python26\python.exe"],
166 "2.5": ["C:\Python25\python.exe"],
167 }
0132351 @cournape BUG: fix paver execution on windows 7 for python 2.6.
cournape authored
168 # XXX: find out which env variable is necessary to avoid the pb with python
169 # 2.6 and random module when importing tempfile
170 WINDOWS_ENV = os.environ
7b2d3ba @cournape REL: new, better paver file.
cournape authored
171 MAKENSIS = ["makensis"]
172 else:
173 WINDOWS_PYTHON = {
702ae6a @rgommers REL: update release scripts for Python 3.2.
rgommers authored
174 "3.2": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python32/python.exe"],
3c3d423 @rgommers REL: Apply changes to release notes and paver script in 1.5.x branch …
rgommers authored
175 "3.1": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python31/python.exe"],
176 "2.7": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python27/python.exe"],
22becbb @rgommers ENH: Several changes to Paver script taken from 1.4.x branch.
rgommers authored
177 "2.6": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python26/python.exe"],
178 "2.5": ["wine", os.environ['HOME'] + "/.wine/drive_c/Python25/python.exe"]
7b2d3ba @cournape REL: new, better paver file.
cournape authored
179 }
180 WINDOWS_ENV = os.environ
181 MAKENSIS = ["wine", "makensis"]
a73581f @cournape Document global vars in paver.
cournape authored
182
183
7b2d3ba @cournape REL: new, better paver file.
cournape authored
184 #-------------------
185 # Windows installers
186 #-------------------
187 def superpack_name(pyver, numver):
188 """Return the filename of the superpack installer."""
189 return 'numpy-%s-win32-superpack-python%s.exe' % (numver, pyver)
874a405 @cournape Start a paver file to help for release purpose.
cournape authored
190
7b2d3ba @cournape REL: new, better paver file.
cournape authored
191 def internal_wininst_name(arch):
192 """Return the name of the wininst as it will be inside the superpack (i.e.
193 with the arch encoded."""
194 ext = '.exe'
195 return "numpy-%s-%s%s" % (FULLVERSION, arch, ext)
310db3a @cournape Update paver script such as one can create the fancy numpy dmg in one…
cournape authored
196
7b2d3ba @cournape REL: new, better paver file.
cournape authored
197 def wininst_name(pyver):
198 """Return the name of the installer built by wininst command."""
199 ext = '.exe'
200 return "numpy-%s.win32-py%s%s" % (FULLVERSION, pyver, ext)
201
202 def prepare_nsis_script(pyver, numver):
203 if not os.path.exists(SUPERPACK_BUILD):
204 os.makedirs(SUPERPACK_BUILD)
205
206 tpl = os.path.join('tools/win32build/nsis_scripts', 'numpy-superinstaller.nsi.in')
207 source = open(tpl, 'r')
208 target = open(os.path.join(SUPERPACK_BUILD, 'numpy-superinstaller.nsi'), 'w')
313f272 @cournape Superpack can now be built from wine, bye bye windows pain.
cournape authored
209
7b2d3ba @cournape REL: new, better paver file.
cournape authored
210 installer_name = superpack_name(pyver, numver)
211 cnt = "".join(source.readlines())
212 cnt = cnt.replace('@NUMPY_INSTALLER_NAME@', installer_name)
213 for arch in ['nosse', 'sse2', 'sse3']:
214 cnt = cnt.replace('@%s_BINARY@' % arch.upper(),
215 internal_wininst_name(arch))
216
217 target.write(cnt)
fe23881 @cournape HACK: Make sure we use python.org interpreter to build the mpkg in paver
cournape authored
218
7b2d3ba @cournape REL: new, better paver file.
cournape authored
219 def bdist_wininst_arch(pyver, arch):
220 """Arch specific wininst build."""
221 if os.path.exists("build"):
222 shutil.rmtree("build")
223
224 _bdist_wininst(pyver, SITECFG[arch])
225
226 @task
227 @cmdopts([("python-version=", "p", "python version")])
228 def bdist_superpack(options):
229 """Build all arch specific wininst installers."""
230 pyver = options.python_version
231 def copy_bdist(arch):
232 # Copy the wininst in dist into the release directory
3c3d423 @rgommers REL: Apply changes to release notes and paver script in 1.5.x branch …
rgommers authored
233 if int(pyver[0]) >= 3:
4e7b7b6 @rgommers 3K: copy built installers from build/py3k/dist instead of dist/.
rgommers authored
234 source = os.path.join('build', 'py3k', 'dist', wininst_name(pyver))
235 else:
236 source = os.path.join('dist', wininst_name(pyver))
7b2d3ba @cournape REL: new, better paver file.
cournape authored
237 target = os.path.join(SUPERPACK_BINDIR, internal_wininst_name(arch))
238 if os.path.exists(target):
239 os.remove(target)
240 if not os.path.exists(os.path.dirname(target)):
241 os.makedirs(os.path.dirname(target))
13212a5 @rgommers BUG: fix up setup.py and pavement.py so the binary builds work again.
rgommers authored
242 try:
243 os.rename(source, target)
244 except OSError:
245 # When git is installed on OS X but not under Wine, the name of the
246 # .exe has "-Unknown" in it instead of the correct git revision.
247 # Try to fix this here:
248 revidx = source.index(".dev-") + 5
249 gitrev = source[revidx:revidx+7]
250 os.rename(source.replace(gitrev, "Unknown"), target)
7b2d3ba @cournape REL: new, better paver file.
cournape authored
251
252 bdist_wininst_arch(pyver, 'nosse')
253 copy_bdist("nosse")
d4d3480 @cournape REL: re-enable SSE2 binary in the superpack.
cournape authored
254 bdist_wininst_arch(pyver, 'sse2')
255 copy_bdist("sse2")
7b2d3ba @cournape REL: new, better paver file.
cournape authored
256 bdist_wininst_arch(pyver, 'sse3')
257 copy_bdist("sse3")
22becbb @rgommers ENH: Several changes to Paver script taken from 1.4.x branch.
rgommers authored
258
7b2d3ba @cournape REL: new, better paver file.
cournape authored
259 idirs = options.installers.installersdir
260 pyver = options.python_version
261 prepare_nsis_script(pyver, FULLVERSION)
262 subprocess.check_call(MAKENSIS + ['numpy-superinstaller.nsi'],
263 cwd=SUPERPACK_BUILD)
264
265 # Copy the superpack into installers dir
266 if not os.path.exists(idirs):
267 os.makedirs(idirs)
57fc6f5 @cournape Add bootstrap task.
cournape authored
268
7b2d3ba @cournape REL: new, better paver file.
cournape authored
269 source = os.path.join(SUPERPACK_BUILD, superpack_name(pyver, FULLVERSION))
270 target = os.path.join(idirs, superpack_name(pyver, FULLVERSION))
271 shutil.copy(source, target)
272
273 @task
274 @cmdopts([("python-version=", "p", "python version")])
275 def bdist_wininst_nosse(options):
276 """Build the nosse wininst installer."""
277 bdist_wininst_arch(options.python_version, 'nosse')
278
279 @task
280 @cmdopts([("python-version=", "p", "python version")])
281 def bdist_wininst_sse2(options):
282 """Build the sse2 wininst installer."""
283 bdist_wininst_arch(options.python_version, 'sse2')
284
285 @task
286 @cmdopts([("python-version=", "p", "python version")])
287 def bdist_wininst_sse3(options):
288 """Build the sse3 wininst installer."""
289 bdist_wininst_arch(options.python_version, 'sse3')
290
291 @task
292 @cmdopts([("python-version=", "p", "python version")])
293 def bdist_wininst_simple():
294 """Simple wininst-based installer."""
295 pyver = options.bdist_wininst_simple.python_version
296 _bdist_wininst(pyver)
297
298 def _bdist_wininst(pyver, cfg_env=None):
299 cmd = WINDOWS_PYTHON[pyver] + ['setup.py', 'build', '-c', 'mingw32', 'bdist_wininst']
300 if cfg_env:
301 for k, v in WINDOWS_ENV.items():
302 cfg_env[k] = v
303 else:
304 cfg_env = WINDOWS_ENV
305 subprocess.check_call(cmd, env=cfg_env)
306
307 #----------------
57fc6f5 @cournape Add bootstrap task.
cournape authored
308 # Bootstrap stuff
7b2d3ba @cournape REL: new, better paver file.
cournape authored
309 #----------------
57fc6f5 @cournape Add bootstrap task.
cournape authored
310 @task
7b2d3ba @cournape REL: new, better paver file.
cournape authored
311 def bootstrap(options):
312 """create virtualenv in ./bootstrap"""
313 try:
314 import virtualenv
315 except ImportError, e:
316 raise RuntimeError("virtualenv is needed for bootstrap")
317
318 bdir = options.bootstrap_dir
319 if not os.path.exists(bdir):
320 os.makedirs(bdir)
321 bscript = "boostrap.py"
322
323 options.virtualenv.script_name = os.path.join(options.bootstrap_dir,
324 bscript)
22becbb @rgommers ENH: Several changes to Paver script taken from 1.4.x branch.
rgommers authored
325 options.virtualenv.no_site_packages = False
326 options.bootstrap.no_site_packages = False
57fc6f5 @cournape Add bootstrap task.
cournape authored
327 call_task('paver.virtual.bootstrap')
7b2d3ba @cournape REL: new, better paver file.
cournape authored
328 sh('cd %s; %s %s' % (bdir, sys.executable, bscript))
57fc6f5 @cournape Add bootstrap task.
cournape authored
329
330 @task
331 def clean():
332 """Remove build, dist, egg-info garbage."""
a293cac @cournape Clean egg-info too in paver.
cournape authored
333 d = ['build', 'dist', 'numpy.egg-info']
57fc6f5 @cournape Add bootstrap task.
cournape authored
334 for i in d:
7b2d3ba @cournape REL: new, better paver file.
cournape authored
335 if os.path.exists(i):
336 shutil.rmtree(i)
57fc6f5 @cournape Add bootstrap task.
cournape authored
337
7b2d3ba @cournape REL: new, better paver file.
cournape authored
338 bdir = os.path.join('doc', options.sphinx.builddir)
339 if os.path.exists(bdir):
340 shutil.rmtree(bdir)
57fc6f5 @cournape Add bootstrap task.
cournape authored
341
342 @task
343 def clean_bootstrap():
7b2d3ba @cournape REL: new, better paver file.
cournape authored
344 bdir = os.path.join(options.bootstrap.bootstrap_dir)
345 if os.path.exists(bdir):
346 shutil.rmtree(bdir)
958f4a4 @cournape Add task to build html doc.
cournape authored
347
313f272 @cournape Superpack can now be built from wine, bye bye windows pain.
cournape authored
348 @task
349 @needs('clean', 'clean_bootstrap')
7b2d3ba @cournape REL: new, better paver file.
cournape authored
350 def nuke(options):
313f272 @cournape Superpack can now be built from wine, bye bye windows pain.
cournape authored
351 """Remove everything: build dir, installers, bootstrap dirs, etc..."""
7b2d3ba @cournape REL: new, better paver file.
cournape authored
352 for d in [options.superpack.builddir, options.installers.releasedir]:
353 if os.path.exists(d):
354 shutil.rmtree(d)
874a405 @cournape Start a paver file to help for release purpose.
cournape authored
355
7b2d3ba @cournape REL: new, better paver file.
cournape authored
356 #---------------------
357 # Documentation tasks
358 #---------------------
958f4a4 @cournape Add task to build html doc.
cournape authored
359 @task
360 def html(options):
361 """Build numpy documentation and put it into build/docs"""
e427f7a @cournape Don't use paver html target to avoid using a numpy which is different…
cournape authored
362 # Don't use paver html target because of numpy bootstrapping problems
7b2d3ba @cournape REL: new, better paver file.
cournape authored
363 bdir = os.path.join("doc", options.sphinx.builddir, "html")
364 if os.path.exists(bdir):
365 shutil.rmtree(bdir)
e427f7a @cournape Don't use paver html target to avoid using a numpy which is different…
cournape authored
366 subprocess.check_call(["make", "html"], cwd="doc")
7b2d3ba @cournape REL: new, better paver file.
cournape authored
367 html_destdir = options.html.builddir
368 if os.path.exists(html_destdir):
369 shutil.rmtree(html_destdir)
370 shutil.copytree(bdir, html_destdir)
743ac26 @cournape Bypass paver sdist.
cournape authored
371
bc70602 @cournape Add pdf task + full dmg build for paver script.
cournape authored
372 @task
373 def latex():
3073f2c @cournape Remove leftover from when I copied the paver file from samplerate sci…
cournape authored
374 """Build numpy documentation in latex format."""
bc70602 @cournape Add pdf task + full dmg build for paver script.
cournape authored
375 subprocess.check_call(["make", "latex"], cwd="doc")
376
377 @task
378 @needs('latex')
379 def pdf():
7b2d3ba @cournape REL: new, better paver file.
cournape authored
380 sdir = options.doc.sdir
381 bdir = options.doc.bdir
382 bdir_latex = options.doc.bdir_latex
383 destdir_pdf = options.doc.destdir_pdf
384
3073f2c @cournape Remove leftover from when I copied the paver file from samplerate sci…
cournape authored
385 def build_pdf():
7b2d3ba @cournape REL: new, better paver file.
cournape authored
386 subprocess.check_call(["make", "all-pdf"], cwd=str(bdir_latex))
fe23881 @cournape HACK: Make sure we use python.org interpreter to build the mpkg in paver
cournape authored
387 dry("Build pdf doc", build_pdf)
bc70602 @cournape Add pdf task + full dmg build for paver script.
cournape authored
388
7b2d3ba @cournape REL: new, better paver file.
cournape authored
389 if os.path.exists(destdir_pdf):
390 shutil.rmtree(destdir_pdf)
391 os.makedirs(destdir_pdf)
c7927eb @cournape Copy tarballs and superpack into release dir.
cournape authored
392
7b2d3ba @cournape REL: new, better paver file.
cournape authored
393 user = os.path.join(bdir_latex, "numpy-user.pdf")
394 shutil.copy(user, os.path.join(destdir_pdf, "userguide.pdf"))
395 ref = os.path.join(bdir_latex, "numpy-ref.pdf")
396 shutil.copy(ref, os.path.join(destdir_pdf, "reference.pdf"))
c7927eb @cournape Copy tarballs and superpack into release dir.
cournape authored
397
644588a @cournape Add tasks to build arch specifics wininst.
cournape authored
398 #------------------
7b2d3ba @cournape REL: new, better paver file.
cournape authored
399 # Mac OS X targets
644588a @cournape Add tasks to build arch specifics wininst.
cournape authored
400 #------------------
e2af7b7 @rgommers REL: forward port changes to release scripts from 1.6.x branch.
rgommers authored
401 def dmg_name(fullversion, pyver, osxver=None):
402 """Return name for dmg installer.
403
404 Notes
405 -----
406 Python 2.7 has two binaries, one for 10.3 (ppc, i386) and one for 10.6
407 (i386, x86_64). All other Python versions at python.org at the moment
408 have binaries for 10.3 only. The "macosx%s" part of the dmg name should
409 correspond to the python.org naming scheme.
410 """
411 # assume that for the py2.7/osx10.6 build the deployment target is set
412 # (should be done in the release script).
413 if not osxver:
414 osxver = os.environ.get('MACOSX_DEPLOYMENT_TARGET', '10.3')
415 return "numpy-%s-py%s-python.org-macosx%s.dmg" % (fullversion, pyver,
416 osxver)
644588a @cournape Add tasks to build arch specifics wininst.
cournape authored
417
89d874e @cournape Add simple .dmg build to paver.
cournape authored
418 def macosx_version():
419 if not sys.platform == 'darwin':
420 raise ValueError("Not darwin ??")
421 st = subprocess.Popen(["sw_vers"], stdout=subprocess.PIPE)
422 out = st.stdout.readlines()
423 ver = re.compile("ProductVersion:\s+([0-9]+)\.([0-9]+)\.([0-9]+)")
424 for i in out:
425 m = ver.match(i)
426 if m:
427 return m.groups()
428
7b2d3ba @cournape REL: new, better paver file.
cournape authored
429 def mpkg_name(pyver):
89d874e @cournape Add simple .dmg build to paver.
cournape authored
430 maj, min = macosx_version()[:2]
13212a5 @rgommers BUG: fix up setup.py and pavement.py so the binary builds work again.
rgommers authored
431 # Note that bdist_mpkg breaks this if building a dev version with a git
432 # commit string attached. make_fullplatcomponents() in
433 # bdist_mpkg/cmd_bdist_mpkg.py replaces '-' with '_', comment this out if
434 # needed.
7b2d3ba @cournape REL: new, better paver file.
cournape authored
435 return "numpy-%s-py%s-macosx%s.%s.mpkg" % (FULLVERSION, pyver, maj, min)
436
437 def _build_mpkg(pyver):
13212a5 @rgommers BUG: fix up setup.py and pavement.py so the binary builds work again.
rgommers authored
438 # account for differences between Python 2.7.1 versions from python.org
439 if os.environ.get('MACOSX_DEPLOYMENT_TARGET', None) == "10.6":
440 ldflags = "-undefined dynamic_lookup -bundle -arch i386 -arch x86_64 -Wl,-search_paths_first"
441 else:
442 ldflags = "-undefined dynamic_lookup -bundle -arch i386 -arch ppc -Wl,-search_paths_first"
7b2d3ba @cournape REL: new, better paver file.
cournape authored
443 ldflags += " -L%s" % os.path.join(os.path.dirname(__file__), "build")
13212a5 @rgommers BUG: fix up setup.py and pavement.py so the binary builds work again.
rgommers authored
444
cc8c533 @cournape Use gcc-4.0 for python 2.5, to avoid using gcc 4.2 on Snow Leopard.
cournape authored
445 if pyver == "2.5":
446 sh("CC=gcc-4.0 LDFLAGS='%s' %s setupegg.py bdist_mpkg" % (ldflags, " ".join(MPKG_PYTHON[pyver])))
447 else:
448 sh("LDFLAGS='%s' %s setupegg.py bdist_mpkg" % (ldflags, " ".join(MPKG_PYTHON[pyver])))
7b2d3ba @cournape REL: new, better paver file.
cournape authored
449
450 @task
451 def simple_dmg():
452 pyver = "2.6"
453 src_dir = "dmg-source"
454
455 # Clean the source dir
456 if os.path.exists(src_dir):
457 shutil.rmtree(src_dir)
458 os.makedirs(src_dir)
459
460 # Build the mpkg
461 clean()
462 _build_mpkg(pyver)
463
464 # Build the dmg
465 shutil.copytree(os.path.join("dist", mpkg_name(pyver)),
466 os.path.join(src_dir, mpkg_name(pyver)))
467 _create_dmg(pyver, src_dir, "NumPy Universal %s" % FULLVERSION)
468
469 @task
470 def bdist_mpkg(options):
471 call_task("clean")
472 try:
473 pyver = options.bdist_mpkg.python_version
474 except AttributeError:
475 pyver = options.python_version
476
477 _build_mpkg(pyver)
478
479 def _create_dmg(pyver, src_dir, volname=None):
480 # Build the dmg
481 image_name = dmg_name(FULLVERSION, pyver)
482 if os.path.exists(image_name):
483 os.remove(image_name)
484 cmd = ["hdiutil", "create", image_name, "-srcdir", src_dir]
485 if volname:
486 cmd.extend(["-volname", "'%s'" % volname])
487 sh(" ".join(cmd))
89d874e @cournape Add simple .dmg build to paver.
cournape authored
488
489 @task
e0abf3b @cournape REL: fix dmg name and dmg build.
cournape authored
490 @cmdopts([("python-version=", "p", "python version")])
7b2d3ba @cournape REL: new, better paver file.
cournape authored
491 def dmg(options):
e0abf3b @cournape REL: fix dmg name and dmg build.
cournape authored
492 try:
493 pyver = options.dmg.python_version
494 except:
495 pyver = DEFAULT_PYTHON
7b2d3ba @cournape REL: new, better paver file.
cournape authored
496 idirs = options.installers.installersdir
310db3a @cournape Update paver script such as one can create the fancy numpy dmg in one…
cournape authored
497
13212a5 @rgommers BUG: fix up setup.py and pavement.py so the binary builds work again.
rgommers authored
498 # Check if docs exist. If not, say so and quit.
499 ref = os.path.join(options.doc.destdir_pdf, "reference.pdf")
500 user = os.path.join(options.doc.destdir_pdf, "userguide.pdf")
501 if (not os.path.exists(ref)) or (not os.path.exists(user)):
87e12c1 @rgommers BUG: Py3K: fix setup.py to work from a released tarball.
rgommers authored
502 import warnings
13212a5 @rgommers BUG: fix up setup.py and pavement.py so the binary builds work again.
rgommers authored
503 warnings.warn("Docs need to be built first! Can't find them.")
504
505 # Build the mpkg package
e0abf3b @cournape REL: fix dmg name and dmg build.
cournape authored
506 call_task("clean")
507 _build_mpkg(pyver)
508
7b2d3ba @cournape REL: new, better paver file.
cournape authored
509 macosx_installer_dir = "tools/numpy-macosx-installer"
e0abf3b @cournape REL: fix dmg name and dmg build.
cournape authored
510 dmg = os.path.join(macosx_installer_dir, dmg_name(FULLVERSION, pyver))
7b2d3ba @cournape REL: new, better paver file.
cournape authored
511 if os.path.exists(dmg):
512 os.remove(dmg)
310db3a @cournape Update paver script such as one can create the fancy numpy dmg in one…
cournape authored
513
0dc3ac8 @cournape Fix tab issues in paver file.
cournape authored
514 # Clean the image source
7b2d3ba @cournape REL: new, better paver file.
cournape authored
515 content = os.path.join(macosx_installer_dir, 'content')
516 if os.path.exists(content):
517 shutil.rmtree(content)
518 os.makedirs(content)
89d874e @cournape Add simple .dmg build to paver.
cournape authored
519
520 # Copy mpkg into image source
7b2d3ba @cournape REL: new, better paver file.
cournape authored
521 mpkg_source = os.path.join("dist", mpkg_name(pyver))
522 mpkg_target = os.path.join(content, "numpy-%s-py%s.mpkg" % (FULLVERSION, pyver))
523 shutil.copytree(mpkg_source, mpkg_target)
89d874e @cournape Add simple .dmg build to paver.
cournape authored
524
525 # Copy docs into image source
7b2d3ba @cournape REL: new, better paver file.
cournape authored
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(user, os.path.join(pdf_docs, "userguide.pdf"))
531 shutil.copy(ref, os.path.join(pdf_docs, "reference.pdf"))
bc70602 @cournape Add pdf task + full dmg build for paver script.
cournape authored
532
7b2d3ba @cournape REL: new, better paver file.
cournape authored
533 # Build the dmg
534 cmd = ["./new-create-dmg", "--pkgname", os.path.basename(mpkg_target),
535 "--volname", "numpy", os.path.basename(dmg), "./content"]
536 st = subprocess.check_call(cmd, cwd=macosx_installer_dir)
bc70602 @cournape Add pdf task + full dmg build for paver script.
cournape authored
537
7b2d3ba @cournape REL: new, better paver file.
cournape authored
538 source = dmg
539 target = os.path.join(idirs, os.path.basename(dmg))
e0abf3b @cournape REL: fix dmg name and dmg build.
cournape authored
540 if not os.path.exists(os.path.dirname(target)):
541 os.makedirs(os.path.dirname(target))
7b2d3ba @cournape REL: new, better paver file.
cournape authored
542 shutil.copy(source, target)
89d874e @cournape Add simple .dmg build to paver.
cournape authored
543
7b2d3ba @cournape REL: new, better paver file.
cournape authored
544 #--------------------------
545 # Source distribution stuff
546 #--------------------------
547 def tarball_name(type='gztar'):
548 root = 'numpy-%s' % FULLVERSION
549 if type == 'gztar':
550 return root + '.tar.gz'
551 elif type == 'zip':
552 return root + '.zip'
553 raise ValueError("Unknown type %s" % type)
706640d @stefanv Clean up paver.py.
stefanv authored
554
310db3a @cournape Update paver script such as one can create the fancy numpy dmg in one…
cournape authored
555 @task
7b2d3ba @cournape REL: new, better paver file.
cournape authored
556 def sdist(options):
557 # To be sure to bypass paver when building sdist... paver + numpy.distutils
558 # do not play well together.
559 sh('python setup.py sdist --formats=gztar,zip')
560
561 # Copy the superpack into installers dir
562 idirs = options.installers.installersdir
563 if not os.path.exists(idirs):
564 os.makedirs(idirs)
565
566 for t in ['gztar', 'zip']:
567 source = os.path.join('dist', tarball_name(t))
568 target = os.path.join(idirs, tarball_name(t))
569 shutil.copy(source, target)
570
571 def compute_md5(idirs):
572 released = paver.path.path(idirs).listdir()
573 checksums = []
574 for f in released:
6dce852 @cournape BUG: fix md5 import for python 2.6 in paver file.
cournape authored
575 m = md5(open(f, 'r').read())
7b2d3ba @cournape REL: new, better paver file.
cournape authored
576 checksums.append('%s %s' % (m.hexdigest(), f))
577
578 return checksums
579
580 def write_release_task(options, filename='NOTES.txt'):
581 idirs = options.installers.installersdir
582 source = paver.path.path(RELEASE_NOTES)
583 target = paver.path.path(filename)
584 if target.exists():
585 target.remove()
586 source.copy(target)
587 ftarget = open(str(target), 'a')
588 ftarget.writelines("""
589 Checksums
590 =========
591
592 """)
593 ftarget.writelines(['%s\n' % c for c in compute_md5(idirs)])
594
595 def write_log_task(options, filename='Changelog'):
596 st = subprocess.Popen(
e2af7b7 @rgommers REL: forward port changes to release scripts from 1.6.x branch.
rgommers authored
597 ['git', 'log', '%s..%s' % (LOG_START, LOG_END)],
7b2d3ba @cournape REL: new, better paver file.
cournape authored
598 stdout=subprocess.PIPE)
599
600 out = st.communicate()[0]
601 a = open(filename, 'w')
602 a.writelines(out)
603 a.close()
604
605 @task
606 def write_release(options):
607 write_release_task(options)
608
609 @task
610 def write_log(options):
611 write_log_task(options)
ffaeb86 @cournape Add a task to write notes and changelog once the installers are ready.
cournape authored
612
613 @task
7b2d3ba @cournape REL: new, better paver file.
cournape authored
614 def write_release_and_log(options):
615 rdir = options.installers.releasedir
616 write_release_task(options, os.path.join(rdir, 'NOTES.txt'))
617 write_log_task(options, os.path.join(rdir, 'Changelog'))
Something went wrong with that request. Please try again.