dev-java/jython: Remove vulnerable versions. Fixes security bug 552452.

Package-Manager: portage-2.2.26
Signed-off-by: Patrice Clement <monsieurp@gentoo.org>
This commit is contained in:
Patrice Clement
2016-02-07 19:48:09 +00:00
parent 9144c6e6ca
commit 0096ee2129
12 changed files with 0 additions and 798 deletions

View File

@@ -1,4 +1 @@
DIST Python-2.2.3.tgz 6709556 SHA256 a8f92e6b89d47359fff0d1fbfe47f104afc77fd1cd5143e7332758b7bc100188 SHA512 2e2c881f8819ed3d91b3e98e7087b23ced9715c80eb9e5fe4144cca5b82220e035d0f50ac4a098b3bbdca3c588f70b8021f68a5d52f653c013470579342943e4 WHIRLPOOL dbef6f9f0545f4f4ddf6e4535b67bb936a2ef596f17a1ff6acca89755729420588d845bc291eed0d19b433b3eff017166c7d68a1a352a5612b00da2f8f0c20d7
DIST jython-2.7.0-sources.jar 15371691 SHA256 2b534595d4a08059ebb71b881c58ee830499bb6e9daba7c828a7f1f6c8943f7a SHA512 7583810245d694fd1d99a57ad504fcefdfbc1183def2cbb93ae3660f341104205c73041d846bdcf2b564b3cf4b770b481703c1dcdb1458396812c92d30ee9fa6 WHIRLPOOL e0dbd289c522b41ef2d3f54b01a2f6d44de8755e2eeb7863c8b807d1b179839f20d925e102db324cf85cd82503cd03106b5287ffa7a322a3902d6f24e9cd2a41
DIST jython-installer-2.5.3.jar 18487200 SHA256 05405966cdfa57abc8e705dd6aab92b8240097ce709fb916c8a0dbcaa491f99e SHA512 92d00cc8d885806749c67d1dc820e7b402c807b9a40277073fc3ea1f3dd10e1e506dc241a342874db8109120e8f0031a8dc7a4db6a88dfdc6c89906eeb9d454d WHIRLPOOL e8e3adf741a35b5e4de6c67b8805582cabc8590afac28c2e4ae3b61c4bd38d41904d7d1e4a23de21e7870d628e33a52f540fc89780a4724403b0bd92e1159768
DIST jython_installer-2.2.1.jar 4663097 SHA256 586858aa16a8b269eaaec59f5b64031ec504d33da35cba98ebac811b0e838e68 SHA512 d33262dec95dbecfc007a738ed8d8cd4844c215e451b7ab126940f1157079aa846a104f3587ad84c4a009249632e3aaa3c83479ee8f47c30c4b4833bcdd582b3 WHIRLPOOL bae264f67547a975bf648b3de0cc2becb5d51e14b2ca1a977f7c3d45ec96bd3fd4fd99b0ff6912fb38d54d57656225c51c4b8a474c6ca8fe7fc16e12ab4bbec8

View File

@@ -1,11 +0,0 @@
--- jython-2.1/Tools/jythonc/SimpleCompiler.py.orig 2006-09-08 13:21:29.000000000 -0600
+++ jython-2.1/Tools/jythonc/SimpleCompiler.py 2006-09-08 13:22:15.000000000 -0600
@@ -577,7 +577,7 @@
args.append(message.asAny())
return jast.If(self.frame.getglobal("__debug__").nonzero(),
- jast.InvokeStatic("Py", "assert", args))
+ jast.InvokeStatic("Py", "assert_", args))
def return_stmt(self, value=None):
if value is None:

View File

