From eb7ad9bc13003f260024aa407e59df4e1e72f37e Mon Sep 17 00:00:00 2001 From: Martin Langhoff Date: Thu, 04 Nov 2010 14:47:30 +0000 Subject: Merge commit 'origin/0.84' --- diff --git a/_wp.so b/_wp.so index cfdc0d7..2cd3c2c 100755 --- a/_wp.so +++ b/_wp.so Binary files differ diff --git a/activity.py b/activity.py index 951670d..ce7c988 100644 --- a/activity.py +++ b/activity.py @@ -20,10 +20,11 @@ import os import sys import server -from sugar.activity import registry -activity_info = registry.get_registry().get_activity('org.laptop.WebActivity') +#from sugar.activity import registry +#activity_info = registry.get_registry().get_activity('org.laptop.WebActivity') -sys.path.append(activity_info.path) +#sys.path.append(activity_info.path) +sys.path.append("/home/olpc/Activities/Browse.activity") import webactivity from searchtoolbar import SearchToolbar diff --git a/activity/activity.info b/activity/activity.info index 1a1e443..d7d9adf 100644 --- a/activity/activity.info +++ b/activity/activity.info @@ -1,6 +1,6 @@ [Activity] name = Wikipedia -activity_version = 10 +activity_version = 20 service_name = org.laptop.WikipediaActivity icon = activity-wikipedia exec = sugar-activity activity.WikipediaActivity diff --git a/bin/tidy.conf b/bin/tidy.conf index 5260577..bad0232 100644 --- a/bin/tidy.conf +++ b/bin/tidy.conf @@ -4,4 +4,4 @@ new-inline-tags: cfif, cfelse, math, mroot, mprescripts, mtable, mtr, mtd, mth, mspace, merror, mstyle, blahtex, mathml, markup, new-blocklevel-tags: cfoutput, cfquery - +show-warnings: no diff --git a/mwlib/_expander.so b/mwlib/_expander.so index be09917..a7f3791 100755 --- a/mwlib/_expander.so +++ b/mwlib/_expander.so Binary files differ diff --git a/mwlib/_mwscan.so b/mwlib/_mwscan.so index 50feae0..44948e7 100755 --- a/mwlib/_mwscan.so +++ b/mwlib/_mwscan.so Binary files differ diff --git a/server.py b/server.py index d95efd2..406d45b 100755 --- a/server.py +++ b/server.py @@ -25,11 +25,13 @@ from __future__ import with_statement import sys import os import subprocess +import select import codecs from StringIO import StringIO import BaseHTTPServer from SimpleHTTPServer import SimpleHTTPRequestHandler import cgi +import errno import urllib import tempfile import re @@ -47,6 +49,29 @@ except ImportError: import mwlib.htmlwriter from mwlib import parser, scanner, expander +class MyHTTPServer(BaseHTTPServer.HTTPServer): + def serve_forever(self, poll_interval=0.5): + """Overridden version of BaseServer.serve_forever that does not fail + to work when EINTR is received. + """ + self._BaseServer__serving = True + self._BaseServer__is_shut_down.clear() + while self._BaseServer__serving: + # XXX: Consider using another file descriptor or + # connecting to the socket to wake this up instead of + # polling. Polling reduces our responsiveness to a + # shutdown request and wastes cpu at all other times. + try: + r, w, e = select.select([self], [], [], poll_interval) + except select.error, e: + if e[0] == errno.EINTR: + print "got eintr" + continue + raise + if r: + self._handle_request_noblock() + self._BaseServer__is_shut_down.set() + class LinkStats: allhits = 1 alltotal = 1 @@ -751,7 +776,7 @@ def run_server(confvars): print "Error setting up directories:" print "%s must be a writable directory" % confvars['editdir'] - httpd = BaseHTTPServer.HTTPServer(('', confvars['port']), + httpd = MyHTTPServer(('', confvars['port']), lambda *args: WikiRequestHandler(index, confvars, *args)) if __name__ == '__main__': diff --git a/setup.py-mwlib b/setup.py-mwlib new file mode 100755 index 0000000..8d6a55c --- /dev/null +++ b/setup.py-mwlib @@ -0,0 +1,71 @@ +#! /usr/bin/env python + +# Copyright (c) 2007-2008 PediaPress GmbH +# See README.txt for additional licensing information. + +import sys +import os + +try: + from setuptools import setup +except ImportError: + import ez_setup + ez_setup.use_setuptools(version="0.6c1") + +from setuptools import setup, Extension +import distutils.util + + +install_requires=["simplejson>=1.3", "pyparsing>=1.4.11"] +if sys.version_info[:2] < (2,5): + install_requires.append("wsgiref>=0.1.2") + +execfile(distutils.util.convert_path('mwlib/_version.py')) +# adds 'version' to local namespace + +# we will *not* add support for automatic generation of those files as that +# might break with source distributions from pypi + +if not os.path.exists(distutils.util.convert_path('mwlib/_mwscan.cc')): + print "Error: please install re2c from http://re2c.org/ and run make" + sys.exit(10) + +def mtime(fn): + return os.stat(distutils.util.convert_path(fn)).st_mtime + +if mtime("mwlib/_mwscan.cc") < mtime("mwlib/_mwscan.re"): + print "Warning: _mwscan.cc is older than _mwscan.re. please run make.\n" + import time + time.sleep(2) + + +def read_long_description(): + fn = os.path.join(os.path.dirname(os.path.abspath(__file__)), "README.txt") + return open(fn).read() + +setup( + name="mwlib", + version=str(version), + entry_points = dict(console_scripts=['mw-buildcdb = mwlib.apps:buildcdb', + 'mw-zip = mwlib.apps:buildzip', + 'mw-parse = mwlib.apps:parse', + 'mw-show = mwlib.apps:show', + 'mw-html = mwlib.apps:html', + 'mw-serve = mwlib.apps:serve', + ]), + install_requires=install_requires, + ext_modules = [Extension("mwlib._mwscan", ["mwlib/_mwscan.cc"]), + Extension("mwlib._expander", ["mwlib/_expander.cc"]), + ], + + packages=["mwlib", "mwlib.resources"], + namespace_packages=['mwlib'], + include_package_data = True, + zip_safe = False, + url = "http://code.pediapress.com/", + description="mediawiki parser and utility library", + license="BSD License", + maintainer="pediapress.com", + maintainer_email="info@pediapress.com", + long_description = read_long_description() +) diff --git a/woip/c/debug.h b/woip/c/debug.h index efc871a..78d1740 100644 --- a/woip/c/debug.h +++ b/woip/c/debug.h @@ -23,7 +23,7 @@ #error I want GNU C plz #endif -#ifdef DEBUG +#if 0 static bool debug = true; #else static bool debug = false; diff --git a/woip/c/indexer.c b/woip/c/indexer.c index efda166..015b0da 100644 --- a/woip/c/indexer.c +++ b/woip/c/indexer.c @@ -27,7 +27,7 @@ void insert(struct node *node, char *str, uint32_t block) { insert(NODE(NEXT_NODE(node, cmp)), str, block); } else if(!(cmp == 0 && !str[1])) { /* unless at end of string, and all matches */ - NEXT_NODE(node, cmp) = ++storepos; + //NEXT_NODE(node, cmp) = ++storepos; insert(NODE(storepos), cmp ? str : str + 1, block); } else { node->block = BLOCK_MASK(block); -- cgit v0.9.1