def build_nsis(): scipy_verstr = get_scipy_version(options.src_root) bdir = bootstrap_dir(options.pyver) prepare_nsis_script(bdir, options.pyver, scipy_verstr) for arch in ['nosse', 'sse2', 'sse3']: raw_clean_bootstrap(options.pyver) set_bootstrap_sources(arch, options.pyver) raw_build_arch(options.pyver, arch, options.src_root) raw_build_nsis(options.pyver)
def prepare_scipy_sources(src_root, bootstrap): zid = ZipFile(pjoin(src_root, 'dist', get_sdist_tarball(src_root))) root = 'scipy-%s' % get_scipy_version(src_root) # From the sdist-built tarball, extract all files into bootstrap directory, # but removing the scipy-VERSION head path for name in zid.namelist(): cnt = zid.read(name) if name.startswith(root): # XXX: even on windows, the path sep in zip is '/' ? name = name.split('/', 1)[1] newname = pjoin(bootstrap, name) if not pexists(dirname(newname)): os.makedirs(dirname(newname)) fid = open(newname, 'wb') fid.write(cnt)
def raw_build_arch(pyver, arch, src_root): scipy_verstr = get_scipy_version(src_root) bdir = bootstrap_dir(pyver) print("Building scipy (version %s) binary for python %s, arch is %s" % \ (scipy_verstr, get_python_exec(pyver), arch)) if BUILD_MSI: cmd = [ get_python_exec(pyver), "setup.py", "build", "-c", "mingw32", "bdist_msi" ] else: cmd = [ get_python_exec(pyver), "setup.py", "build", "-c", "mingw32", "bdist_wininst" ] build_log = "build-%s-%s.log" % (arch, pyver) f = open(build_log, 'w') try: try: st = subprocess.call( cmd, #shell = True, stderr=subprocess.STDOUT, stdout=f, cwd=bdir) if st: raise RuntimeError("The cmd failed with status %d" % st) finally: f.close() except (subprocess.CalledProcessError, RuntimeError), e: print(e) msg = """ There was an error while executing the following command: %s Error was : %s Look at the build log (%s).""" % (cmd, str(e), build_log) raise Exception(msg)
def raw_build_arch(pyver, arch, src_root): scipy_verstr = get_scipy_version(src_root) bdir = bootstrap_dir(pyver) print("Building scipy (version %s) binary for python %s, arch is %s" % \ (scipy_verstr, get_python_exec(pyver), arch)) if BUILD_MSI: cmd = [get_python_exec(pyver), "setup.py", "build", "-c", "mingw32", "bdist_msi"] else: cmd = [get_python_exec(pyver), "setup.py", "build", "-c", "mingw32", "bdist_wininst"] build_log = "build-%s-%s.log" % (arch, pyver) f = open(build_log, 'w') try: try: st = subprocess.call(cmd, #shell = True, stderr = subprocess.STDOUT, stdout = f, cwd=bdir) if st: raise RuntimeError("The cmd failed with status %d" % st) finally: f.close() except (subprocess.CalledProcessError, RuntimeError), e: print(e) msg = """ There was an error while executing the following command: %s Error was : %s Look at the build log (%s).""" % (cmd, str(e), build_log) raise Exception(msg)
def bootstrap_nsis(): pyver = options.pyver bdir = bootstrap_dir(options.pyver) prepare_nsis_script(bdir, pyver, get_scipy_version(options.src_root))
def get_sdist_tarball(src_root): """Return the name of the installer built by sdist command.""" # Yeah, the name logic is harcoded in distutils. We have to reproduce it # here name = "scipy-%s.zip" % get_scipy_version(src_root) return name