# -*- 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
# $Id: Portfile 100445 2012-12-12 14:52:31Z g5pw@macports.org $

PortSystem          1.0
PortGroup           python 1.0
PortGroup           select 1.0

name                py-sympy
version             0.7.2
revision            0
categories-append   science math
license             BSD
platforms           darwin
supported_archs     noarch

maintainers         stromnov openmaintainer

description         Python module for symbolic mathematics.
long_description \
    SymPy is a Python library for symbolic mathematics. It aims to \
    become a full-featured computer algebra system (CAS) while keeping \
    the code as simple as possible in order to be comprehensible \
    and easily extensible. SymPy is written entirely in Python and does \
    not require any external libraries.

homepage            http://code.google.com/p/sympy/
master_sites        googlecode:sympy

checksums           rmd160  5daa92e94a63f582b7739c214925cfd1a09a01ac \
                    sha256  2304aebd298d8bd467273a32b90fd66a24ee61cbea7e892a9ddc759d50a087fc

distname            sympy-${version}

python.default_version  27
python.versions     25 26 27 32 33

if {$subport != $name} {
    if {[string range ${python.version} 0 end-1] == 3} {
	checksums           rmd160  3ad241a75d6175aa597b45c4d851b723eb077430 \
			    sha256  9b6d6c82b023a439565ea9493fc217cafaf4fe5b8d067537c7d4382500091ffc

	distname            sympy-${version}-py3.2
	worksrcdir          sympy-${version}
    }

    post-destroot {
        set gzip [findBinary gzip ${portutil::autoconf::gzip_path}]
        if {$subport == "py25-sympy"} {
            move ${destroot}${prefix}/share/man/man1/isympy.1 \
                 ${destroot}${prefix}/share/man/man1/isympy-${python.branch}.1
            system "$gzip -9vf ${destroot}${prefix}/share/man/man1/isympy-${python.branch}.1"
            file attributes ${destroot}${prefix}/share/man/man1/isympy-${python.branch}.1.gz \
                -permissions 00444
        } else {
            system "$gzip -9vf ${destroot}${python.prefix}/share/man/man1/isympy.1"
            file attributes ${destroot}${python.prefix}/share/man/man1/isympy.1.gz -permissions 00444
            ln -s ${python.prefix}/share/man/man1/isympy.1.gz \
                ${destroot}${prefix}/share/man/man1/isympy-${python.branch}.1.gz
        }
    }

    depends_build       port:gzip
    depends_run         port:py-sympy_select

    select.group        py-sympy
    select.file         ${filespath}/py${python.version}-sympy

    notes "
To make the Python ${python.branch} version of py-sympy the one that is run\
when you execute the commands without a version suffix, e.g. 'isympy', run:

port select --set ${select.group} [file tail ${select.file}]
"

}

livecheck.regex     "sympy-(\\d+(?:\\.\\d+)*)${extract.suffix}"
