[Numpy-svn] r5559 - in branches/1.1.x: . tools/win32build tools/win32build/nsis_scripts

numpy-svn at scipy.org numpy-svn at scipy.org
Mon Jul 28 01:28:34 EDT 2008


Author: cdavid
Date: 2008-07-28 00:28:21 -0500 (Mon, 28 Jul 2008)
New Revision: 5559

Added:
   branches/1.1.x/tools/win32build/doall.py
   branches/1.1.x/tools/win32build/nsis_scripts/numpy-superinstaller.nsi.in
   branches/1.1.x/tools/win32build/prepare_bootstrap.py
Removed:
   branches/1.1.x/tools/win32build/nsis_scripts/numpy-superinstaller-2.4.nsi
   branches/1.1.x/tools/win32build/nsis_scripts/numpy-superinstaller-2.5.nsi
Modified:
   branches/1.1.x/MANIFEST.in
   branches/1.1.x/tools/win32build/README.txt
   branches/1.1.x/tools/win32build/build.py
Log:
Backport win32build improvements + MANIFEST.in fix.

Modified: branches/1.1.x/MANIFEST.in
===================================================================
--- branches/1.1.x/MANIFEST.in	2008-07-28 05:25:04 UTC (rev 5558)
+++ branches/1.1.x/MANIFEST.in	2008-07-28 05:28:21 UTC (rev 5559)
@@ -8,6 +8,6 @@
 include setupscons.py
 include setupegg.py
 # Adding scons build relateed files not found by distutils
-include numpy/core/code_generators/__init__.py
+recursive-include numpy/core/code_generators *.py
 include numpy/core/include/numpy/numpyconfig.h.in
-recursive-include numpy/ SConstruct
+recursive-include numpy SConstruct

Modified: branches/1.1.x/tools/win32build/README.txt
===================================================================
--- branches/1.1.x/tools/win32build/README.txt	2008-07-28 05:25:04 UTC (rev 5558)
+++ branches/1.1.x/tools/win32build/README.txt	2008-07-28 05:28:21 UTC (rev 5559)
@@ -1,9 +1,64 @@
-This directory contains various scripts and code to build installers for
-windows
-	- cpuid: contains a mini lib to detect SSE.
-	- cpucaps: nsis plugin to add the ability to detect SSE for installers.
-	- *nsi scripts: actual nsis scripts to build the installer
-	- build.py: script to build various versions of python binaries
-	  (several archs, several python versions)
-
-To build the binaries, you need blas/lapack/atlas for all architectures.
+This directory contains various scripts and code to build binaries installers for
+windows.
+
+It can:
+        - prepare a bootstrap environment to build binary in a self-contained
+          directory
+        - build binaries for different architectures using different site.cfg
+        - prepare a nsis-based installer which automatically detects the arch
+          on the computer where numpy is installed.
+
+Example:
+========
+
+python doall.py
+
+Should build the numpy 'super' installer for sse2, sse3 and nosse from scratch.
+You have to run it in the win32build directory.
+
+Dependencies:
+=============
+
+You need the following to use those scripts:
+        - python and mingw tools (gcc, make, g77 at least).
+        - the binaries for atlas/blas/lapack for the various archs supported
+          (see vendor in numpy repository root for tools to build those).
+        - python, nsis and subversion command line tools should be in your
+          PATH, e.g. running python, makensis and svn should work in a DOS
+          cmd.exe.
+        - the CpuCaps nsis plugin (see below on how to build it).
+
+Components:
+===========
+
+cpuid
+-----
+
+cpuid: contains a mini C lib to detect SSE variants (SSE 1, 2 and 3 for now).
+It relies on gcc ASM, but porting it to VS should be trivial (only a few lines
+os ASM).
+
+cpucaps:
+--------
+
+cpucaps: nsis plugin to add the ability to detect SSE for installers, uses
+cpuid. To build it, you have two options:
+        - build it manually: build the CpuCaps.dll with sources cpucaps.c and
+          cpuid.c in cpuid directory.
+        - with scons: if you have scons, just do scons install. It will build
+          and put the CpuCaps.dll  in the plugins directory of nsis (if you
+          install nsis in the default path).
+
+build.py:
+---------
+
+Can build the binaries for each variant of arch in a bootstrap environment
+
+prepare_bootstrap.py
+--------------------
+
+Script to prepare a bootstrap environment. A bootstrap environment depends on
+the python version (2.5, 2.4, etc...).
+
+It works by building a source distribution, unzipping it in a bootrap
+directory, and putting everything (build.py, nsis script, etc...) in it.

