Skip to content
This repository
tree: 628bb7bc1d
Fetching contributors…

Cannot retrieve contributors at this time

file 99 lines (77 sloc) 2.493 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="4"

PYTHON_DEPEND="2:2.7"
PYTHON_MODNAME="sagenb"
PYTHON_USE_WITH_OPT="ssl"

inherit distutils eutils user

MY_PN="sagemath-sagenb"

DESCRIPTION="The Sage Notebook is a web-based graphical user interface for mathematical software"
HOMEPAGE="http://nb.sagemath.org"
SRC_URI="https://github.com/sagemath/sagenb/tarball/${PV} -> ${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE="+java server ssl"

RESTRICT="mirror"

CDEPEND="~dev-python/pexpect-2.0
>=dev-python/twisted-12.0
>=dev-python/twisted-mail-12.0
>=dev-python/twisted-web-12.0
!dev-python/twisted-web2
>=dev-python/jinja-2.5.5
>=dev-python/docutils-0.5
>=dev-python/flask-autoindex-0.4.1
>=dev-python/flask-openid-1.0.1
>=dev-python/flask-babel-0.8
dev-python/webassets"
DEPEND="${CDEPEND}
test? ( sci-mathematics/sage[testsuite] )"
RDEPEND="${CDEPEND}
sci-mathematics/sage
java? ( ~sci-chemistry/jmol-12.2.27
~sci-chemistry/jmol-applet-12.2.27 )"

# github release tag
TAG=dbabb90
S="${WORKDIR}/${MY_PN}-${TAG}"

pkg_setup() {
# Sage now will only works with python 2.7.*
python_set_active_version 2.7
python_pkg_setup
export DOT_SAGE="${S}"

# create user to run the server
if use server ; then
enewgroup sage
enewuser sage -1 /bin/bash /var/lib/sage sage
fi
}

src_prepare() {
# ship flask_version and not sage3d
epatch "${FILESDIR}"/${PN}-0.10.2-setup.py.patch

# find flask_version in the right place
sed -i "s:import base:import flask_version.base:" sagenb/notebook/run_notebook.py || die "failed to patch for flask_version path"

# remove sage3d
rm -rf sagenb/data/sage3d || die "failed to remove sage3d"

# find jmol
epatch "${FILESDIR}"/${PN}-0.9.1-base-jmol.patch
sed -i "s:jmol/appletweb/Jmol.js:jmol/Jmol.js:g" sagenb/data/sage/html/notebook/base.html

# fix SAGE_ROOT
epatch "${FILESDIR}"/${PN}-0.9.1-notebook.patch

mkdir conf.d || die "failed to create directory"
mkdir init.d || die "failed to create directory"

cp "${FILESDIR}"/${PN} init.d/${PN} || die "failed to copy file"
cp "${FILESDIR}"/${PN}.conf conf.d/${PN} || die "failed to copy file"

distutils_src_prepare
}

src_install() {
# install runscript+configuration file to run the notebook as a daemon
if use server ; then
doinitd init.d/${PN}
doconfd conf.d/${PN}
fi

distutils_src_install
}

src_test() {
PYTHONPATH="." default_src_test
}
Something went wrong with that request. Please try again.