Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Mar 2003 11:10:29 +0800 (CST)
From:      thinker@branda.to
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/50230: grail don't work with Python 2.x.
Message-ID:  <200303240310.h2O3AT9E042063@esp.branda.to>

next in thread | raw e-mail | index | archive | help

>Number:         50230
>Category:       ports
>Synopsis:       grail don't work with Python 2.x.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 23 19:20:02 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     thinker@branda.to
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
http://netlab.cse.yzu.edu.tw/
>Environment:
System: FreeBSD esp.branda.to 5.0-CURRENT FreeBSD 5.0-CURRENT #3: Sun Jan 5 04:01:59 CST 2003 thinker@esp.branda.to:/usr/src/sys/i386/compile/esp i386


	
>Description:
	Grail 0.6 is not updated, since May 2000. It could not work with
	Python 2.x, but work well with Python 1.x. The problem is caused
	by changes of Python's libraries.

>How-To-Repeat:
	execute grail with Python 2.x.
>Fix:

	apply patch.
	

--- patches begins here ---
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	patch-ab
#	patch-ac
#
echo x - patch-ab
sed 's/^X//' >patch-ab << 'END-of-patch-ab'
X--- grailbase/app.py.orig	Wed Mar 24 23:11:52 1999
X+++ grailbase/app.py	Mon Mar 24 10:48:37 2003
X@@ -3,10 +3,10 @@
X 
X import os
X import mimetypes
X-import regex
X+import re
X import string
X import utils
X-
X+regex = re
X 
X class Application:
X     def __init__(self, prefs=None):
X@@ -51,7 +51,7 @@
X 
X 
X     __data_scheme_re = regex.compile(
X-        "data:\([^,;]*\)\(;\([^,]*\)\|\),", regex.casefold)
X+        "data:\([^,;]*\)\(;\([^,]*\)\|\),")
X 
X     def guess_type(self, url):
X         """Guess the type of a file based on its URL.
END-of-patch-ab
echo x - patch-ac
sed 's/^X//' >patch-ac << 'END-of-patch-ac'
X--- protocols/httpAPI.py.orig	Sat Mar  6 06:05:19 1999
X+++ protocols/httpAPI.py	Mon Mar 24 10:47:50 2003
X@@ -52,9 +52,14 @@
X 
X class MyHTTP(httplib.HTTP):
X 
X+    def __init__(self, host='', port=None, strict=None):
X+	httplib.HTTP.__init__(self, host, port, strict)
X+	self.putrequest_bk = self.putrequest
X+	self.putrequest = lambda r,s: MyHTTP.putrequest(self, r, s)
X+
X     def putrequest(self, request, selector):
X         self.selector = selector
X-        httplib.HTTP.putrequest(self, request, selector)
X+        self.putrequest_bk(request, selector)
X 
X     def getreply(self, file):
X         self.file = file
X@@ -81,14 +86,14 @@
X     def close(self):
X         if self.file:
X             self.file.close()
X-        if self.sock:
X+        if self._conn.sock:
X             try:
X-                self.sock.close()
X+                self._conn.sock.close()
X             except socket.error:
X                 # What can you do? :-)
X                 pass
X         self.file = None
X-        self.sock = None
X+        self._conn.sock = None
X 
X 
X class http_access:
X@@ -168,7 +173,7 @@
X     def pollmeta(self, timeout=0):
X         Assert(self.state == META)
X 
X-        sock = self.h.sock
X+        sock = self.h._conn.sock
X         try:
X             if not select.select([sock], [], [], timeout)[0]:
X                 return "waiting for server response", 0
X@@ -222,7 +227,7 @@
X             self.readahead = self.readahead[maxbytes:]
X             return data
X         try:
X-            data = self.h.sock.recv(maxbytes)
X+            data = self.h._conn.sock.recv(maxbytes)
X         except socket.error, msg:
X             raise IOError, msg, sys.exc_traceback
X         if not data:
X@@ -231,7 +236,7 @@
X         return data
X 
X     def fileno(self):
X-        return self.h.sock.fileno()
X+        return self.h._conn.sock.fileno()
X 
X 
X # To test this, use ProtocolAPI.test()
END-of-patch-ac
exit

--- patches ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200303240310.h2O3AT9E042063>