Modified: branches/1.1.x/tools/win32build/build.py
===================================================================
--- branches/1.1.x/tools/win32build/build.py	2008-07-28 05:25:04 UTC (rev 5558)
+++ branches/1.1.x/tools/win32build/build.py	2008-07-28 05:28:21 UTC (rev 5559)
@@ -1,110 +1,117 @@
-"""Python script to build windows binaries to be fed to the "superpack".
-
-The script is pretty dumb: it assumes python executables are installed the
-standard way, and the location for blas/lapack/atlas is harcoded."""
-
-# TODO:
-#  - integrate the x86analysis script to check built binaries
-#  - make the config configurable with a file
-import sys
-import subprocess
-import os
-import shutil
-
-PYEXECS = {"2.5" : "C:\python25\python.exe",
-        "2.4" : "C:\python24\python2.4.exe"}
-
-_SSE3_CFG = r"""[atlas]
-library_dirs = C:\local\lib\yop\sse3"""
-_SSE2_CFG = r"""[atlas]
-library_dirs = C:\local\lib\yop\sse2"""
-_NOSSE_CFG = r"""[DEFAULT]
-library_dirs = C:\local\lib\yop\nosse"""
-
-SITECFG = {"sse2" : _SSE2_CFG, "sse3" : _SSE3_CFG, "nosse" : _NOSSE_CFG}
-
-def get_python_exec(ver):
-    """Return the executable of python for the given version."""
-    # XXX Check that the file actually exists
-    try:
-        return PYEXECS[ver]
-    except KeyError:
-        raise ValueError("Version %s not supported/recognized" % ver)
-
-def get_clean():
-    if os.path.exists("build"):
-        shutil.rmtree("build")
-    if os.path.exists("dist"):
-        shutil.rmtree("dist")
-
-def write_site_cfg(arch):
-    if os.path.exists("site.cfg"):
-        os.remove("site.cfg")
-    f = open("site.cfg", 'w')
-    f.writelines(SITECFG[arch])
-    f.close()
-
-def build(arch, pyver):
-    print "Building numpy binary for python %s, arch is %s" % (get_python_exec(pyver), arch)
-    get_clean()
-    write_site_cfg(arch)
-
-    cmd = "%s setup.py build -c mingw32 bdist_wininst" % get_python_exec(pyver)
-    build_log = "build-%s-%s.log" % (arch, pyver)
-    f = open(build_log, 'w')
-
-    try:
-        try:
-            subprocess.check_call(cmd, shell = True, stderr = subprocess.STDOUT, stdout = f)
-        finally:
-            f.close()
-    except subprocess.CalledProcessError, 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)
-
-    move_binary(arch, pyver)
-
-def move_binary(arch, pyver):
-    if not os.path.exists("binaries"):
-        os.makedirs("binaries")
-
-    shutil.move(os.path.join('dist', get_windist_exec(pyver)), 
-            os.path.join("binaries", get_binary_name(arch)))
-
-def get_numpy_version():
-    import __builtin__
-    __builtin__.__NUMPY_SETUP__ = True
-    from numpy.version import version
-    return version
-
-def get_binary_name(arch):
-    return "numpy-%s-%s.exe" % (get_numpy_version(), arch)
-
-def get_windist_exec(pyver):
-    """Return the name of the installer built by wininst command."""
-    # Yeah, the name logic is harcoded in distutils. We have to reproduce it
-    # here
-    name = "numpy-%s.win32-py%s.exe" % (get_numpy_version(), pyver)
-    return name
-
-USAGE = """build.py ARCH PYTHON_VERSION
-
-Example: build.py sse2 2.4."""
-
-if __name__ == '__main__':
-    if len(sys.argv) < 3:
-        raise ValueError(USAGE)
-        sys.exit(-1)
-
-    arch = sys.argv[1]
-    pyver = sys.argv[2]
-    #build(arch, pyver)
-    for arch in SITECFG.keys():
-        build(arch, pyver)
+"""Python script to build windows binaries to be fed to the "superpack".
+
+The script is pretty dumb: it assumes python executables are installed the
+standard way, and the location for blas/lapack/atlas is harcoded."""
+
+# TODO:
+#  - integrate the x86analysis script to check built binaries
+#  - make the config configurable with a file
+import sys
+import subprocess
+import os
+import shutil
+from os.path import join as pjoin, split as psplit, dirname
+
+PYEXECS = {"2.5" : "C:\python25\python.exe",
+        "2.4" : "C:\python24\python2.4.exe"}
+
+_SSE3_CFG = r"""[atlas]
+library_dirs = C:\local\lib\yop\sse3"""
+_SSE2_CFG = r"""[atlas]
+library_dirs = C:\local\lib\yop\sse2"""
+_NOSSE_CFG = r"""[DEFAULT]
+library_dirs = C:\local\lib\yop\nosse"""
+
+SITECFG = {"sse2" : _SSE2_CFG, "sse3" : _SSE3_CFG, "nosse" : _NOSSE_CFG}
+
+def get_python_exec(ver):
+    """Return the executable of python for the given version."""
+    # XXX Check that the file actually exists
+    try:
+        return PYEXECS[ver]
+    except KeyError:
+        raise ValueError("Version %s not supported/recognized" % ver)
+
+def get_clean():
+    if os.path.exists("build"):
+        shutil.rmtree("build")
+    if os.path.exists("dist"):
+        shutil.rmtree("dist")
+
+def write_site_cfg(arch):
+    if os.path.exists("site.cfg"):
+        os.remove("site.cfg")
+    f = open("site.cfg", 'w')
+    f.writelines(SITECFG[arch])
+    f.close()
+
+def build(arch, pyver):
+    print "Building numpy binary for python %s, arch is %s" % (get_python_exec(pyver), arch)
+    get_clean()
+    write_site_cfg(arch)
+
+    cmd = "%s setup.py build -c mingw32 bdist_wininst" % get_python_exec(pyver)
+    build_log = "build-%s-%s.log" % (arch, pyver)
+    f = open(build_log, 'w')
+
+    try:
+        try:
+            subprocess.check_call(cmd, shell = True, stderr = subprocess.STDOUT, stdout = f)
+        finally:
+            f.close()
+    except subprocess.CalledProcessError, 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)
+
+    move_binary(arch, pyver)
+
+def move_binary(arch, pyver):
+    if not os.path.exists("binaries"):
+        os.makedirs("binaries")
+
+    shutil.move(os.path.join('dist', get_windist_exec(pyver)), 
+            os.path.join("binaries", get_binary_name(arch)))
+
+def get_numpy_version():
+    import __builtin__
+    __builtin__.__NUMPY_SETUP__ = True
+    from numpy.version import version
+    return version
+
+def get_binary_name(arch):
+    return "numpy-%s-%s.exe" % (get_numpy_version(), arch)
+
+def get_windist_exec(pyver):
+    """Return the name of the installer built by wininst command."""
+    # Yeah, the name logic is harcoded in distutils. We have to reproduce it
+    # here
+    name = "numpy-%s.win32-py%s.exe" % (get_numpy_version(), pyver)
+    return name
+
+if __name__ == '__main__':
+    from optparse import OptionParser
+    parser = OptionParser()
+    parser.add_option("-a", "--arch", dest="arch", 
+                      help = "Architecture to build (sse2, sse3, nosse, etc...)")
+    parser.add_option("-p", "--pyver", dest="pyver",
+                      help = "Python version (2.4, 2.5, etc...)")
+
+    opts, args = parser.parse_args()
+    arch = opts.arch
+    pyver = opts.pyver
+
+    if not pyver:
+        pyver = "2.5"
+
+    if not arch:
+        for arch in SITECFG.keys():
+            build(arch, pyver)
+    else:
+        build(arch, pyver)

