commit
813ba9c4dd
16
jython-cachedir.patch
Normal file
16
jython-cachedir.patch
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
--- src/org/python/core/PySystemState.java.orig 2014-05-28 11:09:26.758604716 +0100
|
||||||
|
+++ src/org/python/core/PySystemState.java 2014-05-28 11:16:59.136279132 +0100
|
||||||
|
@@ -960,8 +960,11 @@
|
||||||
|
}
|
||||||
|
cachedir = new File(props.getProperty(PYTHON_CACHEDIR, CACHEDIR_DEFAULT_NAME));
|
||||||
|
if (!cachedir.isAbsolute()) {
|
||||||
|
- String prefixString = prefix == null ? null : Py.fileSystemDecode(prefix);
|
||||||
|
- cachedir = new File(prefixString, cachedir.getPath());
|
||||||
|
+ File jythondir = new File(System.getProperty("user.home"), ".jython-cache");
|
||||||
|
+ if (!jythondir.isDirectory()) {
|
||||||
|
+ jythondir.mkdirs();
|
||||||
|
+ }
|
||||||
|
+ cachedir = new File(jythondir, cachedir.getPath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
62
jython-dont-validate-pom.patch
Normal file
62
jython-dont-validate-pom.patch
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
--- build.xml.orig 2015-04-08 23:42:46.345303431 +0100
|
||||||
|
+++ build.xml 2015-04-08 23:44:39.525852992 +0100
|
||||||
|
@@ -139,6 +139,9 @@
|
||||||
|
|
||||||
|
<!-- classpaths -->
|
||||||
|
<path id="main.classpath">
|
||||||
|
+ <fileset dir="${extlibs.dir}">
|
||||||
|
+ <include name="**/*.jar"/>
|
||||||
|
+ </fileset>
|
||||||
|
<pathelement path="${extlibs.dir}/servlet-api-2.5.jar" />
|
||||||
|
<pathelement path="${informix.jar}" />
|
||||||
|
<pathelement path="${oracle.jar}" />
|
||||||
|
--- maven/build.xml.orig 2014-05-30 09:14:45.807566331 +0100
|
||||||
|
+++ maven/build.xml 2014-05-30 09:20:08.483159086 +0100
|
||||||
|
@@ -107,8 +107,6 @@
|
||||||
|
|
||||||
|
<move file="${build.dir}/@{install.name}.jar"
|
||||||
|
tofile="@{install.dir}/@{install.name}.jar"/>
|
||||||
|
- <move file="${build.dir}/@{install.name}-sources.jar"
|
||||||
|
- tofile="@{install.dir}/@{install.name}-sources.jar"/>
|
||||||
|
|
||||||
|
<checksum algorithm="SHA1" fileext=".sha1">
|
||||||
|
<fileset dir="@{install.dir}" excludes="*.sha1,*.md5,*.tmp"/>
|
||||||
|
@@ -159,31 +157,6 @@
|
||||||
|
<copy file="${dist.base}/@{artifactId}.jar"
|
||||||
|
tofile="${build.dir}/@{artifactId}-${project.version}.jar"/>
|
||||||
|
|
||||||
|
- <copy file="dist/sources.jar" tofile="${build.dir}/@{artifactId}-${project.version}-sources.jar"/>
|
||||||
|
- <copy file="dist/javadoc.jar" tofile="${build.dir}/@{artifactId}-${project.version}-javadoc.jar"/>
|
||||||
|
-
|
||||||
|
- <!-- TODO: make the gpg sign step optional -->
|
||||||
|
- <exec executable="gpg">
|
||||||
|
- <arg value="-ab"/>
|
||||||
|
- <arg value="${build.dir}/@{artifactId}-${project.version}.jar"/>
|
||||||
|
- </exec>
|
||||||
|
-
|
||||||
|
- <exec executable="gpg">
|
||||||
|
- <arg value="-ab"/>
|
||||||
|
- <arg value="${build.dir}/@{artifactId}-${project.version}-javadoc.jar"/>
|
||||||
|
- </exec>
|
||||||
|
-
|
||||||
|
- <exec executable="gpg">
|
||||||
|
- <arg value="-ab"/>
|
||||||
|
- <arg value="${build.dir}/@{artifactId}-${project.version}.pom"/>
|
||||||
|
- </exec>
|
||||||
|
-
|
||||||
|
- <exec executable="gpg">
|
||||||
|
- <arg value="-ab"/>
|
||||||
|
- <arg value="${build.dir}/@{artifactId}-${project.version}-sources.jar"/>
|
||||||
|
- </exec>
|
||||||
|
-
|
||||||
|
-
|
||||||
|
</sequential>
|
||||||
|
</macrodef>
|
||||||
|
|
||||||
|
@@ -208,5 +181,5 @@
|
||||||
|
<ant antfile="build.xml" target="all-jars"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
- <target name="prep" depends="build-jython, validate-pom"/>
|
||||||
|
+ <target name="prep" depends=""/>
|
||||||
|
</project>
|
||||||
41
jython-fix-multiprocessing.patch
Normal file
41
jython-fix-multiprocessing.patch
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
--- a/Lib/subprocess.py
|
||||||
|
+++ b/Lib/subprocess.py
|
||||||
|
@@ -491,6 +491,38 @@ def _eintr_retry_call(func, *args):
|
||||||
|
raise
|
||||||
|
|
||||||
|
|
||||||
|
+# XXX This function is only used by multiprocessing and the test suite,
|
||||||
|
+# but it's here so that it can be imported when Python is compiled without
|
||||||
|
+# threads.
|
||||||
|
+
|
||||||
|
+def _args_from_interpreter_flags():
|
||||||
|
+ """Return a list of command-line arguments reproducing the current
|
||||||
|
+ settings in sys.flags and sys.warnoptions."""
|
||||||
|
+ flag_opt_map = {
|
||||||
|
+ 'debug': 'd',
|
||||||
|
+ # 'inspect': 'i',
|
||||||
|
+ # 'interactive': 'i',
|
||||||
|
+ 'optimize': 'O',
|
||||||
|
+ 'dont_write_bytecode': 'B',
|
||||||
|
+ 'no_user_site': 's',
|
||||||
|
+ 'no_site': 'S',
|
||||||
|
+ 'ignore_environment': 'E',
|
||||||
|
+ 'verbose': 'v',
|
||||||
|
+ 'bytes_warning': 'b',
|
||||||
|
+ 'py3k_warning': '3',
|
||||||
|
+ }
|
||||||
|
+ args = []
|
||||||
|
+ for flag, opt in flag_opt_map.items():
|
||||||
|
+ v = getattr(sys.flags, flag)
|
||||||
|
+ if v > 0:
|
||||||
|
+ args.append('-' + opt * v)
|
||||||
|
+ if getattr(sys.flags, 'hash_randomization') != 0:
|
||||||
|
+ args.append('-R')
|
||||||
|
+ for opt in sys.warnoptions:
|
||||||
|
+ args.append('-W' + opt)
|
||||||
|
+ return args
|
||||||
|
+
|
||||||
|
+
|
||||||
|
def call(*popenargs, **kwargs):
|
||||||
|
"""Run command with arguments. Wait for command to complete, then
|
||||||
|
return the returncode attribute.
|
||||||
14
jython-fix-tty-detection.patch
Normal file
14
jython-fix-tty-detection.patch
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
--- src/shell/jython.orig 2017-08-11 16:24:32.831309328 +0100
|
||||||
|
+++ src/shell/jython 2017-08-11 16:23:55.346726416 +0100
|
||||||
|
@@ -242,6 +242,11 @@
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
+# Detect absence of tty
|
||||||
|
+if ! tty -s; then
|
||||||
|
+ JAVA_OPTS="$JAVA_OPTS -Dpython.launcher.tty=false"
|
||||||
|
+fi
|
||||||
|
+
|
||||||
|
if [ -n "$profile_requested" -o -z "$boot_requested" ] ; then
|
||||||
|
[ -n "$profile_requested" ] && echo "Running with instrumented profiler"
|
||||||
|
java_args=("${java_args[@]}" -classpath "$CP$CP_DELIMITER$CLASSPATH")
|
||||||
37
jython-launcher.patch
Normal file
37
jython-launcher.patch
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
--- src/shell/jython.orig 2017-01-26 12:01:25.475209982 +0000
|
||||||
|
+++ src/shell/jython 2017-01-26 12:00:52.178558518 +0000
|
||||||
|
@@ -74,17 +74,8 @@
|
||||||
|
|
||||||
|
CP_DELIMITER=":"
|
||||||
|
|
||||||
|
-CP=$JYTHON_HOME/jython-dev.jar
|
||||||
|
-
|
||||||
|
-if [ -f "$CP" ] ; then
|
||||||
|
- # add necessary jars for command-line execution
|
||||||
|
- for j in "$JYTHON_HOME"/javalib/*.jar; do
|
||||||
|
- if [ "$CP" ]; then
|
||||||
|
- CP="$CP$CP_DELIMITER$j"
|
||||||
|
- else
|
||||||
|
- CP="$j"
|
||||||
|
- fi
|
||||||
|
- done
|
||||||
|
+if [ -f "$JYTHON_HOME/jython-dev.jar" ] ; then
|
||||||
|
+ CP=$JYTHON_HOME/jython-dev.jar
|
||||||
|
elif [ ! -f "$JYTHON_HOME"/jython.jar ] ; then
|
||||||
|
echo "$0: $JYTHON_HOME contains neither jython-dev.jar nor jython.jar." >&2
|
||||||
|
echo "Try running this script from the 'bin' directory of an installed Jython or " >&2
|
||||||
|
@@ -93,6 +84,14 @@
|
||||||
|
else
|
||||||
|
CP=$JYTHON_HOME/jython.jar
|
||||||
|
fi
|
||||||
|
+ # add necessary jars for command-line execution
|
||||||
|
+ for j in "$JYTHON_HOME"/javalib/*.jar; do
|
||||||
|
+ if [ "$CP" ]; then
|
||||||
|
+ CP="$CP$CP_DELIMITER$j"
|
||||||
|
+ else
|
||||||
|
+ CP="$j"
|
||||||
|
+ fi
|
||||||
|
+ done
|
||||||
|
|
||||||
|
if $cygwin; then
|
||||||
|
# switch delimiter only after building a Unix style $CP
|
||||||
216
jython-no-carrotsearch-sizeof.patch
Normal file
216
jython-no-carrotsearch-sizeof.patch
Normal file
@ -0,0 +1,216 @@
|
|||||||
|
diff --git a/ACKNOWLEDGMENTS b/ACKNOWLEDGMENTS
|
||||||
|
index 9c4370e..a435834 100644
|
||||||
|
--- a/ACKNOWLEDGMENTS
|
||||||
|
+++ b/ACKNOWLEDGMENTS
|
||||||
|
@@ -35,6 +35,7 @@ Jython links the following libraries:
|
||||||
|
* Mock Runner, licensed under the Apache 1.1 license
|
||||||
|
* Netty 4, licensed under the Apache 2.0 license from the Netty project
|
||||||
|
* PyPy datetime module, licensed under the MIT License from the PyPy project
|
||||||
|
+* Java sizeof, licensed under the Apache 2.0 License from the Apache Software Foundation
|
||||||
|
|
||||||
|
Jython follows closely the Python language and its reference
|
||||||
|
implementation CPython, as created by Guido van Rossum.
|
||||||
|
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
|
||||||
|
index fc33854..7d280c5 100644
|
||||||
|
--- a/Lib/test/test_support.py
|
||||||
|
+++ b/Lib/test/test_support.py
|
||||||
|
@@ -1021,7 +1021,7 @@ def gc_collect():
|
||||||
|
gc.collect()
|
||||||
|
|
||||||
|
|
||||||
|
-_header = '2P'
|
||||||
|
+_header = '1P'
|
||||||
|
if hasattr(sys, "gettotalrefcount"):
|
||||||
|
_header = '2P' + _header
|
||||||
|
_vheader = _header + 'P'
|
||||||
|
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
|
||||||
|
index e88445b..c038a9f 100644
|
||||||
|
--- a/Lib/test/test_sys.py
|
||||||
|
+++ b/Lib/test/test_sys.py
|
||||||
|
@@ -1,6 +1,8 @@
|
||||||
|
# -*- coding: iso-8859-1 -*-
|
||||||
|
import unittest, test.test_support
|
||||||
|
import sys, cStringIO
|
||||||
|
+import struct
|
||||||
|
+
|
||||||
|
|
||||||
|
class SysModuleTest(unittest.TestCase):
|
||||||
|
|
||||||
|
@@ -271,12 +273,84 @@ class SysModuleTest(unittest.TestCase):
|
||||||
|
self.assertEqual(out, '?')
|
||||||
|
|
||||||
|
|
||||||
|
+class SizeofTest(unittest.TestCase):
|
||||||
|
+ """Jython modified version of getsizeof"""
|
||||||
|
+
|
||||||
|
+ def setUp(self):
|
||||||
|
+ self.P = struct.calcsize('P')
|
||||||
|
+ self.longdigit = sys.long_info.sizeof_digit
|
||||||
|
+ self.file = open(test.test_support.TESTFN, 'wb')
|
||||||
|
+
|
||||||
|
+ def tearDown(self):
|
||||||
|
+ self.file.close()
|
||||||
|
+ test.test_support.unlink(test.test_support.TESTFN)
|
||||||
|
+
|
||||||
|
+ check_sizeof = test.test_support.check_sizeof
|
||||||
|
+
|
||||||
|
+ def test_default(self):
|
||||||
|
+ size = test.test_support.calcobjsize
|
||||||
|
+ self.assertEqual(sys.getsizeof(True, -1), size('l'))
|
||||||
|
+
|
||||||
|
+ def test_objecttypes(self):
|
||||||
|
+ # check all types defined in Objects/
|
||||||
|
+ size = test.test_support.calcobjsize
|
||||||
|
+ vsize = test.test_support.calcvobjsize
|
||||||
|
+ check = self.check_sizeof
|
||||||
|
+ # bool
|
||||||
|
+ check(True, size('l'))
|
||||||
|
+ # buffer
|
||||||
|
+ with test.test_support.check_py3k_warnings():
|
||||||
|
+ check(buffer(''), size('1P2Pil'))
|
||||||
|
+ # builtin_function_or_method
|
||||||
|
+ check(len, size('3P'))
|
||||||
|
+ # bytearray_iterator
|
||||||
|
+ check(iter(bytearray()), size('2PP'))
|
||||||
|
+ # cell
|
||||||
|
+ def get_cell():
|
||||||
|
+ x = 42
|
||||||
|
+ def inner():
|
||||||
|
+ return x
|
||||||
|
+ return inner
|
||||||
|
+ check(get_cell().func_closure[0], size('2P'))
|
||||||
|
+ # classobj (old-style class)
|
||||||
|
+ class class_oldstyle():
|
||||||
|
+ def method():
|
||||||
|
+ pass
|
||||||
|
+ check(class_oldstyle, size('6P'))
|
||||||
|
+ # instance (old-style class)
|
||||||
|
+ check(class_oldstyle(), size('3P'))
|
||||||
|
+ # instancemethod (old-style class)
|
||||||
|
+ check(class_oldstyle().method, size('3P'))
|
||||||
|
+ # complex
|
||||||
|
+ check(complex(0,1), size('2P2d'))
|
||||||
|
+ # code
|
||||||
|
+ check(get_cell().func_code, size('4i3Pi3P'))
|
||||||
|
+ # BaseException
|
||||||
|
+ check(BaseException(), size('3P'))
|
||||||
|
+
|
||||||
|
+ def test_pythontypes(self):
|
||||||
|
+ # check all types defined in Python/
|
||||||
|
+ size = test.test_support.calcobjsize
|
||||||
|
+ vsize = test.test_support.calcvobjsize
|
||||||
|
+ check = self.check_sizeof
|
||||||
|
+ # imp.NullImporter
|
||||||
|
+ import imp
|
||||||
|
+ check(imp.NullImporter(self.file.name), size('3P'))
|
||||||
|
+ try:
|
||||||
|
+ raise TypeError
|
||||||
|
+ except TypeError:
|
||||||
|
+ tb = sys.exc_info()[2]
|
||||||
|
+ # traceback
|
||||||
|
+ if tb != None:
|
||||||
|
+ check(tb, size('2P2i'))
|
||||||
|
+
|
||||||
|
+
|
||||||
|
def test_main():
|
||||||
|
if test.test_support.is_jython:
|
||||||
|
del SysModuleTest.test_lost_displayhook
|
||||||
|
del SysModuleTest.test_refcount
|
||||||
|
del SysModuleTest.test_setcheckinterval
|
||||||
|
- test.test_support.run_unittest(SysModuleTest)
|
||||||
|
+ test.test_support.run_unittest(SysModuleTest, SizeofTest)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
test_main()
|
||||||
|
diff --git a/build.xml b/build.xml
|
||||||
|
index 46d288f..0f15f74 100644
|
||||||
|
--- a/build.xml
|
||||||
|
+++ b/build.xml
|
||||||
|
@@ -155,6 +155,7 @@ oracle.jar=C:/workspace/HEAD/for_development/bisdevsrv28/jboss/server/infra/lib/
|
||||||
|
<pathelement path="${extlibs.dir}/guava-22.0-android.jar" />
|
||||||
|
<pathelement path="${extlibs.dir}/icu4j-59_1.jar" />
|
||||||
|
<pathelement path="${extlibs.dir}/jffi-1.2.15.jar"/>
|
||||||
|
+ <pathelement path="${extlibs.dir}/java-sizeof-0.0.5.jar"/>
|
||||||
|
<pathelement path="${extlibs.dir}/jnr-ffi-2.1.5.jar"/>
|
||||||
|
<pathelement path="${extlibs.dir}/jnr-netdb-1.1.6.jar"/>
|
||||||
|
<pathelement path="${extlibs.dir}/jnr-posix-3.0.41.jar"/>
|
||||||
|
@@ -577,8 +578,10 @@ The readme text for the next release will be like:
|
||||||
|
<rule pattern="io.netty.**" result="org.python.netty.@1"/>
|
||||||
|
<zipfileset src="extlibs/netty-transport-4.1.11.Final.jar" excludes="META-INF/**"/>
|
||||||
|
<rule pattern="io.netty.**" result="org.python.netty.@1"/>
|
||||||
|
- <!-- these stub jars are pre-built in https://github.com/jnr/jffi/tree/master/archive
|
||||||
|
- and rarely if ever change -->
|
||||||
|
+ <zipfileset src="${extlibs.dir}/java-sizeof-0.0.5.jar"/>
|
||||||
|
+ <rule pattern="com.carrotsearch.sizeof.**" result="org.python.sizeof.@1"/>
|
||||||
|
+ <!-- these stub jars are pre-built in https://github.com/jnr/jffi/tree/master/archive
|
||||||
|
+ and rarely if ever change -->
|
||||||
|
<zipfileset src="extlibs/jffi-aarch64-Linux.jar"/>
|
||||||
|
<zipfileset src="extlibs/jffi-arm-Linux.jar"/>
|
||||||
|
<zipfileset src="extlibs/jffi-Darwin.jar"/>
|
||||||
|
diff --git a/src/org/python/core/PySystemState.java b/src/org/python/core/PySystemState.java
|
||||||
|
index 6ec694c..335a70e 100644
|
||||||
|
--- a/src/org/python/core/PySystemState.java
|
||||||
|
+++ b/src/org/python/core/PySystemState.java
|
||||||
|
@@ -32,8 +32,8 @@ import java.util.concurrent.ConcurrentMap;
|
||||||
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
import java.util.jar.JarEntry;
|
||||||
|
import java.util.jar.JarFile;
|
||||||
|
-
|
||||||
|
import jnr.posix.util.Platform;
|
||||||
|
+import com.carrotsearch.sizeof.RamUsageEstimator;
|
||||||
|
|
||||||
|
import org.python.Version;
|
||||||
|
import org.python.core.adapter.ClassicPyObjectAdapter;
|
||||||
|
@@ -434,6 +434,15 @@ public class PySystemState extends PyObject implements AutoCloseable,
|
||||||
|
return recursionlimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ @SuppressWarnings("unused")
|
||||||
|
+ public long getsizeof(Object obj, long defaultVal) {
|
||||||
|
+ return getsizeof(obj);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public long getsizeof(Object obj) {
|
||||||
|
+ return RamUsageEstimator.shallowSizeOf(obj);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
public void setrecursionlimit(int recursionlimit) {
|
||||||
|
if (recursionlimit <= 0) {
|
||||||
|
throw Py.ValueError("Recursion limit must be positive");
|
||||||
|
diff --git a/src/org/python/modules/gc.java b/src/org/python/modules/gc.java
|
||||||
|
index 633621e..997a97a 100644
|
||||||
|
--- a/src/org/python/modules/gc.java
|
||||||
|
+++ b/src/org/python/modules/gc.java
|
||||||
|
@@ -2558,13 +2558,30 @@ public class gc {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
- * Not supported by Jython.
|
||||||
|
+ * Only works reliably if {@code monitorGlobal} is active, as it depends on
|
||||||
|
+ * monitored objects to search for referrers. It only finds referrers that
|
||||||
|
+ * properly implement the traverseproc mechanism (unless reflection-based
|
||||||
|
+ * traversion is activated and works stable).
|
||||||
|
* Throws {@link org.python.core.Py#NotImplementedError}.
|
||||||
|
*
|
||||||
|
* @throws org.python.core.Py.NotImplementedError
|
||||||
|
*/
|
||||||
|
public static PyObject get_objects() {
|
||||||
|
- throw Py.NotImplementedError("not applicable to Java GC");
|
||||||
|
+ if (!isMonitoring()) {
|
||||||
|
+ throw Py.NotImplementedError(
|
||||||
|
+ "not applicable in Jython if gc module is not monitoring PyObjects");
|
||||||
|
+ }
|
||||||
|
+ ArrayList<PyObject> resultList = new ArrayList<>(monitoredObjects.size());
|
||||||
|
+ synchronized (monitoredObjects) {
|
||||||
|
+ for (WeakReferenceGC src: monitoredObjects) {
|
||||||
|
+ PyObject obj = src.get();
|
||||||
|
+ if (isTraversable(obj)) {
|
||||||
|
+ resultList.add(obj);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ resultList.trimToSize();
|
||||||
|
+ return new PyList(resultList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
71
jython-use-rpm-wheels.patch
Normal file
71
jython-use-rpm-wheels.patch
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
diff --git a/Lib/ensurepip/__init__.py b/Lib/ensurepip/__init__.py
|
||||||
|
index 40ac49d..0c7245d 100644
|
||||||
|
--- a/Lib/ensurepip/__init__.py
|
||||||
|
+++ b/Lib/ensurepip/__init__.py
|
||||||
|
@@ -1,9 +1,10 @@
|
||||||
|
#!/usr/bin/env python2
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
|
+import distutils.version
|
||||||
|
+import glob
|
||||||
|
import os
|
||||||
|
import os.path
|
||||||
|
-import pkgutil
|
||||||
|
import shutil
|
||||||
|
import sys
|
||||||
|
import tempfile
|
||||||
|
@@ -11,10 +12,20 @@ import tempfile
|
||||||
|
|
||||||
|
__all__ = ["version", "bootstrap"]
|
||||||
|
|
||||||
|
+_WHEEL_DIR = "/usr/share/python-wheels/"
|
||||||
|
|
||||||
|
-_SETUPTOOLS_VERSION = "28.8.0"
|
||||||
|
|
||||||
|
-_PIP_VERSION = "9.0.1"
|
||||||
|
+def _get_most_recent_wheel_version(pkg):
|
||||||
|
+ prefix = os.path.join(_WHEEL_DIR, "{}-".format(pkg))
|
||||||
|
+ suffix = "-py2.py3-none-any.whl"
|
||||||
|
+ pattern = "{}*{}".format(prefix, suffix)
|
||||||
|
+ versions = (p[len(prefix):-len(suffix)] for p in glob.glob(pattern))
|
||||||
|
+ return str(max(versions, key=distutils.version.LooseVersion))
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+_SETUPTOOLS_VERSION = _get_most_recent_wheel_version("setuptools")
|
||||||
|
+
|
||||||
|
+_PIP_VERSION = _get_most_recent_wheel_version("pip")
|
||||||
|
|
||||||
|
# pip currently requires ssl support, so we try to provide a nicer
|
||||||
|
# error message when that is missing (http://bugs.python.org/issue19744)
|
||||||
|
@@ -42,8 +53,13 @@ def _run_pip(args, additional_paths=None):
|
||||||
|
sys.path = additional_paths + sys.path
|
||||||
|
|
||||||
|
# Install the bundled software
|
||||||
|
- import pip
|
||||||
|
- pip.main(args)
|
||||||
|
+ try:
|
||||||
|
+ # pip 10
|
||||||
|
+ from pip._internal import main
|
||||||
|
+ except ImportError:
|
||||||
|
+ # pip 9
|
||||||
|
+ from pip import main
|
||||||
|
+ main(args)
|
||||||
|
|
||||||
|
|
||||||
|
def version():
|
||||||
|
@@ -100,12 +116,9 @@ def bootstrap(root=None, upgrade=False, user=False,
|
||||||
|
additional_paths = []
|
||||||
|
for project, version in _PROJECTS:
|
||||||
|
wheel_name = "{}-{}-py2.py3-none-any.whl".format(project, version)
|
||||||
|
- whl = pkgutil.get_data(
|
||||||
|
- "ensurepip",
|
||||||
|
- "_bundled/{}".format(wheel_name),
|
||||||
|
- )
|
||||||
|
- with open(os.path.join(tmpdir, wheel_name), "wb") as fp:
|
||||||
|
- fp.write(whl)
|
||||||
|
+ with open(os.path.join(_WHEEL_DIR, wheel_name), "rb") as sfp:
|
||||||
|
+ with open(os.path.join(tmpdir, wheel_name), "wb") as fp:
|
||||||
|
+ fp.write(sfp.read())
|
||||||
|
|
||||||
|
additional_paths.append(os.path.join(tmpdir, wheel_name))
|
||||||
|
|
||||||
148
jython.spec
Normal file
148
jython.spec
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
%global scm_tag v2.7.1
|
||||||
|
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
|
||||||
|
Name: jython
|
||||||
|
Version: 2.7.1
|
||||||
|
Release: 1
|
||||||
|
Summary: A Java implementation of the Python language
|
||||||
|
License: ASL 1.1 and BSD
|
||||||
|
URL: http://www.jython.org/
|
||||||
|
%bcond_without rpmwheels
|
||||||
|
Source0: https://github.com/jython/jython/archive/%{scm_tag}.tar.gz
|
||||||
|
Patch0: jython-cachedir.patch
|
||||||
|
Patch1: jython-dont-validate-pom.patch
|
||||||
|
Patch2: jython-no-carrotsearch-sizeof.patch
|
||||||
|
Patch3: jython-launcher.patch
|
||||||
|
Patch4: jython-fix-multiprocessing.patch
|
||||||
|
Patch5: jython-fix-tty-detection.patch
|
||||||
|
Patch189: jython-use-rpm-wheels.patch
|
||||||
|
Requires: antlr32-java apache-commons-compress bouncycastle bouncycastle-pkix guava
|
||||||
|
Requires: objectweb-asm jctools >= 2.0.2 jnr-constants jnr-ffi jnr-netdb jnr-posix jffi
|
||||||
|
Requires: jffi-native jline jansi icu4j netty >= 4.1.13 xerces-j2
|
||||||
|
BuildRequires: javapackages-local ant ant-junit glassfish-servlet-api antlr32-tool
|
||||||
|
BuildRequires: apache-commons-compress bouncycastle guava objectweb-asm
|
||||||
|
BuildRequires: jctools >= 2.0.2 jnr-constants jnr-ffi jnr-netdb jnr-posix jffi jffi-native
|
||||||
|
BuildRequires: jline jansi icu4j netty >= 4.1.13 xerces-j2
|
||||||
|
%if %{with rpmwheels}
|
||||||
|
BuildRequires: python-setuptools-wheel python-pip-wheel
|
||||||
|
Requires: python-setuptools-wheel python-pip-wheel
|
||||||
|
%else
|
||||||
|
Provides: bundled(python2-pip) = 9.0.1
|
||||||
|
Provides: bundled(python2-setuptools) = 28.8.0
|
||||||
|
%endif
|
||||||
|
BuildArch: noarch
|
||||||
|
%description
|
||||||
|
Jython is an implementation of the high-level, dynamic, object-oriented
|
||||||
|
language Python seamlessly integrated with the Java platform. The
|
||||||
|
predecessor to Jython, JPython, is certified as 100% Pure Java. Jython is
|
||||||
|
freely available for both commercial and non-commercial use and is
|
||||||
|
distributed with source code. Jython is complementary to Java and is
|
||||||
|
especially suited for the following tasks: Embedded scripting - Java
|
||||||
|
programmers can add the Jython libraries to their system to allow end
|
||||||
|
users to write simple or complicated scripts that add functionality to the
|
||||||
|
application. Interactive experimentation - Jython provides an interactive
|
||||||
|
interpreter that can be used to interact with Java packages or with
|
||||||
|
running Java applications. This allows programmers to experiment and debug
|
||||||
|
any Java system using Jython. Rapid application development - Python
|
||||||
|
programs are typically 2-10X shorter than the equivalent Java program.
|
||||||
|
This translates directly to increased programmer productivity. The
|
||||||
|
seamless interaction between Python and Java allows developers to freely
|
||||||
|
mix the two languages both during development and in shipping products.
|
||||||
|
|
||||||
|
%package javadoc
|
||||||
|
Summary: Javadoc for %{name}
|
||||||
|
Obsoletes: %{name}-manual = %{version}-%{release}
|
||||||
|
Provides: %{name}-manual < %{version}-%{release}
|
||||||
|
%description javadoc
|
||||||
|
API documentation for %{name}.
|
||||||
|
|
||||||
|
%package demo
|
||||||
|
Summary: Demo for %{name}
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
%description demo
|
||||||
|
Demonstrations and samples for %{name}.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -q -n jython-%{version}
|
||||||
|
%patch2 -R -p1
|
||||||
|
%patch0
|
||||||
|
%patch1
|
||||||
|
#%patch3
|
||||||
|
%patch4 -p1
|
||||||
|
%patch5
|
||||||
|
|
||||||
|
find . -type f -a -name *.jar -delete
|
||||||
|
find . -type f -a -name *.exe -delete
|
||||||
|
find . -type f -a -name *.dll -delete
|
||||||
|
%if %{with rpmwheels}
|
||||||
|
%patch189 -p1
|
||||||
|
rm Lib/ensurepip/_bundled/*.whl
|
||||||
|
rmdir Lib/ensurepip/_bundled
|
||||||
|
%endif
|
||||||
|
rm -rf extlibs/*
|
||||||
|
sed -i -e '/<javadoc/a additionalparam="-Xdoclint:none"' build.xml
|
||||||
|
sed -i -e 's/CharMatcher\.ascii()/CharMatcher.ASCII/' \
|
||||||
|
src/org/python/core/PyUnicode.java \
|
||||||
|
src/org/python/core/PyBaseCode.java \
|
||||||
|
src/org/python/core/Py.java
|
||||||
|
|
||||||
|
%build
|
||||||
|
build-jar-repository -p -s extlibs \
|
||||||
|
antlr32/antlr antlr32/antlr-runtime stringtemplate antlr \
|
||||||
|
jffi jffi-native jnr-constants jnr-ffi jnr-netdb jnr-posix jline/jline jansi/jansi icu4j/icu4j \
|
||||||
|
glassfish-servlet-api guava objectweb-asm/asm objectweb-asm/asm-commons objectweb-asm/asm-util \
|
||||||
|
commons-compress junit hamcrest/core
|
||||||
|
ant \
|
||||||
|
-Djython.dev.jar=jython.jar \
|
||||||
|
-Dhas.repositories.connection=false \
|
||||||
|
javatest javadoc
|
||||||
|
find dist -type f -name '*.py' | xargs sed -i "s:#!\s*/usr.*::"
|
||||||
|
pushd maven
|
||||||
|
ant -Dproject.version=%{version} install
|
||||||
|
popd
|
||||||
|
rm dist/javalib/*.jar
|
||||||
|
build-jar-repository -p -s dist/javalib antlr32/antlr-runtime-3.2 \
|
||||||
|
objectweb-asm/asm objectweb-asm/asm-commons objectweb-asm/asm-util guava icu4j/icu4j \
|
||||||
|
jffi jffi-native jnr-constants jnr-ffi jnr-netdb jnr-posix jline/jline jansi/jansi \
|
||||||
|
netty/netty-buffer netty/netty-codec netty/netty-common netty/netty-handler netty/netty-resolver netty/netty-transport \
|
||||||
|
jctools/jctools-core apache-commons-compress bcprov bcpkix xerces-j2
|
||||||
|
%mvn_artifact build/maven/jython-%{version}.pom dist/jython.jar
|
||||||
|
%mvn_alias org.python:jython org.python:jython-standalone
|
||||||
|
|
||||||
|
%install
|
||||||
|
%mvn_install -J dist/Doc/javadoc
|
||||||
|
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/%{name}
|
||||||
|
ln -s %{_javadir}/%{name}/jython.jar $RPM_BUILD_ROOT%{_datadir}/%{name}
|
||||||
|
cp -pr dist/javalib $RPM_BUILD_ROOT%{_datadir}/%{name}
|
||||||
|
rm dist/bin/jython_regrtest.bat
|
||||||
|
cp -pr dist/bin $RPM_BUILD_ROOT%{_datadir}/%{name}
|
||||||
|
install -m 644 dist/registry $RPM_BUILD_ROOT%{_datadir}/%{name}
|
||||||
|
rm -rf dist/Lib/{distutils/tests,email/test,json/tests,test,unittest/test}
|
||||||
|
cp -pr dist/Lib $RPM_BUILD_ROOT%{_datadir}/%{name}
|
||||||
|
cp -pr Demo $RPM_BUILD_ROOT%{_datadir}/%{name}
|
||||||
|
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/%{name}/Doc
|
||||||
|
ln -s %{_javadocdir}/%{name} $RPM_BUILD_ROOT%{_datadir}/%{name}/Doc/javadoc
|
||||||
|
install -d $RPM_BUILD_ROOT%{_bindir}
|
||||||
|
ln -s %{_datadir}/%{name}/bin/jython $RPM_BUILD_ROOT%{_bindir}
|
||||||
|
|
||||||
|
%files -f .mfiles
|
||||||
|
%doc ACKNOWLEDGMENTS NEWS README.txt
|
||||||
|
%license LICENSE.txt
|
||||||
|
%attr(0755,root,root) %{_bindir}/%{name}
|
||||||
|
%dir %{_datadir}/%{name}
|
||||||
|
%{_datadir}/%{name}/bin
|
||||||
|
%{_datadir}/%{name}/javalib
|
||||||
|
%{_datadir}/%{name}/jython.jar
|
||||||
|
%{_datadir}/%{name}/Lib
|
||||||
|
%{_datadir}/%{name}/registry
|
||||||
|
|
||||||
|
%files javadoc -f .mfiles-javadoc
|
||||||
|
%license LICENSE.txt
|
||||||
|
%{_datadir}/%{name}/Doc
|
||||||
|
|
||||||
|
%files demo
|
||||||
|
%license LICENSE.txt
|
||||||
|
%{_datadir}/%{name}/Demo
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Mon Aug 3 2020 yanan li <liyanan032@huawei.com> - 2.7.1-1
|
||||||
|
- Package init
|
||||||
5
jython.yaml
Normal file
5
jython.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
git_url: https://github.com/jython/jython.git
|
||||||
|
version_control: github
|
||||||
|
src_repo: jython/jython
|
||||||
|
tag_prefix: "^v"
|
||||||
|
seperator: "."
|
||||||
BIN
v2.7.1.tar.gz
Normal file
BIN
v2.7.1.tar.gz
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user