# $Id$

PortSystem 1.0
PortGroup python 1.0

name			reinteract
version			0.5.10
python.default_version		27
categories		devel
license			BSD
platforms		darwin
maintainers		nomaintainer
description		a system for interactive experimentation with python
long_description	Reinteract is a system for interactive experimentation \
			with python. You enter Python code and expressions and \
			immediately see the results.

homepage		http://www.reinteract.org
master_sites		http://download.reinteract.org/sources
use_bzip2		yes

checksums		rmd160  2d86afbf5b7c054181c1eead01bf8f1116cd7a84 \
			sha256  d405f70863062ba52b9a075c7a50f465c221e1ded184c14fbecb7c8bf038854d

depends_build		port:pkgconfig
depends_lib-append		port:py${python.version}-pygtk

use_configure		yes
configure.python	${python.bin}
configure.pkg_config_path ${python.prefix}/lib/pkgconfig
configure.args-append	--exec-prefix=${python.prefix}

post-patch {
    reinplace "s|PYTHON_PREFIX='\${prefix}'|PYTHON_PREFIX=${python.prefix}|" \
		$worksrcpath/configure

}

build.cmd       make
build.target    all

destroot.cmd    make
destroot.destdir "DESTDIR=${destroot}"

variant quartz conflicts x11 description {Enable Quartz rendering} {
    build.target	build-local-app
    configure.args-append --with-appdir=${applications_dir}

    post-destroot {
	file delete "${destroot}${prefix}/share/applications/reinteract.desktop"
	file delete "${destroot}${prefix}/share/icons/hicolor/scalable/apps/reinteract.svg"
    }
}

variant x11 conflicts quartz description {Enable rendering in X11} {
    pre-configure {
	reinplace s/platform_osx=true/platform_osx=false/ ${worksrcpath}/configure
    }
    post-destroot {
	xinstall ${worksrcpath}/bin/reinteract ${destroot}${prefix}/bin/
    }
}

# junk below copied from gtk2

if {[variant_isset no_x11]} {
    default_variants    +quartz
}

if {![variant_isset quartz]} {
    default_variants    +x11
}

pre-fetch {
    if {![variant_isset quartz] && ![variant_isset x11]} {
        error "Either +x11 or +quartz is required"
    }
}