Copied: branches/1.1.x/tools/win32build/doall.py (from rev 5558, trunk/tools/win32build/doall.py)

Deleted: branches/1.1.x/tools/win32build/nsis_scripts/numpy-superinstaller-2.4.nsi
===================================================================
--- branches/1.1.x/tools/win32build/nsis_scripts/numpy-superinstaller-2.4.nsi	2008-07-28 05:25:04 UTC (rev 5558)
+++ branches/1.1.x/tools/win32build/nsis_scripts/numpy-superinstaller-2.4.nsi	2008-07-28 05:28:21 UTC (rev 5559)
@@ -1,120 +0,0 @@
-;--------------------------------
-;Include Modern UI
-
-!include "MUI2.nsh"
-
-;SetCompress off ; Useful to disable compression under development
-
-;--------------------------------
-;General
-
-;Name and file
-Name "Numpy super installer"
-OutFile "numpy-1.1.0-win32-superpack-python2.4.exe"
-
-;Default installation folder
-InstallDir "$TEMP"
-
-;--------------------------------
-;Interface Settings
-
-!define MUI_ABORTWARNING
-
-;--------------------------------
-;Pages
-
-;!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
-;!insertmacro MUI_PAGE_COMPONENTS
-;!insertmacro MUI_PAGE_DIRECTORY
-;!insertmacro MUI_PAGE_INSTFILES
-  
-;!insertmacro MUI_UNPAGE_CONFIRM
-;!insertmacro MUI_UNPAGE_INSTFILES
-  
-;--------------------------------
-;Languages
- 
-!insertmacro MUI_LANGUAGE "English"
-
-;--------------------------------
-;Component Sections
-
-!include 'Sections.nsh'
-!include LogicLib.nsh
-
-Var HasSSE2
-Var HasSSE3
-Var CPUSSE
-
-Section "Core" SecCore
-
-  ;SectionIn RO
-  SetOutPath "$INSTDIR"
-    
-  ;Create uninstaller
-  ;WriteUninstaller "$INSTDIR\Uninstall.exe"
-
-  DetailPrint "Install dir for actual installers is $INSTDIR"
-
-  StrCpy $CPUSSE "0"
-  CpuCaps::hasSSE2
-  Pop $0
-  StrCpy $HasSSE2 $0
-
-  CpuCaps::hasSSE3
-  Pop $0
-  StrCpy $HasSSE3 $0
-
-  ; Debug
-  StrCmp $HasSSE2 "Y" include_sse2 no_include_sse2
-  include_sse2:
-    DetailPrint '"Target CPU handles SSE2"'
-    StrCpy $CPUSSE "2"
-    goto done_sse2
-  no_include_sse2:
-    DetailPrint '"Target CPU does NOT handle SSE2"'
-    goto done_sse2
-  done_sse2:
-
-  StrCmp $HasSSE3 "Y" include_sse3 no_include_sse3
-  include_sse3:
-    DetailPrint '"Target CPU handles SSE3"'
-    StrCpy $CPUSSE "3"
-    goto done_sse3
-  no_include_sse3:
-    DetailPrint '"Target CPU does NOT handle SSE3"'
-    goto done_sse3
-  done_sse3:
-  
-  ClearErrors
-  
-  ; Install files conditionaly on detected cpu 
-  ${Switch} $CPUSSE
-    ${Case} "3"
-      DetailPrint '"Install SSE 3"'
-      File "numpy-1.1.0-sse3.exe"
-      ExecWait '"$INSTDIR\numpy-1.1.0-sse3.exe"'
-      ${Break}
-    ${Case} "2"
-      DetailPrint '"Install SSE 2"'
-      File "numpy-1.1.0-sse2.exe"
-      ExecWait '"$INSTDIR\numpy-1.1.0-sse2.exe"'
-      ${Break}
-   ${Default}
-      DetailPrint '"Install NO SSE"'
-      File "numpy-1.1.0-nosse.exe"
-      ExecWait '"$INSTDIR\numpy-1.1.0-nosse.exe"'
-      ${Break}
-  ${EndSwitch}
-  
-  ; Handle errors when executing installers
-  IfErrors error no_error
-  
-  error:
-    messageBox MB_OK "Executing numpy installer failed" 
-	goto done
-  no_error:
-    goto done
-  done:
-    
-SectionEnd