@@ -1,50 +0,0 @@
--- jython-2.1/com/ziclix/python/sql/pipe/Pipe.java.orig 2006-07-29 21:31:34.000000000 +0200
+++ jython-2.1/com/ziclix/python/sql/pipe/Pipe.java 2006-07-29 21:31:41.000000000 +0200
@@ -93,7 +93,7 @@
new Integer(sinkRunner.getCount()) };
String msg = zxJDBC.getString("inconsistentRowCount", counts);
- Py.assert(Py.Zero, Py.newString(msg));
+ Py.assert_(Py.Zero, Py.newString(msg));
}
return Py.newInteger(sinkRunner.getCount());
--- jython-2.1/org/python/compiler/CodeCompiler.java.orig 2006-07-29 21:28:47.000000000 +0200
+++ jython-2.1/org/python/compiler/CodeCompiler.java 2006-07-29 21:30:13.000000000 +0200
@@ -817,14 +817,14 @@
node.getChild(1).visit(this);
if (mrefs.assert2 == 0) {
mrefs.assert2 = code.pool.Methodref(
- "org/python/core/Py", "assert",
+ "org/python/core/Py", "assert_",
"(" + $pyObj + $pyObj + ")V");
}
code.invokestatic(mrefs.assert2);
} else {
if (mrefs.assert1 == 0) {
mrefs.assert1 = code.pool.Methodref(
- "org/python/core/Py", "assert",
+ "org/python/core/Py", "assert_",
"(" + $pyObj + ")V");
}
code.invokestatic(mrefs.assert1);
--- jython-2.1/org/python/core/Py.java.orig 2006-07-29 21:29:19.000000000 +0200
+++ jython-2.1/org/python/core/Py.java 2006-07-29 21:30:40.000000000 +0200
@@ -986,14 +986,14 @@
/* Equivalent to Python's assert statement */
- public static void assert(PyObject test, PyObject message) {
+ public static void assert_(PyObject test, PyObject message) {
if (!test.__nonzero__()) {
throw new PyException(Py.AssertionError, message);
}
}
- public static void assert(PyObject test) {
- assert(test, Py.None);
+ public static void assert_(PyObject test) {
+ assert_(test, Py.None);
}
/* Helpers to implement finally clauses */

View File

@@ -1,76 +0,0 @@
--- build.xml.org 2008-02-26 22:35:07.000000000 +1300
+++ build.xml 2008-02-26 22:35:48.000000000 +1300
@@ -373,21 +373,13 @@
<!-- create checkout directory if necessary -->
<target name="prepare-checkout" if="do.checkout">
- <mkdir dir="${svn.checkout.dir}" />
+ <echo message="Removed by patch." />
</target>
<!-- checkout if so defined -->
<target name="checkout" depends="prepare" if="do.checkout">
- <svn javahl="${javahl.dir}" >
- <checkout url="https://jython.svn.sourceforge.net/svnroot/jython/${svn.main.dir}/jython" revision="${svn.revision}" destPath="${svn.checkout.dir}/jython" />
- <checkout url="https://jython.svn.sourceforge.net/svnroot/jython/${svn.main.dir}/installer" revision="${svn.revision}" destPath="${svn.checkout.dir}/installer" />
- </svn>
-
- <!-- checkout cpython license from the correct python maintenance branch -->
- <svn javahl="${javahl.dir}" >
- <checkout url="http://svn.python.org/projects/python/branches/release22-maint/" destPath="${svn.checkout.dir}/python" recurse="false" />
- </svn>
+ <echo message="removed by patch" />
</target>
@@ -551,28 +543,13 @@
<!-- build the .html files using the ht2html tool -->
- <target name="doc" depends="compile" if="full-build">
- <fail unless="ht2html.dir" message="ht2html.dir is not set" />
- <copy todir="${dist.dir}/Doc" preservelastmodified="true">
- <fileset dir="Doc" includes="*.ht, **/*.gif" />
- </copy>
- <!-- Create .html files in Doc -->
- <apply executable="${python.exe}" dir="Doc">
- <env key="PYTHONPATH" path="${jython.base.dir}/Misc/htgen" />
- <arg line="${ht2html.dir}/ht2html.py" />
- <arg line="-s JyLocalGenerator" />
- <fileset dir="${dist.dir}/Doc">
- <include name="*.ht" />
- </fileset>
- </apply>
- <delete>
- <fileset dir="${dist.dir}/Doc" includes="*.ht" />
- </delete>
+ <target name="doc" depends="compile">
+ <echo message="Functionality removed by gentoo patch" />
</target>
<!-- javadoc -->
- <target name="javadoc" depends="compile" if="full-build">
+ <target name="javadoc" depends="compile">
<javadoc sourcepath="${source.dir}"
destdir="${apidoc.dir}"
source="${jdk.source.version}"
@@ -588,7 +565,7 @@
<!-- copy for full distribution -->
- <target name="copy-full" if="full-build">
+ <target name="copy-full">
<!-- Misc files -->
<echo>copy misc files from ${jython.base.dir}</echo>
<copy todir="${dist.dir}" preservelastmodified="true">
@@ -599,7 +576,7 @@
<!-- copy the CPython license -->
<echo>copy CPython LICENSE from ${svn.checkout.dir}/python</echo>
- <copy file="${svn.checkout.dir}/python/LICENSE" tofile="${dist.dir}/LICENSE_CPython.txt" preservelastmodified="true" />
+ <copy file="${python.lib}/../LICENSE" tofile="${dist.dir}/LICENSE_CPython.txt" preservelastmodified="true" />
<!-- sources: todir has to correspond with installer/**/JarInstaller.java -->
<echo>copy sources from ${jython.base.dir}</echo>

View File

@@ -1,92 +0,0 @@
--- build.xml.orig 2012-09-27 16:13:40.750930136 +0200
+++ build.xml 2012-09-27 16:16:31.725093475 +0200
@@ -373,21 +373,13 @@
<!-- create checkout directory if necessary -->
<target name="prepare-checkout" if="do.checkout">
- <mkdir dir="${svn.checkout.dir}" />
+ <echo message="Removed by patch." />
</target>
<!-- checkout if so defined -->
<target name="checkout" depends="prepare" if="do.checkout">
- <svn javahl="${javahl.dir}" >
- <checkout url="https://jython.svn.sourceforge.net/svnroot/jython/${svn.main.dir}/jython" revision="${svn.revision}" destPath="${svn.checkout.dir}/jython" />
- <checkout url="https://jython.svn.sourceforge.net/svnroot/jython/${svn.main.dir}/installer" revision="${svn.revision}" destPath="${svn.checkout.dir}/installer" />
- </svn>
-
- <!-- checkout cpython license from the correct python maintenance branch -->
- <svn javahl="${javahl.dir}" >
- <checkout url="http://svn.python.org/projects/python/branches/release22-maint/" destPath="${svn.checkout.dir}/python" recurse="false" />
- </svn>
+ <echo message="removed by patch" />
</target>
@@ -488,6 +480,7 @@
/>
<!-- java files used by tests -->
+<!--
<javac srcdir="${jython.base.dir}/Lib/test/"
includes="javatests/**"
destdir="${output.dir}/"
@@ -498,6 +491,7 @@
deprecation="${deprecation}"
nowarn="${nowarn}"
/>
+-->
<copy file="${source.dir}/org/python/modules/ucnhash.dat"
todir="${output.dir}/org/python/modules"
@@ -551,28 +545,13 @@
<!-- build the .html files using the ht2html tool -->
- <target name="doc" depends="compile" if="full-build">
- <fail unless="ht2html.dir" message="ht2html.dir is not set" />
- <copy todir="${dist.dir}/Doc" preservelastmodified="true">
- <fileset dir="Doc" includes="*.ht, **/*.gif" />
- </copy>
- <!-- Create .html files in Doc -->
- <apply executable="${python.exe}" dir="Doc">
- <env key="PYTHONPATH" path="${jython.base.dir}/Misc/htgen" />
- <arg line="${ht2html.dir}/ht2html.py" />
- <arg line="-s JyLocalGenerator" />
- <fileset dir="${dist.dir}/Doc">
- <include name="*.ht" />
- </fileset>
- </apply>
- <delete>
- <fileset dir="${dist.dir}/Doc" includes="*.ht" />
- </delete>
+ <target name="doc" depends="compile">
+ <echo message="Functionality removed by gentoo patch" />
</target>
<!-- javadoc -->
- <target name="javadoc" depends="compile" if="full-build">
+ <target name="javadoc" depends="compile">
<javadoc sourcepath="${source.dir}"
destdir="${apidoc.dir}"
source="${jdk.source.version}"
@@ -588,7 +567,7 @@
<!-- copy for full distribution -->
- <target name="copy-full" if="full-build">
+ <target name="copy-full">
<!-- Misc files -->
<echo>copy misc files from ${jython.base.dir}</echo>
<copy todir="${dist.dir}" preservelastmodified="true">
@@ -599,7 +578,7 @@
<!-- copy the CPython license -->
<echo>copy CPython LICENSE from ${svn.checkout.dir}/python</echo>
- <copy file="${svn.checkout.dir}/python/LICENSE" tofile="${dist.dir}/LICENSE_CPython.txt" preservelastmodified="true" />
+ <copy file="${python.lib}/../LICENSE" tofile="${dist.dir}/LICENSE_CPython.txt" preservelastmodified="true" />
<!-- sources: todir has to correspond with installer/**/JarInstaller.java -->
<echo>copy sources from ${jython.base.dir}</echo>

View File

@@ -1,27 +0,0 @@
--- build.xml.orig 2012-07-13 14:06:40.965992853 +0200
+++ build.xml 2012-07-13 14:07:29.595035840 +0200
@@ -512,6 +512,7 @@
</javac>
<!-- java files used by tests -->
+<!--
<javac srcdir="${test.source.dir}"
destdir="${compile.dir}"
target="${jdk.target.version}"
@@ -535,6 +536,7 @@
<copy file="${source.dir}/org/python/modules/ucnhash.dat"
todir="${compile.dir}/org/python/modules"
preservelastmodified="true" />
+-->
<copy todir="${compile.dir}" preservelastmodified="true">
<fileset dir="${source.dir}">
@@ -758,7 +762,7 @@
<jycompile srcdir="${dist.dir}/Lib" destdir="${dist.dir}/Lib" excludes="test/**"/>
</target>
- <target name="copy-lib" depends="init, copy-javalib, copy-cpythonlib">
+ <target name="copy-lib" depends="init">
<!-- XXX untested and most likely broken in 2.5
<copy todir="${dist.dir}" preservelastmodified="true">
<fileset dir="${jython.base.dir}" includes="Tools/**/*.py" />

View File

@@ -1,85 +0,0 @@
--- Lib/distutils/tests/test_build_py.py
+++ Lib/distutils/tests/test_build_py.py
@@ -92,6 +92,25 @@
os.chdir(cwd)
sys.stdout = sys.__stdout__
+ def test_dont_write_bytecode(self):
+ # makes sure byte_compile is not used
+ pkg_dir, dist = self.create_dist()
+ cmd = build_py(dist)
+ cmd.compile = 1
+ cmd.optimize = 1
+
+ old_dont_write_bytecode = os.environ.get("PYTHONDONTWRITEBYTECODE")
+ os.environ["PYTHONDONTWRITEBYTECODE"] = "1"
+ try:
+ cmd.byte_compile([])
+ finally:
+ if old_dont_write_bytecode is None:
+ del os.environ["PYTHONDONTWRITEBYTECODE"]
+ else:
+ os.environ["PYTHONDONTWRITEBYTECODE"] = old_dont_write_bytecode
+
+ self.assertTrue('byte-compiling is disabled' in self.logs[0][1])
+
def test_suite():
return unittest.makeSuite(BuildPyTestCase)
--- Lib/distutils/util.py
+++ Lib/distutils/util.py
@@ -11,6 +11,7 @@
from distutils.dep_util import newer
from distutils.spawn import spawn
from distutils import log
+from distutils.errors import DistutilsByteCompileError
def get_platform ():
"""Return a string that identifies the current platform. This is used
@@ -397,6 +398,9 @@
generated in indirect mode; unless you know what you're doing, leave
it set to None.
"""
+ # nothing is done if PYTHONDONTWRITEBYTECODE environment variable is set
+ if os.environ.get("PYTHONDONTWRITEBYTECODE") is not None:
+ raise DistutilsByteCompileError('byte-compiling is disabled.')
# First, if the caller didn't force us into direct or indirect mode,
# figure out which mode we should be in. We take a conservative
--- Lib/distutils/command/build_py.py
+++ Lib/distutils/command/build_py.py
@@ -418,6 +418,10 @@
def byte_compile (self, files):
+ if os.environ.get("PYTHONDONTWRITEBYTECODE") is not None:
+ self.warn('byte-compiling is disabled, skipping.')
+ return
+
from distutils.util import byte_compile
prefix = self.build_lib
if prefix[-1] != os.sep:
--- Lib/distutils/command/install_lib.py
+++ Lib/distutils/command/install_lib.py
@@ -121,6 +121,10 @@
return outfiles
def byte_compile (self, files):
+ if os.environ.get("PYTHONDONTWRITEBYTECODE") is not None:
+ self.warn('byte-compiling is disabled, skipping.')
+ return
+
from distutils.util import byte_compile
# Get the "--root" directory supplied to the "install" command,
--- Lib/distutils/errors.py
+++ Lib/distutils/errors.py
@@ -76,6 +76,8 @@
class DistutilsTemplateError (DistutilsError):
"""Syntax error in a file list template."""
+class DistutilsByteCompileError(DistutilsError):
+ """Byte compile error."""
# Exception classes used by the CCompiler implementation classes
class CCompilerError (Exception):

View File

@@ -1,39 +0,0 @@
# HG changeset patch
# User Alan Kennedy <alan@xhaus.com>
# Date 1333300584 -3600
# Node ID a972112ac1b155ef41b3f8ce195251bc6cc3ebce
# Parent 920a60f5d5b5fdf46f4f26c75cab42e2a671be2f
#1537: Fix for classloading issues with MATLAB/OpenJDK
diff --git a/Lib/xml/parsers/expat.py b/Lib/xml/parsers/expat.py
--- a/Lib/xml/parsers/expat.py
+++ b/Lib/xml/parsers/expat.py
@@ -47,12 +47,8 @@ from org.xml.sax.helpers import XMLReade
from org.xml.sax.ext import DefaultHandler2
# Xerces
-try:
- # Name mangled by jarjar?
- import org.python.apache.xerces.parsers.SAXParser
- _xerces_parser = "org.python.apache.xerces.parsers.SAXParser"
-except ImportError:
- _xerces_parser = "org.apache.xerces.parsers.SAXParser"
+_mangled_xerces_parser_name = "org.python.apache.xerces.parsers.SAXParser"
+_xerces_parser_name = "org.apache.xerces.parsers.SAXParser"
# @expat args registry
@@ -88,7 +84,11 @@ class XMLParser(object):
"not %s" % type(namespace_separator).__name__)
raise TypeError(error)
- self._reader = XMLReaderFactory.createXMLReader(_xerces_parser)
+ # See http://bugs.jython.org/issue1537
+ try:
+ self._reader = XMLReaderFactory.createXMLReader(_mangled_xerces_parser_name)
+ except:
+ self._reader = XMLReaderFactory.createXMLReader(_xerces_parser_name)
if self.namespace_separator is None:
try:

View File

@@ -1,94 +0,0 @@
# HG changeset patch
# User Alan Kennedy <jython-dev@xhaus.com>
# Date 1319980040 0
# Node ID 936bd1b132eb9c591cf915b060c6567ae8e16914
# Parent 71b3f883f6c5f0f39f0ae8aff097a439d4970f46
Fix for xml attribute namespaces issue
http://bugs.jython.org/issue1768
diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py
--- a/Lib/test/test_sax.py
+++ b/Lib/test/test_sax.py
@@ -390,22 +390,23 @@ def test_expat_nsattrs_wattr():
gather = AttrGatherer()
parser.setContentHandler(gather)
- parser.parse(StringIO("<doc xmlns:ns='%s' ns:attr='val'/>" % ns_uri))
+ a_name = "id" ; a_val = "val"
+ parser.parse(StringIO("<doc xmlns:ns='%s' ns:%s='%s'/>" % (ns_uri, a_name, a_val) ))
attrs = gather._attrs
return attrs.getLength() == 1 and \
- attrs.getNames() == [(ns_uri, "attr")] and \
- attrs.getQNames() == ["ns:attr"] and \
+ attrs.getNames() == [(ns_uri, a_name)] and \
+ attrs.getQNames() == ["ns:%s" % a_name] and \
len(attrs) == 1 and \
- attrs.has_key((ns_uri, "attr")) and \
- attrs.keys() == [(ns_uri, "attr")] and \
- attrs.get((ns_uri, "attr")) == "val" and \
- attrs.get((ns_uri, "attr"), 25) == "val" and \
- attrs.items() == [((ns_uri, "attr"), "val")] and \
- attrs.values() == ["val"] and \
- attrs.getValue((ns_uri, "attr")) == "val" and \
- attrs[(ns_uri, "attr")] == "val"
+ attrs.has_key((ns_uri, a_name)) and \
+ attrs.keys() == [(ns_uri, a_name)] and \
+ attrs.get((ns_uri, a_name)) == a_val and \
+ attrs.get((ns_uri, a_name), 25) == a_val and \
+ attrs.items() == [((ns_uri, a_name), a_val)] and \
+ attrs.values() == [a_val] and \
+ attrs.getValue((ns_uri, a_name)) == a_val and \
+ attrs[(ns_uri, a_name)] == a_val
def test_expat_nsattrs_no_namespace():
parser = make_parser()
@@ -413,22 +414,23 @@ def test_expat_nsattrs_no_namespace():
gather = AttrGatherer()
parser.setContentHandler(gather)
- parser.parse(StringIO("<doc attr='val'/>"))
+ a_name = "id" ; a_val = "val"
+ parser.parse(StringIO("<doc %s='%s'/>" % (a_name, a_val) ))
attrs = gather._attrs
return attrs.getLength() == 1 and \
- attrs.getNames() == [(None, "attr")] and \
- attrs.getQNames() == ["attr"] and \
+ attrs.getNames() == [(None, a_name)] and \
+ attrs.getQNames() == [a_name] and \
len(attrs) == 1 and \
- attrs.has_key((None, "attr")) and \
- attrs.keys() == [(None, "attr")] and \
- attrs.get((None, "attr")) == "val" and \
- attrs.get((None, "attr"), 25) == "val" and \
- attrs.items() == [((None, "attr"), "val")] and \
- attrs.values() == ["val"] and \
- attrs.getValue((None, "attr")) == "val" and \
- attrs[(None, "attr")] == "val"
+ attrs.has_key((None, a_name)) and \
+ attrs.keys() == [(None, a_name)] and \
+ attrs.get((None, a_name)) == a_val and \
+ attrs.get((None, a_name), 25) == a_val and \
+ attrs.items() == [((None, a_name), a_val)] and \
+ attrs.values() == [a_val] and \
+ attrs.getValue((None, a_name)) == a_val and \
+ attrs[(None, a_name)] == a_val
# ===== InputSource support
diff --git a/Lib/xml/sax/drivers2/drv_javasax.py b/Lib/xml/sax/drivers2/drv_javasax.py
--- a/Lib/xml/sax/drivers2/drv_javasax.py
+++ b/Lib/xml/sax/drivers2/drv_javasax.py
@@ -238,7 +238,7 @@ class JavaSAXParser(xmlreader.XMLReader,
pass # TODO
def _fixTuple(nsTuple, frm, to):
- if len(nsTuple) == 2:
+ if isinstance(nsTuple, tuple) and len(nsTuple) == 2:
nsUri, localName = nsTuple
if nsUri == frm:
nsUri = to

View File

@@ -1,37 +0,0 @@
--- Lib/distutils/command/build_py.py
+++ Lib/distutils/command/build_py.py
@@ -418,6 +418,10 @@
def byte_compile (self, files):
+ if os.environ.get("PYTHONDONTWRITEBYTECODE") is not None:
+ self.warn('byte-compiling is disabled, skipping.')
+ return
+
from distutils.util import byte_compile
prefix = self.build_lib
if prefix[-1] != os.sep:
--- Lib/distutils/command/install_lib.py
+++ Lib/distutils/command/install_lib.py
@@ -121,6 +121,10 @@
return outfiles
def byte_compile (self, files):
+ if os.environ.get("PYTHONDONTWRITEBYTECODE") is not None:
+ self.warn('byte-compiling is disabled, skipping.')
+ return
+
from distutils.util import byte_compile
# Get the "--root" directory supplied to the "install" command,
--- Lib/distutils/errors.py
+++ Lib/distutils/errors.py
@@ -76,6 +76,8 @@
class DistutilsTemplateError (DistutilsError):
"""Syntax error in a file list template."""
+class DistutilsByteCompileError(DistutilsError):
+ """Byte compile error."""
# Exception classes used by the CCompiler implementation classes
class CCompilerError (Exception):

View File

@@ -1,135 +0,0 @@
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI=4
JAVA_PKG_IUSE="readline source doc servletapi mysql postgres examples oracle"
#jdnc
inherit base java-pkg-2 java-ant-2
MY_PV="installer-2.2.1"
PYVER="2.2.3"
DESCRIPTION="An implementation of Python written in Java"
HOMEPAGE="http://www.jython.org"
SRC_URI="http://www.python.org/ftp/python/${PYVER%_*}/Python-${PYVER}.tgz
mirror://sourceforge/${PN}/${PN}_${MY_PV}.jar"
LICENSE="PSF-2"
SLOT="0"
KEYWORDS="amd64 ppc64 x86"
IUSE=""
CDEPEND="
dev-java/jakarta-oro:2.0
readline? ( >=dev-java/libreadline-java-0.8.0:0 )
mysql? ( >=dev-java/jdbc-mysql-3.1:0 )
postgres? ( dev-java/jdbc-postgresql:0 )
oracle? ( dev-java/jdbc-oracle-bin:10.2 )
servletapi? ( java-virtuals/servlet-api:2.5 )
!<=dev-java/freemarker-2.3.10"
RDEPEND="${CDEPEND}
>=virtual/jre-1.5"
DEPEND="${CDEPEND}
>=virtual/jdk-1.5
dev-java/javacc"
S="${WORKDIR}"
#Tests currently very broken. Need to investigate whether that
#is jython's or gentoo's doing.
RESTRICT="test"
java_prepare() {
epatch "${FILESDIR}/${P}-build.xml.patch"
rm -Rfv org || die "Unable to remove class files."
find . -iname '*.jar' | xargs rm -fv || die "Unable to remove bundled jars"
echo javacc.jar="$(java-pkg_getjars --build-only javacc)" > ant.properties
if use readline; then
echo "readline.jar=$(java-pkg_getjars libreadline-java)" >> \
ant.properties
fi
if use servletapi; then
echo "servlet.jar=$(java-pkg_getjar --virtual servlet-api-2.5 servlet-api.jar)" \
>> ant.properties
fi
if use mysql; then
echo "mysql.jar=$(java-pkg_getjar jdbc-mysql jdbc-mysql.jar)" \
>> ant.properties
fi
if use postgres; then
echo \
"postgresql.jar=$(java-pkg_getjar jdbc-postgresql jdbc-postgresql.jar)"\
>> ant.properties
fi
if use oracle; then
echo \
"oracle.jar=$(java-pkg-getjar jdbc-oracle-bin-10.2 ojdbc14.jar)" \
>> ant.properties
fi
}
src_compile() {
local antflags="-Dbase.path=src/java -Dsource.dir=src/java/src"
local pylib="Python-${PYVER}/Lib"
antflags="${antflags} -Dpython.lib=${pylib} -Dsvn.checkout.dir=."
LC_ALL=C eant ${antflags} developer-build $(use_doc javadoc)
}
src_test() {
local antflags="-Dbase.path=src/java -Dsource.dir=src/java/src"
antflags="${antflags} -Dpython.home=dist"
local pylib="Python-${PYVER}/Lib"
antflags="${antflags} -Dpython.lib=${pylib}"
eant ${antflags} bugtest
}
src_install() {
java-pkg_dojar "dist/${PN}.jar"
dodoc README.txt NEWS ACKNOWLEDGMENTS
use doc && dohtml -r Doc/*
local java_args="-Dpython.home=/usr/share/jython"
java_args="${java_args} -Dpython.cachedir=\${HOME}/.jythoncachedir"
java-pkg_dolauncher jythonc \
--main "org.python.util.jython" \
--java_args "${java_args}" \
--pkg_args "${java_args} /usr/share/jython/tools/jythonc/jythonc.py"
java-pkg_dolauncher jython \
--main "org.python.util.jython" \
--pkg_args "${java_args}"
insinto /usr/share/${PN}
doins -r dist/Lib registry
insinto /usr/share/${PN}/tools
doins -r dist/Tools/*
use doc && java-pkg_dojavadoc dist/Doc/javadoc
use source && java-pkg_dosrc src
use examples && java-pkg_doexamples dist/Demo/*
}
pkg_postinst() {
if use readline; then
elog "To use readline you need to add the following to your registry"
elog
elog "python.console=org.python.util.ReadlineConsole"
elog "python.console.readlinelib=GnuReadline"
elog
elog "The global registry can be found in /usr/share/${PN}/registry"
elog "User registry in \$HOME/.jython"
elog "See http://www.jython.org/docs/registry.html for more information"
elog ""
fi
}

View File

@@ -1,149 +0,0 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI="4"
JAVA_PKG_IUSE="doc examples source"
inherit eutils java-pkg-2 java-ant-2 python-utils-r1
DESCRIPTION="An implementation of Python written in Java"
HOMEPAGE="http://www.jython.org"
SRC_URI="http://central.maven.org/maven2/org/python/${PN}-installer/${PV}/${PN}-installer-${PV}.jar"
LICENSE="PSF-2"
SLOT="2.5"
KEYWORDS="amd64 x86 ~x86-freebsd ~amd64-linux ~x86-linux ~x86-macos"
IUSE="readline"
# Missing in installer jar.
RESTRICT="test"
COMMON_DEP="
!<=dev-java/freemarker-2.3.10
dev-java/antlr:3
dev-java/asm:3
dev-java/guava:0
>=dev-java/java-config-2.1.11-r3
dev-java/jffi:1.0
dev-java/jline:0
dev-java/jnr-constants:0.8.2
dev-java/jnr-posix:1.1
java-virtuals/script-api:0
java-virtuals/servlet-api:2.5
readline? ( >=dev-java/libreadline-java-0.8.0:0 )"
RDEPEND="${COMMON_DEP}
>=virtual/jre-1.5"
DEPEND="${COMMON_DEP}
>=virtual/jdk-1.5
app-arch/unzip"
S="${WORKDIR}"
java_prepare() {
# src/META-INF/services missing - taking from prebuilt jar
pushd src > /dev/null || die
jar -xf ../${PN}.jar META-INF/services || die
popd > /dev/null
find \( -name '*.jar' -o -name '*.class' \
-o -name '*.pyc' -o -name '*.exe' \) -delete
epatch "${FILESDIR}/${PN}-2.5.2-build.xml.patch"
epatch "${FILESDIR}/${PN}-2.5.2-distutils_byte_compilation.patch"
epatch "${FILESDIR}/${PN}-2.5.2-distutils_scripts_location.patch"
epatch "${FILESDIR}/${PN}-2.5.2-respect_PYTHONPATH.patch"
if ! use readline; then
rm -v src/org/python/util/ReadlineConsole.java || die
fi
}
JAVA_ANT_REWRITE_CLASSPATH="yes"
JAVA_ANT_CLASSPATH_TAGS+=" java"
EANT_BUILD_TARGET="developer-build"
EANT_GENTOO_CLASSPATH="asm-3,guava,jffi-1.0,jline,jnr-constants-0.8.2,script-api,servlet-api-2.5"
# jdbc-informix and jdbc-oracle-bin (requires registration) aren't exposed.
# Uncomment and add to COMMON_DEP if you want either of them
#EANT_GENTOO_CLASSPATH+=",jdbc-informix" EANT_EXTRA_ARGS+=" -Dinformix.present"
#EANT_GENTOO_CLASSPATH+=",jdbc-oracle-bin" EANT_EXTRA_ARGS+=" -Doracle.present"
src_compile() {
use readline && EANT_GENTOO_CLASSPATH+=",libreadline-java"
EANT_GENTOO_CLASSPATH_EXTRA="$(java-pkg_getjars --with-dependencies antlr-3,jnr-posix-1.1)"
EANT_GENTOO_CLASSPATH_EXTRA+=":$(java-pkg_getjars --build-only ant-core)"
sed -i -e "1 a\
CLASSPATH=\"$(java-pkg_getjars "${EANT_GENTOO_CLASSPATH}"):${EANT_GENTOO_CLASSPATH_EXTRA}\"" \
bin/jython || die
java-pkg-2_src_compile
}
EANT_TEST_EXTRA_ARGS="-Dpython.home=dist"
src_test() {
java-pkg-2_src_test
}
src_install() {
java-pkg_newjar dist/${PN}-dev.jar
java-pkg_register-optional-dependency jdbc-mysql
java-pkg_register-optional-dependency jdbc-postgresql
insinto /usr/share/${PN}-${SLOT}
doins -r dist/{Lib,registry}
dodoc ACKNOWLEDGMENTS NEWS README.txt
use doc && java-pkg_dojavadoc dist/Doc/javadoc
use source && java-pkg_dosrc src/*
use examples && java-pkg_doexamples Demo/*
local java_args=(
-Dpython.home="${EPREFIX}"/usr/share/${PN}-${SLOT}
-Dpython.executable="${EPREFIX}"/usr/bin/jython${SLOT}
-Dpython.cachedir="\${HOME}/.jythoncachedir"
)
java-pkg_dolauncher jython${SLOT} \
--main org.python.util.jython \
--java_args "${java_args[*]}"
if use readline; then
sed -i -e "/#python.console.readlinelib=JavaReadline/a \
python.console=org.python.util.ReadlineConsole\npython.console.readlinelib=GnuReadline" \
"${ED}"/usr/share/${PN}-${SLOT}/registry || die
fi
# the jvm opens classfiles rw ...
dodir /etc/sandbox.d
echo "SANDBOX_PREDICT=/usr/share/${PN}-${SLOT}" > "${ED}/etc/sandbox.d/20${P}-${SLOT}"
# we need a wrapper to help python_optimize
cat > "${T}"/jython <<_EOF_ || die
exec java -cp "$(java-pkg_getjars "${EANT_GENTOO_CLASSPATH}"):${EANT_GENTOO_CLASSPATH_EXTRA}:dist/${PN}-dev.jar" \
-Dpython.home="${ED}"/usr/share/${PN}-${SLOT} \
-Dpython.cachedir="${T}/.jythoncachedir" \
-Duser.home="${T}" \
org.python.util.jython "\${@}"
_EOF_
chmod +x "${T}"/jython || die
local -x PYTHON="${T}"/jython
python_export jython${SLOT} EPYTHON PYTHON_SITEDIR
# compile tests (everything else is compiled already)
# we're keeping it quiet since jython reports errors verbosely
# and some of the tests are supposed to trigger compile errors
python_optimize "${ED}"/usr/share/jython-${SLOT}/Lib/test &>/dev/null
# for python-exec
echo "EPYTHON='${EPYTHON}'" > epython.py || die
python_domodule epython.py
}