Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix scipy so it builds on OS X Lion #11886

Closed
jhpalmieri opened this issue Sep 30, 2011 · 18 comments
Closed

fix scipy so it builds on OS X Lion #11886

jhpalmieri opened this issue Sep 30, 2011 · 18 comments

Comments

@jhpalmieri
Copy link
Member

As the summary says. The new spkg applies the patches from this commit to the scipy github repo.  New spkg at

The home base for this ticket is the Lion ticket #11881.

Upstream: Fixed upstream, but not in a stable release.

CC: @nexttime @mwhansen

Component: packages: standard

Keywords: scipy spkg upgrade update lion darwin 11

Author: John Palmieri

Reviewer: Mike Hansen, Leif Leonhardy

Merged: sage-4.8.alpha1

Issue created by migration from https://trac.sagemath.org/ticket/11886

@jhpalmieri
Copy link
Member Author

patch for scipy pkg, for review only

@jhpalmieri

This comment has been minimized.

@jhpalmieri
Copy link
Member Author

comment:1

Attachment: trac_11886-scipy.patch.gz

@nexttime
Copy link
Mannequin

nexttime mannequin commented Sep 30, 2011

comment:2

They should really fix the hundreds of warnings...

Builds on Solaris (SPARC), with GCC 4.5.1 (on mark2) at least.

@kcrisman

This comment has been minimized.

@mwhansen
Copy link
Contributor

mwhansen commented Nov 1, 2011

comment:4

These were the changes I had to make before. Builds on Lion for me.

@mwhansen
Copy link
Contributor

mwhansen commented Nov 1, 2011

Reviewer: Mike Hansen

@nexttime
Copy link
Mannequin

nexttime mannequin commented Nov 1, 2011

comment:5

Minor thing (another copy-paste accident):

The changelog entries should have === (instead of ==):

diff --git a/SPKG.txt b/SPKG.txt
--- a/SPKG.txt
+++ b/SPKG.txt
@@ -26,20 +26,24 @@
  * Python, which in Sage has numerous dependencies
  * Numpy
  * Fortran
+ * GNU patch
 
 == Special Update/Build Instructions ==
