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