Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

FL-50 Added app-admin/eselect-jython. Masked for testing

  • Loading branch information...
commit 83c3838737941ae23d0ea9fede5da598a3f86ce6 1 parent fbd24e3
Ryan Harris authored
View
15 app-admin/eselect-jython/eselect-jython-20130709.ebuild
@@ -0,0 +1,15 @@
+# Distributed under the terms of the GNU General Public License v2
+
+DESCRIPTION="Manages multiple Jython versions"
+HOMEPAGE="http://www.funtoo.org"
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~*"
+IUSE=""
+
+RDEPEND=">=app-admin/eselect-1.3.5"
+
+src_install() {
+ insinto /usr/share/eselect/modules
+ newins "${FILESDIR}/jython.eselect-${PVR}" jython.eselect || die
+}
View
140 app-admin/eselect-jython/files/jython.eselect-20130709
@@ -0,0 +1,140 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Copyright 2013 Ryan P. Harris
+# Distributed under the terms of the GNU General Public License v2
+# $Id: $
+
+
+DESCRIPTION="Manage Jython symlinks"
+MAINTAINER="rh1@funtoo.org"
+VERSION="1.0"
+
+INTERPRETER_PATH="${EROOT%/}/usr/bin/"
+
+
+### HELPER FUNCTIONS ###
+
+# PUBLIC
+# Converts number from list to jython version
+# $1 = number to convert
+convert_list_number() {
+ local number="${1}"
+ local interpreters=( $(find_targets) )
+ if [[ "${number}" < 0 || "${number}" == 0 || "${number}" > "${#interpreters[@]}" ]] ; then
+ die -q "Invalid number. No matching entry."
+ fi
+ number=$(( ${1} - 1 ))
+ echo "${interpreters[number]}"
+}
+
+
+# PUBLIC
+# Finds jython targets.
+find_targets() {
+ local interpreters="jython?.?"
+
+ for interpreter in "${INTERPRETER_PATH}"${interpreters}; do
+ if [[ -f "${interpreter}" ]]; then
+ echo ${interpreter#${INTERPRETER_PATH}}
+ fi
+ done
+}
+
+
+### LIST ACTION ###
+
+# PUBLIC
+# Descritpion of list action
+describe_list() {
+ echo "Lists installed Jython versions"
+}
+
+
+# PUBLIC
+# Called by eselect when passed list as an action
+do_list() {
+ local interpreters=( $(find_targets) )
+ write_list_start "Available Jython targets:"
+ for (( i = 0; i < ${#interpreters[@]}; i++ )) ; do
+ local number=$(( ${i} + 1 ))
+ if [[ "${interpreters[${i}]}" == "$(do_show)" ]] ; then
+ write_numbered_list_entry "${number}" "${interpreters[${i}]} *"
+ else
+ write_numbered_list_entry "${number}" "${interpreters[${i}]}"
+ fi
+ done
+}
+
+
+### SHOW ACTION ###
+
+# PUBLIC
+# Description of show action.
+describe_show() {
+ echo "Show main active Jython version"
+}
+
+
+# PUBLIC
+# Called by eselect when passed show as an action.
+do_show() {
+ echo "$(basename $(readlink -e ${INTERPRETER_PATH}jython))"
+}
+
+
+### SET ACTION ###
+
+# PUBLIC
+# Removes the old jython symlink and sets the new one.
+# $1 = Target version for new symlink. (Ex: jython2.5)
+set_jython_symlink() {
+ local target="${1}"
+ cd "${INTERPRETER_PATH}"
+
+ if [[ ! -e "${target}" ]] ; then
+ die -q "Target ${target} does not exist"
+ fi
+
+ if [[ -e jython ]] ; then
+ if [[ -h jython ]] ; then
+ rm jython
+ else
+ die -q "'${INTERPRETER_PATH}jython' is not a symlink."
+ fi
+ fi
+ ln -sf "${target}" jython
+}
+
+
+# PUBLIC
+# Description of set action
+describe_set() {
+ echo "Set the main active Jython version"
+}
+
+
+# PUBLIC
+# Desciption of set parameters
+describe_set_parameters() {
+ echo "<target>"
+}
+
+
+# PUBLIC
+# Called by eselect when passed set as an action
+do_set() {
+
+ local target="${1}"
+ if [[ ${#} != 1 ]] ; then
+ die -q "'eselect jython set' requires 1 argument"
+ fi
+
+ if is_number "${target}" ; then
+ target="$(convert_list_number ${target})"
+ if [[ $? != 0 ]] ; then
+ exit 1
+ fi
+ fi
+
+ set_jython_symlink "${target}"
+}
+
View
7 dev-java/jython/jython-2.1-r12.ebuild
@@ -18,7 +18,8 @@ IUSE="readline source doc"
CDEPEND="=dev-java/jakarta-oro-2.0*
readline? ( >=dev-java/libreadline-java-0.8.0 )"
# servlet? ( >=www-servers/tomcat-5.0 )
-RDEPEND=">=virtual/jre-1.4
+RDEPEND=">=app-admin/eselect-jython-20130709
+ >=virtual/jre-1.4
${CDEPEND}"
DEPEND=">=virtual/jdk-1.4
source? ( app-arch/zip )
@@ -94,6 +95,10 @@ src_install() {
}
pkg_postinst() {
+ if [[ ! -e /usr/bin/jython ]] ; then
+ cd /usr/bin && ln -s ${PN}${SLOT} jython
+ fi
+
if use readline; then
elog "To use readline you need to add the following to your registry"
elog
View
4 dev-java/jython/jython-2.2.1-r3.ebuild
@@ -122,6 +122,10 @@ src_install() {
}
pkg_postinst() {
+ if [[ ! -e /usr/bin/jython ]] ; then
+ cd /usr/bin && ln -s ${PN}${SLOT} jython
+ fi
+
if use readline; then
elog "To use readline you need to add the following to your registry"
elog
View
5 profiles/package.mask/funtoo-staging
@@ -2,6 +2,11 @@
# newest on top
# Ryan Harris (09 Jul 2013)
+# FL-50 app-admin/eselect-jython added.
+# Masked for testing
+app-admin/eselect-jython
+
+# Ryan Harris (09 Jul 2013)
# Added slot support to jython-2.1 and 2.2 for FL-50
# Masked for testing
=dev-java/jython-2.1-r12
Please sign in to comment.
Something went wrong with that request. Please try again.