[Numpy-svn] r5590 - in branches/1.1.x/tools: . osxbuild osxbuild/docs
numpy-svn at scipy.org
numpy-svn at scipy.org
Thu Jul 31 19:25:32 EDT 2008
Author: chris.burns
Date: 2008-07-31 18:25:28 -0500 (Thu, 31 Jul 2008)
New Revision: 5590
Added:
branches/1.1.x/tools/osxbuild/
branches/1.1.x/tools/osxbuild/README.txt
branches/1.1.x/tools/osxbuild/build.py
branches/1.1.x/tools/osxbuild/docs/
branches/1.1.x/tools/osxbuild/docs/README.txt
Log:
Add osxbuild script to 1.1.x branch.
Added: branches/1.1.x/tools/osxbuild/README.txt
===================================================================
--- branches/1.1.x/tools/osxbuild/README.txt 2008-07-31 23:20:39 UTC (rev 5589)
+++ branches/1.1.x/tools/osxbuild/README.txt 2008-07-31 23:25:28 UTC (rev 5590)
@@ -0,0 +1,6 @@
+This directory contains the script to build a universal binary for
+OSX. The binaries work on OSX 10.4 and 10.5.
+
+ - bdist_mpkg v0.4.3 is required
+
+See the docstring in build.py for more details.
Added: branches/1.1.x/tools/osxbuild/build.py
===================================================================
--- branches/1.1.x/tools/osxbuild/build.py 2008-07-31 23:20:39 UTC (rev 5589)
+++ branches/1.1.x/tools/osxbuild/build.py 2008-07-31 23:25:28 UTC (rev 5590)
@@ -0,0 +1,104 @@
+"""Python script to build the OSX universal binaries.
+
+This is a simple script, most of the heavy lifting is done in bdist_mpkg.
+
+To run this script: 'python build.py'
+
+Requires a svn version of numpy is installed, svn is used to revert
+file changes made to the docs for the end-user install. Installer is
+built using sudo so file permissions are correct when installed on
+user system. Script will prompt for sudo pwd.
+
+"""
+
+import os
+import shutil
+import subprocess
+from getpass import getuser
+
+SRC_DIR = '../../'
+
+USER_README = 'docs/README.txt'
+DEV_README = SRC_DIR + 'README.txt'
+
+BUILD_DIR = 'build'
+DIST_DIR = 'dist'
+
+def remove_dirs():
+ print 'Removing old build and distribution directories...'
+ print """The distribution is built as root, so the files have the correct
+ permissions when installed by the user. Chown them to user for removal."""
+ if os.path.exists(BUILD_DIR):
+ cmd = 'sudo chown -R %s %s' % (getuser(), BUILD_DIR)
+ shellcmd(cmd)
+ shutil.rmtree(BUILD_DIR)
+ if os.path.exists(DIST_DIR):
+ cmd = 'sudo chown -R %s %s' % (getuser(), DIST_DIR)
+ shellcmd(cmd)
+ shutil.rmtree(DIST_DIR)
+
+def build_dist():
+ print 'Building distribution... (using sudo)'
+ cmd = 'sudo python setupegg.py bdist_mpkg'
+ shellcmd(cmd)
+
+def build_dmg():
+ print 'Building disk image...'
+ # Since we removed the dist directory at the start of the script,
+ # our pkg should be the only file there.
+ pkg = os.listdir(DIST_DIR)[0]
+ fn, ext = os.path.splitext(pkg)
+ dmg = fn + '.dmg'
+ srcfolder = os.path.join(DIST_DIR, pkg)
+ dstfolder = os.path.join(DIST_DIR, dmg)
+ # build disk image
+ cmd = 'sudo hdiutil create -srcfolder %s %s' % (srcfolder, dstfolder)
+ shellcmd(cmd)
+
+def copy_readme():
+ """Copy a user README with info regarding the website, instead of
+ the developer README which tells one how to build the source.
+ """
+ print 'Copy user README.txt for installer.'
+ shutil.copy(USER_README, DEV_README)
+
+def revert_readme():
+ """Revert the developer README."""
+ print 'Reverting README.txt...'
+ cmd = 'svn revert %s' % DEV_README
+ shellcmd(cmd)
+
+def shellcmd(cmd, verbose=True):
+ """Call a shell command."""
+ if verbose:
+ print cmd
+ try:
+ subprocess.check_call(cmd, shell=True)
+ except subprocess.CalledProcessError, err:
+ msg = """
+ Error while executing a shell command.
+ %s
+ """ % str(err)
+ raise Exception(msg)
+
+def build():
+ # update end-user documentation
+ copy_readme()
+ shellcmd("svn stat %s"%DEV_README)
+
+ # change to source directory
+ cwd = os.getcwd()
+ os.chdir(SRC_DIR)
+
+ # build distribution
+ remove_dirs()
+ build_dist()
+ build_dmg()
+
+ # change back to original directory
+ os.chdir(cwd)
+ # restore developer documentation
+ revert_readme()
+
+if __name__ == '__main__':
+ build()
Added: branches/1.1.x/tools/osxbuild/docs/README.txt
===================================================================
--- branches/1.1.x/tools/osxbuild/docs/README.txt 2008-07-31 23:20:39 UTC (rev 5589)
+++ branches/1.1.x/tools/osxbuild/docs/README.txt 2008-07-31 23:25:28 UTC (rev 5590)
@@ -0,0 +1,22 @@
+NumPy is the fundamental package needed for scientific computing with Python.
+This package contains:
+
+ * a powerful N-dimensional array object
+ * sophisticated (broadcasting) functions
+ * tools for integrating C/C++ and Fortran code
+ * useful linear algebra, Fourier transform, and random number capabilities.
+
+It derives from the old Numeric code base and can be used as a replacement for Numeric. It also adds the features introduced by numarray and can be used to replace numarray.
+
+More information can be found at the website:
+
+http://scipy.org/NumPy
+
+After installation, tests can be run with:
+
+python -c 'import numpy; numpy.test()'
+
+The most current development version is always available from our
+subversion repository:
+
+http://svn.scipy.org/svn/numpy/trunk
More information about the Numpy-svn
mailing list