- * None
+ * Make sure the patches still apply.
+   The ones added in the scipy-0.9.p0 spkg (#11886) were all taken from
+   (unstable) upstream, so can presumably be removed once we upgrade to
+   a new stable version.
 
 == Changelog ==
 
-== scipy-0.9.p0 (John Palmieri, 30 Sept 2011) ==
+=== scipy-0.9.p0 (John Palmieri, 30 Sept 2011) ===
  * #11886: get scipy to build on OS X 10.7 Lion, using the patches from
    https://github.com/scipy/scipy/commit/effa6f68f8ada57b79864852b609ff06d2527306
 
-== scipy-0.9 (F. Bissey; 16 March 2011) ===
+=== scipy-0.9 (F. Bissey; 16 March 2011) ===
  * updated the source to 0.9.0. No patches needed.
 
-== scipy-0.8 (S. Reiterer, F. Bissey, D. Kirkby, J. H. Palmieri; 14 October 2010) ===
+=== scipy-0.8 (S. Reiterer, F. Bissey, D. Kirkby, J. H. Palmieri; 14 October 2010) ===
  * #9808 Upgrade to scipy 0.8.
  * Deleted outdated patches
  * spkg install changed by F. Bissey, because g95 makes trouble on OS X.

(The merger script is btw. likely to reject the spkg otherwise.)

spkg-install isn't executable.

GNU patch should be added to the dependencies. (See diff above).

if [ $? -ne 0 ]; then
    echo "Error patching setup.py"
    exit 1
fi

should get removed, since no patch gets applied to setup.py.

There are a few typos in the comments, and spkg-install lacks the usual sanity check.

diff --git a/spkg-install b/spkg-install
--- a/spkg-install
+++ b/spkg-install
@@ -1,10 +1,18 @@
 #!/usr/bin/env bash
-# These flags confuse numpy's distutils.   In particular,
+
+if [ -z "$SAGE_LOCAL" ]; then
+    echo >&2 "Error: SAGE_LOCAL undefined - exiting..."
+    echo >&2 "Maybe run 'sage -sh'?"
+    exit 1
+fi
+
+# These flags confuse numpy's distutils.  In particular,
 # if they are set empty bad things happen.
+unset CFLAGS CXXFLAGS SHAREDFLAGS
+echo "Note: CFLAGS, CXXFLAGS and SHAREDFLAGS are taken from distutils,"
+echo "      so their current settings are ignored."
 
-unset CFLAGS CXXFLAGS SHAREDFLAGS
-
-if [ `uname` = "Darwin" ]; then
+if [ "$UNAME" = "Darwin" ]; then
     unset ATLAS
     unset BLAS
     unset LAPACK
@@ -23,43 +31,38 @@
 export F90="$SAGE_LOCAL/bin/sage_fortran"
 export F95="$SAGE_LOCAL/bin/sage_fortran"
 
-
-# This avoid problems on some systems -- until we officially
-# support umfpack (which we will likely do, since cvxopt
-# I think includes it).
-#   http://projects.scipy.org/pipermail/scipy-user/2006-July/008661.html
-# (Currently swig gets invoked by scipy when building the umfpack interace,
+# This avoids problems on some systems -- until we officially
+# support umfpack (which we will likely do, since cvxopt I think includes it):
+UMFPACK="None"; export UMFPACK
+# See http://projects.scipy.org/pipermail/scipy-user/2006-July/008661.html
+# (Currently SWIG gets invoked by scipy when building the umfpack interface,
 # which is bad.)
 
-UMFPACK="None"; export UMFPACK
+
+# Remove previous installation (if any):
 rm -rf "$SAGE_LOCAL"/lib/python/site-packages/scipy
 
 cd src/
 
+# Apply patches (if any):
 for patch in ../patches/*.patch; do
     patch -p1 <"$patch"
     if [ $? -ne 0 ]; then
-        echo >&2 "Error applying '$patch'"
+        echo >&2 "Error applying '$patch'."
         exit 1
     fi
 done
 
+# Build:
+python setup.py build
 if [ $? -ne 0 ]; then
-    echo "Error patching setup.py"
-    exit 1
-fi 
-
-# Build 
-python setup.py build 
-if [ $? -ne 0 ]; then
-    echo "Error building scipy."
+    echo >&2 "Error building scipy."
     exit 1
 fi
 
-# Intall
-python setup.py install 
+# Install:
+python setup.py install
 if [ $? -ne 0 ]; then
-    echo "Error installing scipy."
+    echo >&2 "Error installing scipy."
     exit 1
 fi
-

(Take whatever you like, or I could upload an updated spkg.)

I'm not sure whether we should only remove an old installation upon a successful build, after python setup.py build, but before running python setup.py install.

@nexttime
Copy link
Mannequin

nexttime mannequin commented Nov 1, 2011

Upstream: Fixed upstream, but not in a stable release.

@nexttime
Copy link
Mannequin

nexttime mannequin commented Nov 1, 2011

Changed reviewer from Mike Hansen to Mike Hansen, Leif Leonhardy

@nexttime nexttime mannequin added s: needs work and removed s: positive review labels Nov 1, 2011
@nexttime

This comment has been minimized.

@nexttime
Copy link
Mannequin

nexttime mannequin commented Nov 1, 2011

comment:6

FWIW, there are so many changes, I've made a p1:

http://sage.math.washington.edu/home/leif/Sage/spkgs/scipy-0.9.p1.spkg

@nexttime nexttime mannequin added s: needs review and removed s: needs work labels Nov 1, 2011
@nexttime
Copy link
Mannequin

nexttime mannequin commented Nov 1, 2011

Diff between John's p0 and my p1. For reference / review.

@jhpalmieri
Copy link
Member Author

comment:7

Attachment: scipy-0.9.p0-p1.diff.gz

Looks good to me. The only change I might consider in addition is this:

diff --git a/SPKG.txt b/SPKG.txt
--- a/SPKG.txt
+++ b/SPKG.txt
@@ -33,6 +33,11 @@ BSD terms. See http://www.scipy.org/Lice
    The ones added in the scipy-0.9.p0 spkg (#11886) were all taken from
    (unstable) upstream, so can presumably be removed once we upgrade to
    a new stable version.
+ * To do: in spkg-install, should we only remove the previous
+   installation after successfully building the new one?  That is, is
+   it safe to move 'rm -rf "$SAGE_LOCAL"/lib/python/site-packages/scipy' 
+   so it is between 'python setup.py build' and 'python setup.py
+   install'?
 
 == Changelog ==
 

@nexttime
Copy link
Mannequin

nexttime mannequin commented Nov 1, 2011

comment:8

I've attached a diff with my changes w.r.t. John's spkg.

@jdemeyer jdemeyer modified the milestones: sage-4.7.2, sage-4.8 Nov 2, 2011
@jdemeyer
Copy link

jdemeyer commented Nov 3, 2011

Milestone sage-4.7.3 deleted

@jdemeyer jdemeyer removed this from the sage-4.8 milestone Nov 3, 2011
@jhpalmieri
Copy link
Member Author

comment:11

By the way, this builds and doctests pass on a variety of platforms.

@jhpalmieri jhpalmieri added this to the sage-4.8 milestone Nov 5, 2011
@jdemeyer
Copy link

jdemeyer commented Nov 7, 2011

Merged: sage-4.8.alpha1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants