# $Id: Portfile 53964 2009-07-17 11:25:36Z snc@macports.org $

PortSystem 1.0

name                    python_select
version                 0.2.1
categories              sysutils
platforms               darwin
maintainers             raimue
description             Switch the default python interpreter
long_description        python_select lets you switch the default python interpreter. \
                        python_select symlinks the standard python executables \
                        in the MacPorts prefix to the selected version.

homepage                http://svn.macports.org/repository/macports/contrib/select/
master_sites            ${homepage}
distname                select-${version}
checksums               sha1 9f2722940b566fa6ebd1c03298b8ddbdcbcc0554

configure.args          --mandir=${prefix}/share/man --name=python

# install all files
post-destroot {
    xinstall -m 755 -d ${destroot}${prefix}/etc/select/python
    xinstall -m 644 -W ${filespath} base none ${destroot}${prefix}/etc/select/python
}

platform darwin 7 {
    post-destroot {
        xinstall -m 644 -W ${filespath} python23-apple ${destroot}${prefix}/etc/select/python
    }

    post-activate {
        if {[exec ${prefix}/bin/${name} -s] == "none"} {
            system "${destroot}${prefix}/bin/${name} python23-apple"
        }
    }
}

platform darwin 8 {
    post-destroot {
        xinstall -m 644 -W ${filespath} python23-apple ${destroot}${prefix}/etc/select/python
    }

    post-activate {
        if {[exec ${prefix}/bin/${name} -s] == "none"} {
            system "${destroot}${prefix}/bin/${name} python23-apple"
        }
    }
}

platform darwin 9 {
    post-destroot {
        xinstall -m 644 -W ${filespath} python25-apple ${destroot}${prefix}/etc/select/python
    }

    post-activate {
        if {[exec ${prefix}/bin/${name} -s] == "none"} {
            system "${prefix}/bin/${name} python25-apple"
        }
    }
}

platform darwin 10 {
	post-destroot {
		xinstall -m 644 -W ${filespath} python26-apple ${destroot}${prefix}/etc/select/python
	}

	post-activate {
		if {[exec ${prefix}/bin/${name} -s] == "none"} {
			system "${prefix}/bin/${name} python26-apple"
		}
	}
}

livecheck.check    none

# Documentation for python ports:
#   Modify these two lines and add them into your destroot phase
#       xinstall -m 755 -d ${destroot}${prefix}/etc/select/python
#       xinstall -m 644 ${filespath}/python2x ${destroot}${prefix}/etc/select/python/

