[83852] trunk/dports/python

ram at macports.org ram at macports.org
Sun Sep 11 18:59:50 PDT 2011


Revision: 83852
          http://trac.macports.org/changeset/83852
Author:   ram at macports.org
Date:     2011-09-11 18:59:49 -0700 (Sun, 11 Sep 2011)
Log Message:
-----------
python/py*-numpy: unify

Modified Paths:
--------------
    trunk/dports/python/py-numpy/Portfile

Added Paths:
-----------
    trunk/dports/python/py-numpy/files/wrapper-template

Removed Paths:
-------------
    trunk/dports/python/py25-numpy/
    trunk/dports/python/py26-numpy/
    trunk/dports/python/py27-numpy/
    trunk/dports/python/py31-numpy/
    trunk/dports/python/py32-numpy/

Modified: trunk/dports/python/py-numpy/Portfile
===================================================================
--- trunk/dports/python/py-numpy/Portfile	2011-09-12 00:57:51 UTC (rev 83851)
+++ trunk/dports/python/py-numpy/Portfile	2011-09-12 01:59:49 UTC (rev 83852)
@@ -1,33 +1,35 @@
-# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
 # $Id$
 
-PortSystem          1.0
-PortGroup           python24 1.0
+PortSystem              1.0
+PortGroup               python 1.0
 
-name                py-numpy
-version             1.6.0
-categories          python math
-license             BSD
-platforms           darwin
-maintainers         dh openmaintainer
-description         The core utilities for the scientific library scipy for Python
-long_description    ${description}
+name                    py-numpy
+version                 1.6.1
+categories              python math
+license                 BSD
+platforms               darwin
+maintainers             dh ram openmaintainer
+description             The core utilities for the scientific library scipy for Python
+long_description        ${description}
 
-homepage            http://numpy.scipy.org/
-master_sites        sourceforge:project/numpy/NumPy/${version}/
-distname            numpy-${version}
+homepage                http://numpy.scipy.org/
+master_sites            sourceforge:project/numpy/NumPy/${version}/
+distname                numpy-${version}
 
-checksums           md5 e0993c74cb8e83292e560eac1a9be8e9 \
-                    sha1 0692acfb5cdc55ca251aa2b950e321a662810c36 \
-                    rmd160 29bee854e1436e0baad46150606d7a0d2d80ac61
+checksums               md5 2bce18c08fc4fce461656f0f4dd9103e \
+                        sha1 3f73ff9231a1c15e28e6e259ef5cc35a72b34059 \
+                        rmd160 e4619fd5860c85a9c00bce0d0cb8dd9bb07a56f5
 
