[Checkins] SVN: zc.catalog/trunk/ Make zc.catalog into a
zc.buildout package. Update the stemmer information.
Gary Poster
gary at zope.com
Wed Jan 3 18:14:17 EST 2007
Log message for revision 71705:
Make zc.catalog into a zc.buildout package. Update the stemmer information.
Changed:
_U zc.catalog/trunk/
A zc.catalog/trunk/bootstrap.py
A zc.catalog/trunk/buildout.cfg
U zc.catalog/trunk/setup.py
U zc.catalog/trunk/src/zc/catalog/stemmer.py
U zc.catalog/trunk/src/zc/catalog/stemmer.txt
U zc.catalog/trunk/src/zc/catalog/tests.py
-=-
Property changes on: zc.catalog/trunk
___________________________________________________________________
Name: svn:ignore
+ develop-eggs
bin
parts
.installed.cfg
Added: zc.catalog/trunk/bootstrap.py
===================================================================
--- zc.catalog/trunk/bootstrap.py 2007-01-03 18:08:36 UTC (rev 71704)
+++ zc.catalog/trunk/bootstrap.py 2007-01-03 23:14:16 UTC (rev 71705)
@@ -0,0 +1,52 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Bootstrap a buildout-based project
+
+Simply run this script in a directory containing a buildout.cfg.
+The script accepts buildout command-line options, so you can
+use the -c option to specify an alternate configuration file.
+
+$Id: bootstrap.py 69908 2006-08-31 21:53:00Z jim $
+"""
+
+import os, shutil, sys, tempfile, urllib2
+
+tmpeggs = tempfile.mkdtemp()
+
+ez = {}
+exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
+ ).read() in ez
+ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
+
+import pkg_resources
+
+cmd = 'from setuptools.command.easy_install import main; main()'
+if sys.platform == 'win32':
+ cmd = '"%s"' % cmd # work around spawn lamosity on windows
+
+ws = pkg_resources.working_set
+assert os.spawnle(
+ os.P_WAIT, sys.executable, sys.executable,
+ '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout',
+ dict(os.environ,
+ PYTHONPATH=
+ ws.find(pkg_resources.Requirement.parse('setuptools')).location
+ ),
+ ) == 0
+
+ws.add_entry(tmpeggs)
+ws.require('zc.buildout')
+import zc.buildout.buildout
+zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap'])
+shutil.rmtree(tmpeggs)
Added: zc.catalog/trunk/buildout.cfg
===================================================================
--- zc.catalog/trunk/buildout.cfg 2007-01-03 18:08:36 UTC (rev 71704)
+++ zc.catalog/trunk/buildout.cfg 2007-01-03 23:14:16 UTC (rev 71705)
@@ -0,0 +1,15 @@
+[buildout]
+develop = .
+parts = zope3 test
+
+find-links = http://download.zope.org/distribution/
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = zc.catalog
+extra-paths = parts/zope3/src
+
+[zope3]
+recipe = zc.recipe.zope3checkout
+url = svn://svn.zope.org/repos/main/Zope3/branches/3.3
+
Property changes on: zc.catalog/trunk/buildout.cfg
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: zc.catalog/trunk/setup.py
===================================================================
--- zc.catalog/trunk/setup.py 2007-01-03 18:08:36 UTC (rev 71704)
+++ zc.catalog/trunk/setup.py 2007-01-03 23:14:16 UTC (rev 71705)
@@ -3,7 +3,7 @@
setup(
name="zc.catalog",
- version="0.2",
+ version="1.0",
packages=find_packages('src', exclude=["*.tests", "*.ftests"]),
package_dir= {'':'src'},
Modified: zc.catalog/trunk/src/zc/catalog/stemmer.py
===================================================================
--- zc.catalog/trunk/src/zc/catalog/stemmer.py 2007-01-03 18:08:36 UTC (rev 71704)
+++ zc.catalog/trunk/src/zc/catalog/stemmer.py 2007-01-03 23:14:16 UTC (rev 71705)
@@ -16,15 +16,18 @@
$Id: stemmer.py 2918 2005-07-19 22:12:38Z jim $
"""
import re
-
+broken = None
try:
- import txngstemmer
+ from zopyx.txng3 import stemmer
except ImportError:
- txngstemmer = None
- class Broken:
- def stem(self, l):
- return l
- broken = Broken()
+ try:
+ import txngstemmer as stemmer
+ except ImportError:
+ stemmer = None
+ class Broken:
+ def stem(self, l):
+ return l
+ broken = Broken()
# as of this writing, trying to persist a txngstemmer.Stemmer makes the python
# process end, only printing a "Bus error" message before quitting. Don't do
@@ -37,9 +40,9 @@
@property
def stemmer(self):
- if txngstemmer is None:
+ if stemmer is None:
return broken
- return txngstemmer.Stemmer(self.language)
+ return stemmer.Stemmer(self.language)
rxGlob = re.compile(r"[*?]") # See globToWordIds() in
# zope/index/text/lexicon.py
Modified: zc.catalog/trunk/src/zc/catalog/stemmer.txt
===================================================================
--- zc.catalog/trunk/src/zc/catalog/stemmer.txt 2007-01-03 18:08:36 UTC (rev 71704)
+++ zc.catalog/trunk/src/zc/catalog/stemmer.txt 2007-01-03 23:14:16 UTC (rev 71705)
@@ -8,6 +8,16 @@
been compiled and installed in your Python installation. Inclusion of the
textindexng package is not necessary.
+As of this writing (Jan 3, 2007), installing the necessary extensions can be
+done with the following steps:
+
+- `svn co https://svn.sourceforge.net/svnroot/textindexng/extension_modules/trunk ext_mod`
+- `cd ext_mod`
+- (using the python you use for Zope) `python setup.py install`
+
+Another approach is to simply install TextIndexNG (see
+http://opensource.zopyx.com/software/textindexng3)
+
The stemmer must be instantiated with the language for which stemming is
desired. It defaults to 'english'. For what it is worth, other languages
supported as of this writing, using the strings that the stemmer expects,
Modified: zc.catalog/trunk/src/zc/catalog/tests.py
===================================================================
--- zc.catalog/trunk/src/zc/catalog/tests.py 2007-01-03 18:08:36 UTC (rev 71704)
+++ zc.catalog/trunk/src/zc/catalog/tests.py 2007-01-03 23:14:16 UTC (rev 71705)
@@ -20,14 +20,17 @@
from zope.testing import doctest
def test_suite():
- return unittest.TestSuite((
+ tests = unittest.TestSuite((
doctest.DocFileSuite('extentcatalog.txt'),
doctest.DocFileSuite('setindex.txt'),
doctest.DocFileSuite('valueindex.txt'),
doctest.DocFileSuite('normalizedindex.txt'),
doctest.DocFileSuite('globber.txt'),
- doctest.DocFileSuite('stemmer.txt'),
))
+ import zc.catalog.stemmer
+ if not zc.catalog.stemmer.broken:
+ tests.addTest(doctest.DocFileSuite('stemmer.txt'))
+ return tests
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
More information about the Checkins
mailing list