Deleted: branches/1.1.x/tools/win32build/nsis_scripts/numpy-superinstaller-2.5.nsi
===================================================================
--- branches/1.1.x/tools/win32build/nsis_scripts/numpy-superinstaller-2.5.nsi	2008-07-28 05:25:04 UTC (rev 5558)
+++ branches/1.1.x/tools/win32build/nsis_scripts/numpy-superinstaller-2.5.nsi	2008-07-28 05:28:21 UTC (rev 5559)
@@ -1,120 +0,0 @@
-;--------------------------------
-;Include Modern UI
-
-!include "MUI2.nsh"
-
-;SetCompress off ; Useful to disable compression under development
-
-;--------------------------------
-;General
-
-;Name and file
-Name "Numpy super installer"
-OutFile "numpy-1.1.0-win32-superpack-python2.5.exe"
-
-;Default installation folder
-InstallDir "$TEMP"
-
-;--------------------------------
-;Interface Settings
-
-!define MUI_ABORTWARNING
-
-;--------------------------------
-;Pages
-
-;!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
-;!insertmacro MUI_PAGE_COMPONENTS
-;!insertmacro MUI_PAGE_DIRECTORY
-;!insertmacro MUI_PAGE_INSTFILES
-  
-;!insertmacro MUI_UNPAGE_CONFIRM
-;!insertmacro MUI_UNPAGE_INSTFILES
-  
-;--------------------------------
-;Languages
- 
-!insertmacro MUI_LANGUAGE "English"
-
-;--------------------------------
-;Component Sections
-
-!include 'Sections.nsh'
-!include LogicLib.nsh
-
-Var HasSSE2
-Var HasSSE3
-Var CPUSSE
-
-Section "Core" SecCore
-
-  ;SectionIn RO
-  SetOutPath "$INSTDIR"
-    
-  ;Create uninstaller
-  ;WriteUninstaller "$INSTDIR\Uninstall.exe"
-
-  DetailPrint "Install dir for actual installers is $INSTDIR"
-
-  StrCpy $CPUSSE "0"
-  CpuCaps::hasSSE2
-  Pop $0
-  StrCpy $HasSSE2 $0
-
-  CpuCaps::hasSSE3
-  Pop $0
-  StrCpy $HasSSE3 $0
-
-  ; Debug
-  StrCmp $HasSSE2 "Y" include_sse2 no_include_sse2
-  include_sse2:
-    DetailPrint '"Target CPU handles SSE2"'
-    StrCpy $CPUSSE "2"
-    goto done_sse2
-  no_include_sse2:
-    DetailPrint '"Target CPU does NOT handle SSE2"'
-    goto done_sse2
-  done_sse2:
-
-  StrCmp $HasSSE3 "Y" include_sse3 no_include_sse3
-  include_sse3:
-    DetailPrint '"Target CPU handles SSE3"'
-    StrCpy $CPUSSE "3"
-    goto done_sse3
-  no_include_sse3:
-    DetailPrint '"Target CPU does NOT handle SSE3"'
-    goto done_sse3
-  done_sse3:
-  
-  ClearErrors
-  
-  ; Install files conditionaly on detected cpu 
-  ${Switch} $CPUSSE
-    ${Case} "3"
-      DetailPrint '"Install SSE 3"'
-      File "numpy-1.1.0-sse3.exe"
-      ExecWait '"$INSTDIR\numpy-1.1.0-sse3.exe"'
-      ${Break}
-    ${Case} "2"
-      DetailPrint '"Install SSE 2"'
-      File "numpy-1.1.0-sse2.exe"
-      ExecWait '"$INSTDIR\numpy-1.1.0-sse2.exe"'
-      ${Break}
-   ${Default}
-      DetailPrint '"Install NO SSE"'
-      File "numpy-1.1.0-nosse.exe"
-      ExecWait '"$INSTDIR\numpy-1.1.0-nosse.exe"'
-      ${Break}
-  ${EndSwitch}
-  
-  ; Handle errors when executing installers
-  IfErrors error no_error
-  
-  error:
-    messageBox MB_OK "Executing numpy installer failed" 
-	goto done
-  no_error:
-    goto done
-  done:
-    
-SectionEnd

Copied: branches/1.1.x/tools/win32build/nsis_scripts/numpy-superinstaller.nsi.in (from rev 5558, trunk/tools/win32build/nsis_scripts/numpy-superinstaller.nsi.in)

Copied: branches/1.1.x/tools/win32build/prepare_bootstrap.py (from rev 5558, trunk/tools/win32build/prepare_bootstrap.py)




More information about the Numpy-svn mailing list