From 8f34ac6daf876be8dc5cd5d1ca8591396228702f Mon Sep 17 00:00:00 2001 From: perky Date: Wed, 19 Nov 2003 09:36:42 +0000 Subject: Port to Python 2.x (up to 2.2 yet) PR: 50230 Submitted by: thinker@branda.to --- www/grail/Makefile | 11 ++++----- www/grail/files/grail | 2 +- www/grail/files/patch-ab | 24 ++++++++++++++++++ www/grail/files/patch-ac | 63 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 93 insertions(+), 7 deletions(-) create mode 100644 www/grail/files/patch-ab create mode 100644 www/grail/files/patch-ac (limited to 'www/grail') diff --git a/www/grail/Makefile b/www/grail/Makefile index 09b13f1a5613..42fa48e9d186 100644 --- a/www/grail/Makefile +++ b/www/grail/Makefile @@ -7,20 +7,18 @@ PORTNAME= grail PORTVERSION= 0.6 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= www python MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR=grail EXTRACT_SUFX= .tgz -MAINTAINER= ports@freebsd.org +MAINTAINER= ports@FreeBSD.org COMMENT= An extensible Internet browser written entirely in Python RUN_DEPENDS= ${PYTHON_SITELIBDIR}/_tkinter.so:${PORTSDIR}/x11-toolkits/py-tkinter -IGNORE= "Doesn\'t seem to work with Python 2.x" - -USE_PYTHON= yes +USE_PYTHON= -2.2 GRAILSUBDIR= share/grail GRAILDIR= ${PREFIX}/${GRAILSUBDIR} DIRS_CMD= ${SED} -e '/^@dirrm/bok' -e 'D' -e ':ok' -e 's,@dirrm ,,' < ${PLIST} @@ -43,7 +41,8 @@ do-install: ${INSTALL_DATA} ${WRKSRC}/$$file ${GRAILDIR}/$$file; \ done @${ECHO_MSG} === Installing grail script... - @${SED} 's,%%GRAILDIR%%,${GRAILDIR},g' <${FILESDIR}/grail > \ + @${SED} -e 's,%%GRAILDIR%%,${GRAILDIR},g' \ + -e 's,%%PYTHON_CMD%%,${PYTHON_CMD},g' <${FILESDIR}/grail > \ ${WRKDIR}/grail.tmp @${INSTALL_SCRIPT} ${WRKDIR}/grail.tmp ${PREFIX}/bin/grail @${RM} ${WRKDIR}/grail.tmp diff --git a/www/grail/files/grail b/www/grail/files/grail index a5d15c492798..5d6569cda1b7 100644 --- a/www/grail/files/grail +++ b/www/grail/files/grail @@ -1,2 +1,2 @@ #!/bin/sh -exec python %%GRAILDIR%%/grail.py ${1+"$@"} +exec %%PYTHON_CMD%% %%GRAILDIR%%/grail.py ${1+"$@"} diff --git a/www/grail/files/patch-ab b/www/grail/files/patch-ab new file mode 100644 index 000000000000..0aa59d7cac8d --- /dev/null +++ b/www/grail/files/patch-ab @@ -0,0 +1,24 @@ +--- grailbase/app.py.orig Wed Mar 24 23:11:52 1999 ++++ grailbase/app.py Mon Mar 24 10:48:37 2003 +@@ -3,10 +3,10 @@ + + import os + import mimetypes +-import regex ++import re + import string + import utils +- ++regex = re + + class Application: + def __init__(self, prefs=None): +@@ -51,7 +51,7 @@ + + + __data_scheme_re = regex.compile( +- "data:\([^,;]*\)\(;\([^,]*\)\|\),", regex.casefold) ++ "data:\([^,;]*\)\(;\([^,]*\)\|\),") + + def guess_type(self, url): + """Guess the type of a file based on its URL. diff --git a/www/grail/files/patch-ac b/www/grail/files/patch-ac new file mode 100644 index 000000000000..11c43fb9e296 --- /dev/null +++ b/www/grail/files/patch-ac @@ -0,0 +1,63 @@ +--- protocols/httpAPI.py.orig Sat Mar 6 06:05:19 1999 ++++ protocols/httpAPI.py Mon Mar 24 10:47:50 2003 +@@ -52,9 +52,14 @@ + + class MyHTTP(httplib.HTTP): + ++ def __init__(self, host='', port=None, strict=None): ++ httplib.HTTP.__init__(self, host, port, strict) ++ self.putrequest_bk = self.putrequest ++ self.putrequest = lambda r,s: MyHTTP.putrequest(self, r, s) ++ + def putrequest(self, request, selector): + self.selector = selector +- httplib.HTTP.putrequest(self, request, selector) ++ self.putrequest_bk(request, selector) + + def getreply(self, file): + self.file = file +@@ -81,14 +86,14 @@ + def close(self): + if self.file: + self.file.close() +- if self.sock: ++ if self._conn.sock: + try: +- self.sock.close() ++ self._conn.sock.close() + except socket.error: + # What can you do? :-) + pass + self.file = None +- self.sock = None ++ self._conn.sock = None + + + class http_access: +@@ -168,7 +173,7 @@ + def pollmeta(self, timeout=0): + Assert(self.state == META) + +- sock = self.h.sock ++ sock = self.h._conn.sock + try: + if not select.select([sock], [], [], timeout)[0]: + return "waiting for server response", 0 +@@ -222,7 +227,7 @@ + self.readahead = self.readahead[maxbytes:] + return data + try: +- data = self.h.sock.recv(maxbytes) ++ data = self.h._conn.sock.recv(maxbytes) + except socket.error, msg: + raise IOError, msg, sys.exc_traceback + if not data: +@@ -231,7 +236,7 @@ + return data + + def fileno(self): +- return self.h.sock.fileno() ++ return self.h._conn.sock.fileno() + + + # To test this, use ProtocolAPI.test() -- cgit