Ticket #38438: patch-numpy-whitespace.diff

File patch-numpy-whitespace.diff, 13.4 KB (added by seanfarley (Sean Farley), 11 years ago)

whitespace change

  • dports/python/py-numpy/Portfile

    # HG changeset patch
    # User Sean Farley <sean.michael.farley@gmail.com>
    # Date 1364091274 18000
    #      Sat Mar 23 21:14:34 2013 -0500
    # Node ID 58f2aa0d00ae6eb03f33a59e8dde04eef1b8570b
    # Parent  83d9e4905410a5f2e2fa6cec432ef999c81fc14b
    py-numpy: whitespace and curly brace cleanup
    
    diff --git a/dports/python/py-numpy/Portfile b/dports/python/py-numpy/Portfile
    a b  
    2020checksums               rmd160  9643c04a2e8fbb99cdb047281eedbbfb99423553 \
    2121                        sha256  0992d326147d0ed83bd059519897e7a8ee52dea5ee66bbe04c0ea1c502cd8618
    2222
    2323python.versions         24 25 26 27 31 32 33
    2424
    25 if {${subport} != ${name}} {
     25if {$subport != $name} {
     26    patchfiles              patch-f2py_setup.py.diff \
     27                            patch-fcompiler_g95.diff
    2628
    27 patchfiles              patch-f2py_setup.py.diff \
    28                         patch-fcompiler_g95.diff
     29    if {${python.version} == 33} {
     30        patchfiles-append   patch-python33-unicode.diff \
     31                            patch-python33-mtrand.diff \
     32                            patch-python33-shape.diff \
     33                            patch-python33-methods.diff
     34    }
    2935
    30 if {${python.version} == 33} {
    31     patchfiles-append   patch-python33-unicode.diff \
    32                         patch-python33-mtrand.diff \
    33                         patch-python33-shape.diff \
    34                         patch-python33-methods.diff
     36    depends_lib-append      port:fftw-3 \
     37                            port:py${python.version}-nose
     38
     39    if {[variant_isset universal]} {
     40        build.env-append        ARCHFLAGS="${configure.universal_ldflags}"
     41        destroot.env-append     ARCHFLAGS="${configure.universal_ldflags}"
     42    } else {
     43        pre-build {
     44            build.env-append    ARCHFLAGS="${configure.cc_archflags}"
     45        }
     46        pre-destroot {
     47            destroot.env-append ARCHFLAGS="${configure.cc_archflags}"
     48        }
     49    }
     50
     51    variant atlas description {Use the MacPorts' ATLAS libraries \
     52                               instead of Apple's Accelerate framework} {
     53        build.env-append        ATLAS=${prefix}/lib \
     54                                LAPACK=${prefix}/lib \
     55                                BLAS=${prefix}/lib
     56        destroot.env-append     ATLAS=${prefix}/lib \
     57                                LAPACK=${prefix}/lib \
     58                                BLAS=${prefix}/lib
     59        depends_lib-append      port:atlas
     60
     61        if {[variant_isset universal]} {
     62            python.set_compiler no
     63        }
     64    }
     65
     66    # when using ATLAS (whether by default or specified by the user via
     67    # the +atlas variant) ...
     68    set gcc_version ""
     69    if {[variant_isset atlas]} {
     70
     71        # see if the user has set -gcc4X to disable using MacPorts'
     72        # compiler; if not, either use what the user set (as +gcc4X) or
     73        # default to gcc47.
     74
     75        variant gcc43 conflicts gcc44 gcc45 gcc46 gcc47 \
     76        description {Use the gcc43 compiler (enables fortran linking)} {
     77            configure.compiler      macports-gcc-4.3
     78        }
     79
     80        variant gcc44 conflicts gcc43 gcc45 gcc46 gcc47 \
     81        description {Use the gcc44 compiler (enables fortran linking)} {
     82            configure.compiler      macports-gcc-4.4
     83        }
     84
     85        variant gcc45 conflicts gcc43 gcc44 gcc46 gcc47 \
     86        description {Use the gcc45 compiler (enables fortran linking)} {
     87            configure.compiler      macports-gcc-4.5
     88        }
     89
     90        variant gcc46 conflicts gcc43 gcc44 gcc45 gcc47 \
     91        description {Use the gcc46 compiler (enables fortran linking)} {
     92            configure.compiler      macports-gcc-4.6
     93        }
     94
     95        variant gcc47 conflicts gcc43 gcc44 gcc45 gcc46 \
     96        description {Use the gcc47 compiler (enables fortran linking)} {
     97            configure.compiler      macports-gcc-4.7
     98        }
     99
     100        if {![variant_isset gcc43] && ![variant_isset gcc44] && ![variant_isset gcc46] && ![variant_isset gcc47]} {
     101            default_variants    +gcc45
     102        }
     103
     104        if {[variant_isset gcc43]} {
     105            set gcc_version "4.3"
     106        } elseif {[variant_isset gcc44]} {
     107            set gcc_version "4.4"
     108        } elseif {[variant_isset gcc45]} {
     109            set gcc_version "4.5"
     110        } elseif {[variant_isset gcc46]} {
     111            set gcc_version "4.6"
     112        } elseif {[variant_isset gcc47]} {
     113            set gcc_version "4.7"
     114        }
     115
     116        # when using non-Apple GCC for universal install, it can
     117        # create binaries only for the native OS architecture, at
     118        # either 32 or 64 bits.  Restrict the supported archs
     119        # accordingly.
     120        if {${os.arch} == "i386"} {
     121            supported_archs         i386 x86_64
     122        } elseif {${os.arch} == "powerpc"} {
     123            supported_archs         ppc ppc64
     124        }
     125
     126        # include all the correct GCC4X port
     127        depends_lib-append      port:gcc[join [split ${gcc_version} "."] ""]
     128
     129        # force LDFLAGS for correct linking of the linalg module
     130        # for non-Apple GCC compilers
     131        patchfiles-append       patch-numpy_linalg_setup.py.diff
     132
     133        if {${gcc_version} == ""} {
     134            # user specified -gcc4X but +atlas (either as default or
     135            # explicitly); do not allow since it might lead to
     136            # undetermined runtime execution.
     137            return -code error \
     138"\n\nWhen using the +atlas variant (either as the default or setting
     139explicitly), one of the +gcc4X variants must be selected.\n"
     140        }
     141    } else {
     142        variant universal {
     143            patchfiles-append       patch-setup.py.diff
     144        }
     145    }
     146
     147    post-patch {
     148        reinplace "s|@@MPORTS_PYTHON@@|${python.bin}|" \
     149            ${worksrcpath}/numpy/f2py/setup.py
     150
     151        if {[variant_isset universal] && [variant_isset atlas]} {
     152            # Prepare wrappers
     153            file copy -force ${filespath}/wrapper-template \
     154                ${worksrcpath}/c-wrapper
     155            file copy -force ${filespath}/wrapper-template \
     156                ${worksrcpath}/f-wrapper
     157            file copy -force ${filespath}/wrapper-template \
     158                ${worksrcpath}/cxx-wrapper
     159
     160            reinplace   "s|@@@|${configure.cc}|" ${worksrcpath}/c-wrapper
     161            reinplace   "s|---|\\\\.c|" ${worksrcpath}/c-wrapper
     162            reinplace   "s|&&&|${prefix}|" ${worksrcpath}/c-wrapper
     163
     164            reinplace   "s|@@@|${configure.cxx}|" ${worksrcpath}/cxx-wrapper
     165            reinplace   "s#---#(\\\\.C|\\\\.cpp|\\\\.cc)#" \
     166                ${worksrcpath}/cxx-wrapper
     167            reinplace   "s|&&&|${prefix}|" ${worksrcpath}/cxx-wrapper
     168
     169            reinplace   "s|@@@|${configure.f90}|" ${worksrcpath}/f-wrapper
     170            reinplace   "s|---|\\\\.f|" ${worksrcpath}/f-wrapper
     171            reinplace   "s|&&&|${prefix}|" ${worksrcpath}/f-wrapper
     172
     173            build.env-append    CC="${worksrcpath}/c-wrapper" \
     174                                CXX="${worksrcpath}/cxx-wrapper" \
     175                                F77="${worksrcpath}/f-wrapper" \
     176                                F90="${worksrcpath}/f-wrapper"
     177
     178            destroot.env-append CC="${worksrcpath}/c-wrapper" \
     179                                CXX="${worksrcpath}/cxx-wrapper" \
     180                                F77="${worksrcpath}/f-wrapper" \
     181                                F90="${worksrcpath}/f-wrapper"
     182        }
     183    }
     184
     185    livecheck.type        none
     186} else {
     187    livecheck.regex       archive/[join ${github.tag_prefix} ""](\[\\d+(?:\\.\\d+)*"\]+)${extract.suffix}"
    35188}
    36189
    37 depends_lib-append      port:fftw-3 \
    38                         port:py${python.version}-nose
    39 
    40 if {[variant_isset universal]} {
    41     build.env-append    ARCHFLAGS="${configure.universal_ldflags}"
    42     destroot.env-append ARCHFLAGS="${configure.universal_ldflags}"
    43 } else {
    44     pre-build {
    45         build.env-append    ARCHFLAGS="${configure.cc_archflags}"
    46     }
    47     pre-destroot {
    48         destroot.env-append ARCHFLAGS="${configure.cc_archflags}"
    49     }
    50 }
    51 
    52 variant atlas \
    53 description {Use the MacPorts' ATLAS libraries \
    54              instead of Apple's Accelerate framework} {
    55     build.env-append    ATLAS=${prefix}/lib \
    56                         LAPACK=${prefix}/lib \
    57                         BLAS=${prefix}/lib
    58     destroot.env-append ATLAS=${prefix}/lib \
    59                         LAPACK=${prefix}/lib \
    60                         BLAS=${prefix}/lib
    61     depends_lib-append  port:atlas
    62 
    63     if {[variant_isset universal]} {
    64         python.set_compiler no
    65     }
    66 }
    67 
    68 # when using ATLAS (whether by default or specified by the user via
    69 # the +atlas variant) ...
    70 set gcc_version ""
    71 if {[variant_isset atlas]} {
    72 
    73     # see if the user has set -gcc4X to disable using MacPorts'
    74     # compiler; if not, either use what the user set (as +gcc4X) or
    75     # default to gcc45.
    76 
    77     variant gcc43 conflicts gcc44 gcc45 gcc46 gcc47 \
    78     description {Use the gcc43 compiler (enables fortran linking)} {
    79         configure.compiler  macports-gcc-4.3
    80     }
    81 
    82     variant gcc44 conflicts gcc43 gcc45 gcc46 gcc47 \
    83     description {Use the gcc44 compiler (enables fortran linking)} {
    84         configure.compiler  macports-gcc-4.4
    85     }
    86 
    87     variant gcc45 conflicts gcc43 gcc44 gcc46 gcc47 \
    88     description {Use the gcc45 compiler (enables fortran linking)} {
    89         configure.compiler  macports-gcc-4.5
    90     }
    91 
    92     variant gcc46 conflicts gcc43 gcc44 gcc45 gcc47 \
    93     description {Use the gcc46 compiler (enables fortran linking)} {
    94         configure.compiler  macports-gcc-4.6
    95     }
    96 
    97     variant gcc47 conflicts gcc43 gcc44 gcc45 gcc46 \
    98     description {Use the gcc47 compiler (enables fortran linking)} {
    99         configure.compiler  macports-gcc-4.7
    100     }
    101 
    102 
    103     if {![variant_isset gcc43] && ![variant_isset gcc44] && ![variant_isset gcc46] && ![variant_isset gcc47]} {
    104         default_variants +gcc45
    105     }
    106     if {[variant_isset gcc43]} {
    107         set gcc_version "4.3"
    108     } elseif {[variant_isset gcc44]} {
    109         set gcc_version "4.4"
    110     } elseif {[variant_isset gcc45]} {
    111         set gcc_version "4.5"
    112     } elseif {[variant_isset gcc46]} {
    113         set gcc_version "4.6"
    114     } elseif {[variant_isset gcc47]} {
    115         set gcc_version "4.7"
    116     }
    117 
    118 
    119     # when using non-Apple GCC for universal install, it can
    120     # create binaries only for the native OS architecture, at
    121     # either 32 or 64 bits.  Restrict the supported archs
    122     # accordingly.
    123     if {${os.arch} == "i386"} {
    124         supported_archs i386 x86_64
    125     } elseif {${os.arch} == "powerpc"} {
    126         supported_archs ppc ppc64
    127     }
    128 
    129     # include all the correct GCC4X port
    130     depends_lib-append port:gcc[join [split ${gcc_version} "."] ""]
    131 
    132     # force LDFLAGS for correct linking of the linalg module
    133     # for non-Apple GCC compilers
    134     patchfiles-append  patch-numpy_linalg_setup.py.diff
    135 
    136     if {${gcc_version} == ""} {
    137         # user specified -gcc4X but +atlas (either as default or
    138         # explicitly); do not allow since it might lead to
    139         # undetermined runtime execution.
    140         return -code error \
    141 "\n\nWhen using the +atlas variant (either as the default or setting
    142 explicitly), one of the +gcc4X variants must be selected.\n"
    143     }
    144 } else {
    145     variant universal {
    146         patchfiles-append   patch-setup.py.diff
    147     }
    148 }
    149 
    150 post-patch {
    151     reinplace "s|@@MPORTS_PYTHON@@|${python.bin}|" \
    152         ${worksrcpath}/numpy/f2py/setup.py
    153 
    154     if {[variant_isset universal] && [variant_isset atlas]} {
    155         # Prepare wrappers
    156         file copy -force ${filespath}/wrapper-template \
    157             ${worksrcpath}/c-wrapper
    158         file copy -force ${filespath}/wrapper-template \
    159             ${worksrcpath}/f-wrapper
    160         file copy -force ${filespath}/wrapper-template \
    161             ${worksrcpath}/cxx-wrapper
    162 
    163         reinplace   "s|@@@|${configure.cc}|" ${worksrcpath}/c-wrapper
    164         reinplace   "s|---|\\\\.c|" ${worksrcpath}/c-wrapper
    165         reinplace   "s|&&&|${prefix}|" ${worksrcpath}/c-wrapper
    166 
    167         reinplace   "s|@@@|${configure.cxx}|" ${worksrcpath}/cxx-wrapper
    168         reinplace   "s#---#(\\\\.C|\\\\.cpp|\\\\.cc)#" \
    169             ${worksrcpath}/cxx-wrapper
    170         reinplace   "s|&&&|${prefix}|" ${worksrcpath}/cxx-wrapper
    171 
    172         reinplace   "s|@@@|${configure.f90}|" ${worksrcpath}/f-wrapper
    173         reinplace   "s|---|\\\\.f|" ${worksrcpath}/f-wrapper
    174         reinplace   "s|&&&|${prefix}|" ${worksrcpath}/f-wrapper
    175 
    176         build.env-append    CC="${worksrcpath}/c-wrapper" \
    177                             CXX="${worksrcpath}/cxx-wrapper" \
    178                             F77="${worksrcpath}/f-wrapper" \
    179                             F90="${worksrcpath}/f-wrapper"
    180 
    181         destroot.env-append CC="${worksrcpath}/c-wrapper" \
    182                             CXX="${worksrcpath}/cxx-wrapper" \
    183                             F77="${worksrcpath}/f-wrapper" \
    184                             F90="${worksrcpath}/f-wrapper"
    185     }
    186 }
    187 
    188 }
    189 
    190 if {${name} == ${subport}} {
    191     livecheck.regex       archive/[join ${github.tag_prefix} ""](\[\\d+(?:\\.\\d+)*"\]+)${extract.suffix}"
    192 } else {
    193     livecheck.type        none
    194 }
    195 
    196 subport py32-numpy {
    197     pre-activate {
    198         set regref [registry_open $subport $version $revision $portvariants ""]
    199         foreach f [registry_prop_retr $regref imagefiles] {
    200             if {[file extension $f] == ".pyc" && [file exists $f] && [registry_file_registered $f] == "0"} {
    201                 file delete -force $f
    202             }
    203         }
    204     }
    205 }