You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pylucene-commits@lucene.apache.org by va...@apache.org on 2017/03/20 08:29:22 UTC
svn commit: r1787691 - in /lucene/pylucene/trunk: Makefile jcc/CHANGES
jcc/helpers3/linux.py jcc/jcc3/python.py jcc/setup.py
test3/test_PositionIncrement.py
Author: vajda
Date: Mon Mar 20 08:29:22 2017
New Revision: 1787691
URL: http://svn.apache.org/viewvc?rev=1787691&view=rev
Log:
Reduced python3 version requirement to 3.3+.
Got jcc with python3 to work on Linux too.
Modified:
lucene/pylucene/trunk/Makefile
lucene/pylucene/trunk/jcc/CHANGES
lucene/pylucene/trunk/jcc/helpers3/linux.py
lucene/pylucene/trunk/jcc/jcc3/python.py
lucene/pylucene/trunk/jcc/setup.py
lucene/pylucene/trunk/test3/test_PositionIncrement.py
Modified: lucene/pylucene/trunk/Makefile
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/Makefile?rev=1787691&r1=1787690&r2=1787691&view=diff
==============================================================================
--- lucene/pylucene/trunk/Makefile (original)
+++ lucene/pylucene/trunk/Makefile Mon Mar 20 08:29:22 2017
@@ -57,18 +57,20 @@ LUCENE=$(LUCENE_SRC)/lucene
#JCC=$(PYTHON) -m jcc.__main__ --shared --arch x86_64
#NUM_FILES=8
-# Mac OS X 10.5 (32-bit Python 2.5, Java 1.5)
+# Mac OS X (Python 2.3.5, Java 1.5, setuptools 0.6c7, Intel Mac OS X 10.4)
#PREFIX_PYTHON=/usr
#ANT=ant
#PYTHON=$(PREFIX_PYTHON)/bin/python
-#JCC=$(PYTHON) -m jcc --shared
+#JCC=$(PYTHON) /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/JCC-2.3-py2.3-macosx-10.4-i386.egg/jcc/__init__.py
#NUM_FILES=8
-# Mac OS X (Python 2.3.5, Java 1.5, setuptools 0.6c7, Intel Mac OS X 10.4)
+# Linux (Debian Jessie 64-bit, Python 3.4.2, Oracle Java 1.8
+# Be sure to also set JDK['linux'] in jcc's setup.py to the JAVA_HOME value
+# used below for ANT (and rebuild jcc after changing it).
#PREFIX_PYTHON=/usr
-#ANT=ant
-#PYTHON=$(PREFIX_PYTHON)/bin/python
-#JCC=$(PYTHON) /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/JCC-2.3-py2.3-macosx-10.4-i386.egg/jcc/__init__.py
+#ANT=JAVA_HOME=/usr/lib/jvm/java-8-oracle /usr/bin/ant
+#PYTHON=$(PREFIX_PYTHON)/bin/python3
+#JCC=$(PYTHON) -m jcc --shared
#NUM_FILES=8
# Linux (Debian Jessie 64-bit, Python 2.7.9, Oracle Java 1.8
Modified: lucene/pylucene/trunk/jcc/CHANGES
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/CHANGES?rev=1787691&r1=1787690&r2=1787691&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/CHANGES (original)
+++ lucene/pylucene/trunk/jcc/CHANGES Mon Mar 20 08:29:22 2017
@@ -1,6 +1,6 @@
Version 2.23 -> 3.0
-------------------
- - added support for Python 3.6 (with R�diger Meier and Thomas Koch)
+ - added support for Python 3 (3.3+) (with R�diger Meier and Thomas Koch)
- python3: fixed bugs with surrogate pairs (now supported for the first time)
-
Modified: lucene/pylucene/trunk/jcc/helpers3/linux.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/helpers3/linux.py?rev=1787691&r1=1787690&r2=1787691&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/helpers3/linux.py (original)
+++ lucene/pylucene/trunk/jcc/helpers3/linux.py Mon Mar 20 08:29:22 2017
@@ -24,8 +24,9 @@ def patch_setuptools(with_setuptools):
from setuptools.command.build_ext import sh_link_shared_object
enable_shared = True # jcc/patches/patch.43 was applied
except ImportError:
- jccdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
- st_egg = os.path.dirname(setuptools.__path__[0])
+ # patch build_ext so that it doesn't mess with a Library's extension
+ from setuptools.command.build_ext import build_ext as _build_ext
+ from setuptools.extension import Library
setuptools.Library = LinuxLibrary
extension.Library = LinuxLibrary
@@ -39,7 +40,7 @@ def patch_setuptools(with_setuptools):
build_ext.libtype = 'static'
build_ext.link_shared_object = st_link_shared_object
- print("Applied shared mode monkey patch to:", setuptools, file=sys.stderr)
+ print("Applied shared mode monkeypatch to:", setuptools, file=sys.stderr)
return True # monkey patch was applied
return enable_shared
@@ -58,6 +59,7 @@ class LinuxBuildExt(build_ext.build_ext)
if fullname in self.ext_map:
ext = self.ext_map[fullname]
if isinstance(ext, _Library):
+ filename = '%s.so' %(fullname)
if ext.force_shared and not build_ext.use_stubs:
libtype = 'shared'
else:
Modified: lucene/pylucene/trunk/jcc/jcc3/python.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc3/python.py?rev=1787691&r1=1787690&r2=1787691&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc3/python.py (original)
+++ lucene/pylucene/trunk/jcc/jcc3/python.py Mon Mar 20 08:29:22 2017
@@ -1838,7 +1838,7 @@ def compile(env, jccPath, output, module
args['extra_link_args'] += ['-Wl,-rpath', shlibdir]
args['library_dirs'] = [shlibdir]
args['libraries'] = ['jcc3']
- elif sys.platform == 'linux2': # distutils no good with -R
+ elif sys.platform = 'linux': # distutils no good with -R
args['extra_link_args'] += ['-Wl,-rpath', shlibdir]
args['library_dirs'] = [shlibdir]
args['libraries'] = ['jcc3']
Modified: lucene/pylucene/trunk/jcc/setup.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/setup.py?rev=1787691&r1=1787690&r2=1787691&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/setup.py (original)
+++ lucene/pylucene/trunk/jcc/setup.py Mon Mar 20 08:29:22 2017
@@ -16,9 +16,9 @@ jcc_ver = '3.0'
machine = platform.machine()
using_python2 = sys.version_info < (3,)
-if not using_python2 and sys.version_info < (3, 5):
+if not using_python2 and sys.version_info < (3, 3):
raise RuntimeError('''
-Python 3 is supported from version 3.5, you are running version %s.%s'''
+Python 3 is supported from version 3.3, you are running version %s.%s'''
%(sys.version_info.major, sys.version_info.minor))
if machine.startswith("iPod") or machine.startswith("iPhone"):
Modified: lucene/pylucene/trunk/test3/test_PositionIncrement.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/test3/test_PositionIncrement.py?rev=1787691&r1=1787690&r2=1787691&view=diff
==============================================================================
--- lucene/pylucene/trunk/test3/test_PositionIncrement.py (original)
+++ lucene/pylucene/trunk/test3/test_PositionIncrement.py Mon Mar 20 08:29:22 2017
@@ -281,8 +281,8 @@ class PayloadFilter(PythonTokenFilter):
def incrementToken(self):
if self.input.incrementToken():
- bytes = JArray('byte')(b"pos: %d" %(self.pos))
- self.payloadAttr.setPayload(BytesRef(bytes))
+ data = JArray('byte')(bytes("pos: %d" %(self.pos), "utf-8"))
+ self.payloadAttr.setPayload(BytesRef(data))
if self.pos == 0 or self.i % 2 == 1:
posIncr = 1