Gentoo Archives: gentoo-commits

From: Florian Schmaus <flow@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-java/jython/
Date: Fri, 29 Apr 2022 08:47:03
Message-Id: 1651222001.0bca1def40c7da7411b990da428e1ca81f30397a.flow@gentoo
1 commit: 0bca1def40c7da7411b990da428e1ca81f30397a
2 Author: Volkmar W. Pogatzki <gentoo <AT> pogatzki <DOT> net>
3 AuthorDate: Thu Apr 28 08:15:04 2022 +0000
4 Commit: Florian Schmaus <flow <AT> gentoo <DOT> org>
5 CommitDate: Fri Apr 29 08:46:41 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0bca1def
7
8 dev-java/jython: dependency switch guava:20 -> guava:0
9
10 Bug: https://bugs.gentoo.org/833785
11 Signed-off-by: Volkmar W. Pogatzki <gentoo <AT> pogatzki.net>
12 Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>
13
14 dev-java/jython/jython-2.7.0-r6.ebuild | 156 +++++++++++++++++++++++++++++++++
15 1 file changed, 156 insertions(+)
16
17 diff --git a/dev-java/jython/jython-2.7.0-r6.ebuild b/dev-java/jython/jython-2.7.0-r6.ebuild
18 new file mode 100644
19 index 000000000000..7000a802e098
20 --- /dev/null
21 +++ b/dev-java/jython/jython-2.7.0-r6.ebuild
22 @@ -0,0 +1,156 @@
23 +# Copyright 1999-2022 Gentoo Authors
24 +# Distributed under the terms of the GNU General Public License v2
25 +
26 +EAPI=7
27 +
28 +JAVA_PKG_IUSE="doc source"
29 +MAVEN_ID="org.python:jython:2.7.0"
30 +
31 +inherit java-pkg-2 java-ant-2 python-utils-r1 flag-o-matic
32 +
33 +MY_PV=${PV/_beta/-b}
34 +MY_P=${PN}-${MY_PV}
35 +
36 +DESCRIPTION="An implementation of Python written in Java"
37 +HOMEPAGE="https://www.jython.org"
38 +SRC_URI="https://search.maven.org/remotecontent?filepath=org/python/${PN}/${MY_PV}/${MY_P}-sources.jar"
39 +
40 +LICENSE="PSF-2"
41 +SLOT="2.7"
42 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86 ~amd64-linux ~x86-linux"
43 +IUSE="examples test"
44 +
45 +CP_DEPEND="dev-java/antlr:3
46 + dev-java/netty:0
47 + dev-java/asm:9
48 + dev-java/commons-compress:0
49 + dev-java/guava:0
50 + dev-java/jffi:1.2
51 + dev-java/jline:2
52 + dev-java/icu4j:70
53 + dev-java/jnr-constants:0
54 + dev-java/jnr-posix:3.0
55 + dev-java/jnr-netdb:1.0
56 + dev-java/stringtemplate:0
57 + dev-java/xerces:2
58 + java-virtuals/servlet-api:3.0"
59 +RDEPEND="${CP_DEPEND}
60 + >=virtual/jre-1.8:*"
61 +DEPEND="${CP_DEPEND}
62 + >=virtual/jdk-1.8:*
63 + dev-java/ant-core:0
64 + test? (
65 + dev-java/junit:4
66 + dev-java/ant-junit:0
67 + )"
68 +BDEPEND="app-arch/unzip"
69 +
70 +S=${WORKDIR}
71 +
72 +RESTRICT="test"
73 +
74 +JAVA_ANT_REWRITE_CLASSPATH="yes"
75 +JAVA_ANT_CLASSPATH_TAGS+=" java"
76 +
77 +EANT_BUILD_TARGET="developer-build"
78 +EANT_TEST_EXTRA_ARGS="-Dpython.home=dist"
79 +
80 +# jdbc-informix and jdbc-oracle-bin (requires registration) aren't exposed.
81 +# Uncomment and add to CDEPEND if you want either of them
82 +#EANT_GENTOO_CLASSPATH+=",jdbc-informix" EANT_EXTRA_ARGS+=" -Dinformix.present"
83 +#EANT_GENTOO_CLASSPATH+=",jdbc-oracle-bin" EANT_EXTRA_ARGS+=" -Doracle.present"
84 +
85 +PATCHES=(
86 + "${FILESDIR}"/${PN}-2.5.2-distutils_scripts_location.patch
87 + "${FILESDIR}"/${PN}-2.5.2-respect_PYTHONPATH.patch
88 + "${FILESDIR}"/${PN}-2.7_beta1-ant.patch
89 + "${FILESDIR}"/${PN}-2.7_beta1-dont-always-recompile-classes.patch
90 + "${FILESDIR}"/${PN}-2.7_beta2-maxrepeat-import.patch
91 + "${FILESDIR}"/${PN}-2.7.0-build.xml.patch
92 + "${FILESDIR}"/CVE-2016-4000.patch
93 +)
94 +
95 +src_prepare() {
96 + default
97 +
98 + find \( -name '*.jar' -o -name '*.class' \
99 + -o -name '*.pyc' -o -name '*.exe' \) -delete
100 +
101 + # needed for launchertest
102 + chmod +x tests/shell/test-jython.sh || die
103 +
104 + # https://bugs.gentoo.org/show_bug.cgi?id=833785
105 + sed -e 's:\(CharMatcher.\)ASCII:\1ascii():' \
106 + -i src/org/python/core/Py{,BaseCode,Unicode}.java || die
107 +
108 + java-pkg-2_src_prepare
109 +}
110 +
111 +src_configure() {
112 + # apparently this can cause problems
113 + append-flags -fno-stack-protector
114 +
115 + EANT_GENTOO_CLASSPATH_EXTRA="$(java-pkg_getjars --with-dependencies antlr-3,jnr-posix-3.0)"
116 + EANT_GENTOO_CLASSPATH_EXTRA+=":$(java-pkg_getjars --build-only ant-core)"
117 +}
118 +
119 +src_test() {
120 + java-pkg-2_src_test
121 +}
122 +
123 +src_install() {
124 + local instdir=/usr/share/${PN}-${SLOT}
125 +
126 + java-pkg_newjar dist/${PN}-dev.jar
127 +
128 + java-pkg_register-optional-dependency jdbc-mysql
129 + java-pkg_register-optional-dependency jdbc-postgresql
130 +
131 + insinto ${instdir}
132 + doins -r dist/{Lib,registry}
133 +
134 + dodoc ACKNOWLEDGMENTS NEWS README.txt
135 +
136 + use doc && java-pkg_dohtml -r dist/Doc/javadoc
137 + use source && java-pkg_dosrc src/*
138 + use examples && java-pkg_doexamples Demo/*
139 +
140 + local java_args=(
141 + -Dpython.home="${EPREFIX}"/usr/share/${PN}-${SLOT}
142 + -Dpython.executable="${EPREFIX}"/usr/bin/jython${SLOT}
143 + -Dpython.cachedir="\${HOME}/.jythoncachedir"
144 + )
145 +
146 + java-pkg_dolauncher jython${SLOT} \
147 + --main org.python.util.jython \
148 + --java_args "${java_args[*]}"
149 +
150 + # we need a wrapper to help python_optimize
151 + cat <<-EOF > "${T}"/jython
152 + exec java -cp "$(java-pkg_getjars "${EANT_GENTOO_CLASSPATH}"):${EANT_GENTOO_CLASSPATH_EXTRA}:dist/${PN}-dev.jar" \
153 + -Dpython.home="${ED}${instdir}" \
154 + -Dpython.cachedir="${T}/.jythoncachedir" \
155 + -Duser.home="${T}" \
156 + org.python.util.jython "\${@}"
157 + EOF
158 + chmod +x "${T}"/jython || die
159 +
160 + local -x PYTHON="${T}"/jython
161 + # we can't get the path from the interpreter since it does some
162 + # magic that fails on non-installed copy...
163 + _python_export jython${SLOT} EPYTHON
164 +
165 + # compile tests (everything else is compiled already)
166 + # we're keeping it quiet since jython reports errors verbosely
167 + # and some of the tests are supposed to trigger compile errors
168 + python_optimize "${ED}${instdir}"/Lib/test &>/dev/null
169 +
170 + # for python-exec
171 + echo "EPYTHON='${EPYTHON}'" > epython.py || die
172 + python_moduleinto "/usr/share/jython-${SLOT}/Lib/site-packages"
173 + python_domodule epython.py
174 +
175 + # some of the class files end up with newer timestamps than the files they
176 + # were generated from, make sure this doesn't happen
177 + find "${ED}${instdir}"/Lib/ -name '*.class' | xargs touch
178 +}