-patchfiles          patch-f2py_setup.py.diff \
-                    patch-system_info.py.diff \
-                    patch-fcompiler_g95.diff
+if {${subport} != ${name}} {
 
-depends_lib-append  port:fftw-3 \
-                    port:py-nose
+patchfiles              patch-f2py_setup.py.diff \
+                        patch-system_info.py.diff \
+                        patch-fcompiler_g95.diff
 
+depends_lib-append      port:fftw-3 \
+                        port:py${python.version}-nose
+
 if {[variant_isset universal] && ![variant_isset atlas]} {
     build.env-append    ARCHFLAGS="${configure.universal_ldflags}"
 } else {
@@ -50,20 +52,25 @@
 # the +atlas variant) ...
 set gcc_version ""
 if {[variant_isset atlas]} {
-    universal_variant no
 
     # see if the user has set -gcc4X to disable using MacPorts'
     # compiler; if not, either use what the user set (as +gcc4X) or
     # default to gcc44.
 
     variant gcc43 conflicts gcc44 gcc45 \
-    description {Use the gcc43 compiler (enables fortran linking)} {}
+    description {Use the gcc43 compiler (enables fortran linking)} {
+        configure.compiler  macports-gcc-4.3
+    }
 
     variant gcc44 conflicts gcc43 gcc45 \
-    description {Use the gcc44 compiler (enables fortran linking)} {}
+    description {Use the gcc44 compiler (enables fortran linking)} {
+        configure.compiler  macports-gcc-4.4
+    }
 
     variant gcc45 conflicts gcc43 gcc44 \
-    description {Use the gcc45 compiler (enables fortran linking)} {}
+    description {Use the gcc45 compiler (enables fortran linking)} {
+        configure.compiler  macports-gcc-4.5
+    }
 
     if {![variant_isset gcc43] && ![variant_isset gcc45]} {
         default_variants +gcc44
@@ -111,20 +118,54 @@
     reinplace "s|@@MPORTS_PYTHON@@|${python.bin}|" \
         ${worksrcpath}/numpy/f2py/setup.py
 
-    # disallow searching for any fortran executable except what is
-    # specified in this Portfile; NOTE: this change only works when
-    # setting the GCC version; if this flag is not set (meaning no
-    # +gcc4X variant is set), then F2PY may or not work.
-    if {${gcc_version} != ""} {
-        # set which fortran to use in the f2py Python scripts
-        reinplace "/possible_executables/s|\\\[.*\\\]|\['gfortran-mp-${gcc_version}'\]|g" ${worksrcpath}/numpy/distutils/fcompiler/gnu.py
+    if {[variant_isset universal] && [variant_isset atlas]} {
+        # Prepare wrappers
+        file copy -force ${filespath}/wrapper-template \
+            ${worksrcpath}/c-wrapper
+        file copy -force ${filespath}/wrapper-template \
+            ${worksrcpath}/f-wrapper
+        file copy -force ${filespath}/wrapper-template \
+            ${worksrcpath}/cxx-wrapper
+
+        if {[variant_isset gcc43]} {
+            set CC  "${prefix}/bin/gcc-mp-4.3"
+            set CXX "${prefix}/bin/g++-mp-4.3"
+            set F90 "${prefix}/bin/gfortran-mp-4.3"
+        } elseif {[variant_isset gcc44]} {
+            set CC  "${prefix}/bin/gcc-mp-4.4"
+            set CXX "${prefix}/bin/g++-mp-4.4"
+            set F90 "${prefix}/bin/gfortran-mp-4.4"
+        } elseif {[variant_isset gcc45]} {
+            set CC  "${prefix}/bin/gcc-mp-4.5"
+            set CXX "${prefix}/bin/g++-mp-4.5"
+            set F90 "${prefix}/bin/gfortran-mp-4.5"
+        }
+
+        reinplace   "s|@@@|${CC}|" ${worksrcpath}/c-wrapper
+        reinplace   "s|---|\\\\.c|" ${worksrcpath}/c-wrapper
+        reinplace   "s|&&&|${prefix}|" ${worksrcpath}/c-wrapper
+
+        reinplace   "s|@@@|${CXX}|" ${worksrcpath}/cxx-wrapper
+        reinplace   "s#---#(\\\\.C|\\\\.cpp|\\\\.cc)#" \
+            ${worksrcpath}/cxx-wrapper
+        reinplace   "s|&&&|${prefix}|" ${worksrcpath}/cxx-wrapper
+
+        reinplace   "s|@@@|${F90}|" ${worksrcpath}/f-wrapper
+        reinplace   "s|---|\\\\.f|" ${worksrcpath}/f-wrapper
+        reinplace   "s|&&&|${prefix}|" ${worksrcpath}/f-wrapper
+
+        build.env-append    CC="${worksrcpath}/c-wrapper" \
+                            CXX="${worksrcpath}/cxx-wrapper" \
+                            F77="${worksrcpath}/f-wrapper" \
+                            F90="${worksrcpath}/f-wrapper"
+
+        destroot.env-append CC="${worksrcpath}/c-wrapper" \
+                            CXX="${worksrcpath}/cxx-wrapper" \
+                            F77="${worksrcpath}/f-wrapper" \
+                            F90="${worksrcpath}/f-wrapper"
     }
 }
 
-post-destroot {
-  if {${os.platform} == "darwin" && ${os.major} < 10} {
-    move ${destroot}${prefix}/bin/f2py ${destroot}${prefix}/bin/f2py${python.branch}
-  }
 }
 
 livecheck.type        regex

Copied: trunk/dports/python/py-numpy/files/wrapper-template (from rev 83851, trunk/dports/python/py27-numpy/files/wrapper-template)
===================================================================
--- trunk/dports/python/py-numpy/files/wrapper-template	                        (rev 0)
+++ trunk/dports/python/py-numpy/files/wrapper-template	2011-09-12 01:59:49 UTC (rev 83852)
@@ -0,0 +1,143 @@
+#!/bin/sh
+COMPILER='@@@'
+SUFFIX='---'
+PREFIX='&&&'
+OUTPUT_O='NO'
+OUTPUT=''
+NAMED_OUTPUT=''
+LASTFILE=''
+INTEL='NO'
+SIZE32='NO'
+SIZE64='NO'
+NEWARGS=''
+
+SKIP='NO'
+
+for arg in $@
+do
+	if [ $SKIP = 'ARCH' ]; then
+		# intercept -arch option and set SIZEXX
+		SKIP='NO'
+		if [ $arg = 'x86_64' ] || [ $arg = 'ppc64' ]; then
+			SIZE64='YES'
+		else
+			SIZE32='YES'
+		fi
+		
+		# which architecture are we compiling for?
+		if [ $arg = 'x86_64' ] || [ $arg = 'i386' ]; then
+			INTEL='YES'
+		fi
+		
+	elif [ $arg = '-arch' ]; then
+		SKIP='ARCH'
+		
+	elif [ $arg = '--version' ]; then
+		${COMPILER} --version
+		exit 0
+		
+	else
+		NEWARGS+="$arg "
+		
+		# if the -c option is given, the output is .o
+		if [ $arg = '-c' ]; then
+			OUTPUT_O='YES'
+		fi
+
+		# if the output file is given by a -o option, record it
+		if [ $SKIP = 'O' ]; then
+			SKIP='NO'
+			NAMED_OUTPUT=$arg
+		fi
+		
+		if [ $arg = '-o' ]; then
+			SKIP='O'
+		fi
+		
+		# Note each file ending by ${SUFFIX} and remember the last one
+		# Transform them in .o 
+		if `echo $arg | grep -q "${SUFFIX}$"`; then
+			LASTFILE=$arg
+			OUTPUT+=`echo $arg | sed "s/${SUFFIX}/\.o/"`
+			OUTPUT+=' '
+		fi
+	fi
+done
+
+# What is the output?
+
+if [ ${NAMED_OUTPUT}"X" != "X" ]; then
+	OUTPUT=$NAMED_OUTPUT
+
+elif [ $OUTPUT_O = 'NO' ]; then
+	# It is an executable whose is name is the LASTFILE without suffix
+	OUTPUT=`echo ${LASTFILE} | sed "s/${SUFFIX}//"`
+fi
+
+# Othewise, the output is just the ${OUTPUT} variable as computed before
+
+# For some reason, -dynamiclib and -lpython2.6 are missing when linking
+# .so files. Add them, except if -bundle is set (incompatible switches)
+if [ `echo $OUTPUT | sed -E 's|.*\.||'` = "so" ] && \
+	! `echo $NEWARGS | grep -q bundle`; then
+	NEWARGS="${NEWARGS} ${PREFIX}/lib/libpython2.6.dylib -dynamiclib"
+fi
+
+# Now, compile
+
+if [ $SIZE32 = 'NO' ] && [ $SIZE64 = 'NO' ]; then
+	# No size indication given, just proceed with default
+	if `${COMPILER} $NEWARGS`; then
+		exit 0
+	else
+		exit 1
+	fi
+
+elif [ $SIZE32 = 'YES' ] && [ $SIZE64 = 'NO' ]; then
+	# 32-bit
+	if `${COMPILER} -m32 $NEWARGS`; then
+		exit 0
+	else
+		exit 1
+	fi
+	
+elif [ $SIZE32 = 'NO' ] && [ $SIZE64 = 'YES' ]; then
+	# 64-bit
+	if `${COMPILER} -m64 $NEWARGS`; then
+		exit 0
+	else
+		exit 1
+	fi
+
+else
+	# Universal case
+	if `${COMPILER} -m32 $NEWARGS`; then
+		for filename in ${OUTPUT}
+		do
+			mv ${filename} ${filename}.32
+		done
+	
+		if `${COMPILER} -m64 $NEWARGS`; then
+			for filename in ${OUTPUT}
+			do
+				mv ${filename} ${filename}.64
+				if [ $INTEL = 'YES' ]; then
+					lipo -create -arch x86_64 ${filename}.64 \
+						 -arch i386 ${filename}.32 \
+			 			 -output ${filename}
+				else
+					lipo -create -arch ppc64 ${filename}.64 \
+						 -arch ppc ${filename}.32 \
+			 			 -output ${filename}
+				fi
+			
+				rm -f ${filename}.32 ${filename}.64
+			done
+		else
+			exit 1
+		fi
+	else
+		exit 1
+	fi
+fi
+exit 0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110911/f15a1fe0/attachment.html>


More information about the macports-changes mailing list