wpdev-commits Mailing List for Wolfpack Emu (Page 183)
Brought to you by:
rip,
thiagocorrea
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(14) |
Aug
(121) |
Sep
(256) |
Oct
(59) |
Nov
(73) |
Dec
(120) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(259) |
Feb
(381) |
Mar
(501) |
Apr
(355) |
May
(427) |
Jun
(270) |
Jul
(394) |
Aug
(412) |
Sep
(724) |
Oct
(578) |
Nov
(65) |
Dec
|
|
From: <co...@us...> - 2003-11-10 12:44:21
|
Update of /cvsroot/wpdev/xmlscripts/python-lib/email
In directory sc8-pr-cvs1:/tmp/cvs-serv5168/email
Modified Files:
__init__.py Generator.py Message.py MIMEText.py Parser.py
Utils.py
Log Message:
Updated to Python 2.3.2
Index: __init__.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/python-lib/email/__init__.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** __init__.py 21 Dec 2002 14:52:55 -0000 1.2
--- __init__.py 10 Nov 2003 12:44:16 -0000 1.3
***************
*** 5,9 ****
"""
! __version__ = '2.4.3'
__all__ = [
--- 5,9 ----
"""
! __version__ = '2.5.4'
__all__ = [
Index: Generator.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/python-lib/email/Generator.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Generator.py 21 Dec 2002 14:52:55 -0000 1.2
--- Generator.py 10 Nov 2003 12:44:16 -0000 1.3
***************
*** 5,10 ****
"""
- import time
import re
import random
--- 5,12 ----
"""
import re
+ import sys
+ import time
+ import locale
import random
***************
*** 13,16 ****
--- 15,19 ----
from email.Header import Header
+ from email.Parser import NLCRE
try:
***************
*** 160,201 ****
def _write_headers(self, msg):
for h, v in msg.items():
! # RFC 2822 says that lines SHOULD be no more than maxheaderlen
! # characters wide, so we're well within our rights to split long
! # headers.
! text = '%s: %s' % (h, v)
! if self.__maxheaderlen > 0 and len(text) > self.__maxheaderlen:
! text = self._split_header(text)
! print >> self._fp, text
# A blank line always separates headers from body
print >> self._fp
- def _split_header(self, text):
- maxheaderlen = self.__maxheaderlen
- # Find out whether any lines in the header are really longer than
- # maxheaderlen characters wide. There could be continuation lines
- # that actually shorten it. Also, replace hard tabs with 8 spaces.
- lines = [s.replace('\t', SPACE8) for s in text.splitlines()]
- for line in lines:
- if len(line) > maxheaderlen:
- break
- else:
- # No line was actually longer than maxheaderlen characters, so
- # just return the original unchanged.
- return text
- # If we have raw 8bit data in a byte string, we have no idea what the
- # encoding is. I think there is no safe way to split this string. If
- # it's ascii-subset, then we could do a normal ascii split, but if
- # it's multibyte then we could break the string. There's no way to
- # know so the least harm seems to be to not split the string and risk
- # it being too long.
- if _is8bitstring(text):
- return text
- # The `text' argument already has the field name prepended, so don't
- # provide it here or the first line will get folded too short.
- h = Header(text, maxlinelen=maxheaderlen,
- # For backwards compatibility, we use a hard tab here
- continuation_ws='\t')
- return h.encode()
-
#
# Handlers for writing types and subtypes
--- 163,189 ----
def _write_headers(self, msg):
for h, v in msg.items():
! print >> self._fp, '%s:' % h,
! if self.__maxheaderlen == 0:
! # Explicit no-wrapping
! print >> self._fp, v
! elif isinstance(v, Header):
! # Header instances know what to do
! print >> self._fp, v.encode()
! elif _is8bitstring(v):
! # If we have raw 8bit data in a byte string, we have no idea
! # what the encoding is. There is no safe way to split this
! # string. If it's ascii-subset, then we could do a normal
! # ascii split, but if it's multibyte then we could break the
! # string. There's no way to know so the least harm seems to
! # be to not split the string and risk it being too long.
! print >> self._fp, v
! else:
! # Header's got lots of smarts, so use it.
! print >> self._fp, Header(
! v, maxlinelen=self.__maxheaderlen,
! header_name=h, continuation_ws='\t').encode()
# A blank line always separates headers from body
print >> self._fp
#
# Handlers for writing types and subtypes
***************
*** 259,262 ****
--- 247,258 ----
if msg.preamble is not None:
self._fp.write(msg.preamble)
+ # If preamble is the empty string, the length of the split will be
+ # 1, but the last element will be the empty string. If it's
+ # anything else but does not end in a line separator, the length
+ # will be > 1 and not end in an empty string. We need to
+ # guarantee a newline after the preamble, but don't add too many.
+ plines = NLCRE.split(msg.preamble)
+ if plines <> [''] and plines[-1] <> '':
+ self._fp.write('\n')
# First boundary is a bit different; it doesn't have a leading extra
# newline.
***************
*** 362,369 ****
# Helper
def _make_boundary(text=None):
# Craft a random boundary. If text is given, ensure that the chosen
# boundary doesn't appear in the text.
! boundary = ('=' * 15) + repr(random.random()).split('.')[1] + '=='
if text is None:
return boundary
--- 358,369 ----
# Helper
+ _width = len(repr(sys.maxint-1))
+ _fmt = '%%0%dd' % _width
+
def _make_boundary(text=None):
# Craft a random boundary. If text is given, ensure that the chosen
# boundary doesn't appear in the text.
! token = random.randrange(sys.maxint)
! boundary = ('=' * 15) + (_fmt % token) + '=='
if text is None:
return boundary
Index: Message.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/python-lib/email/Message.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Message.py 21 Dec 2002 14:52:55 -0000 1.2
--- Message.py 10 Nov 2003 12:44:16 -0000 1.3
***************
*** 6,9 ****
--- 6,11 ----
import re
+ import uu
+ import binascii
import warnings
from cStringIO import StringIO
***************
*** 11,16 ****
# Intrapackage imports
- from email import Errors
from email import Utils
from email import Charset
--- 13,18 ----
# Intrapackage imports
from email import Utils
+ from email import Errors
from email import Charset
***************
*** 57,60 ****
--- 59,79 ----
return param
+ def _parseparam(s):
+ plist = []
+ while s[:1] == ';':
+ s = s[1:]
+ end = s.find(';')
+ while end > 0 and s.count('"', 0, end) % 2:
+ end = s.find(';', end + 1)
+ if end < 0:
+ end = len(s)
+ f = s[:end]
+ if '=' in f:
+ i = f.index('=')
+ f = f[:i].strip().lower() + '=' + f[i+1:].strip()
+ plist.append(f.strip())
+ s = s[end:]
+ return plist
+
def _unquotevalue(value):
***************
*** 101,104 ****
--- 120,127 ----
Optional `unixfrom' when True, means include the Unix From_ envelope
header.
+
+ This is a convenience method and may not generate the message exactly
+ as you intend. For more flexibility, use the flatten() method of a
+ Generator instance.
"""
from email.Generator import Generator
***************
*** 165,181 ****
i returns that index into the payload.
! Optional decode is a flag (defaulting to False) indicating whether the
! payload should be decoded or not, according to the
! Content-Transfer-Encoding header. When True and the message is not a
! multipart, the payload will be decoded if this header's value is
! `quoted-printable' or `base64'. If some other encoding is used, or
! the header is missing, the payload is returned as-is (undecoded). If
! the message is a multipart and the decode flag is True, then None is
! returned.
"""
if i is None:
payload = self._payload
elif not isinstance(self._payload, ListType):
! raise TypeError, i
else:
payload = self._payload[i]
--- 188,208 ----
i returns that index into the payload.
! Optional decode is a flag indicating whether the payload should be
! decoded or not, according to the Content-Transfer-Encoding header
! (default is False).
!
! When True and the message is not a multipart, the payload will be
! decoded if this header's value is `quoted-printable' or `base64'. If
! some other encoding is used, or the header is missing, or if the
! payload has bogus data (i.e. bogus base64 or uuencoded data), the
! payload is returned as-is.
!
! If the message is a multipart and the decode flag is True, then None
! is returned.
"""
if i is None:
payload = self._payload
elif not isinstance(self._payload, ListType):
! raise TypeError, 'Expected list, got %s' % type(self._payload)
else:
payload = self._payload[i]
***************
*** 183,191 ****
if self.is_multipart():
return None
! cte = self.get('content-transfer-encoding', '')
! if cte.lower() == 'quoted-printable':
return Utils._qdecode(payload)
! elif cte.lower() == 'base64':
! return Utils._bdecode(payload)
# Everything else, including encodings with 8bit or 7bit are returned
# unchanged.
--- 210,230 ----
if self.is_multipart():
return None
! cte = self.get('content-transfer-encoding', '').lower()
! if cte == 'quoted-printable':
return Utils._qdecode(payload)
! elif cte == 'base64':
! try:
! return Utils._bdecode(payload)
! except binascii.Error:
! # Incorrect padding
! return payload
! elif cte in ('x-uuencode', 'uuencode', 'uue', 'x-uue'):
! sfp = StringIO()
! try:
! uu.decode(StringIO(payload+'\n'), sfp)
! payload = sfp.getvalue()
! except uu.Error:
! # Some decoding problem
! return payload
# Everything else, including encodings with 8bit or 7bit are returned
# unchanged.
***************
*** 504,508 ****
return failobj
params = []
! for p in paramre.split(value):
try:
name, val = p.split('=', 1)
--- 543,547 ----
return failobj
params = []
! for p in _parseparam(';' + value):
try:
name, val = p.split('=', 1)
***************
*** 550,560 ****
value can either be a string, or a 3-tuple if the parameter was RFC
2231 encoded. When it's a 3-tuple, the elements of the value are of
! the form (CHARSET, LANGUAGE, VALUE), where LANGUAGE may be the empty
! string. Your application should be prepared to deal with these, and
! can convert the parameter to a Unicode string like so:
param = msg.get_param('foo')
if isinstance(param, tuple):
! param = unicode(param[2], param[0])
In any case, the parameter value (either the returned string, or the
--- 589,602 ----
value can either be a string, or a 3-tuple if the parameter was RFC
2231 encoded. When it's a 3-tuple, the elements of the value are of
! the form (CHARSET, LANGUAGE, VALUE). Note that both CHARSET and
! LANGUAGE can be None, in which case you should consider VALUE to be
! encoded in the us-ascii charset. You can usually ignore LANGUAGE.
!
! Your application should be prepared to deal with 3-tuple return
! values, and can convert the parameter to a Unicode string like so:
param = msg.get_param('foo')
if isinstance(param, tuple):
! param = unicode(param[2], param[0] or 'us-ascii')
In any case, the parameter value (either the returned string, or the
***************
*** 687,691 ****
# It's an RFC 2231 encoded parameter
newvalue = _unquotevalue(filename)
! return unicode(newvalue[2], newvalue[0])
else:
newvalue = _unquotevalue(filename.strip())
--- 729,733 ----
# It's an RFC 2231 encoded parameter
newvalue = _unquotevalue(filename)
! return unicode(newvalue[2], newvalue[0] or 'us-ascii')
else:
newvalue = _unquotevalue(filename.strip())
***************
*** 704,708 ****
if isinstance(boundary, TupleType):
# RFC 2231 encoded, so decode. It better end up as ascii
! return unicode(boundary[2], boundary[0]).encode('us-ascii')
return _unquotevalue(boundary.strip())
--- 746,751 ----
if isinstance(boundary, TupleType):
# RFC 2231 encoded, so decode. It better end up as ascii
! charset = boundary[0] or 'us-ascii'
! return unicode(boundary[2], charset).encode('us-ascii')
return _unquotevalue(boundary.strip())
***************
*** 771,775 ****
if isinstance(charset, TupleType):
# RFC 2231 encoded, so decode it, and it better end up as ascii.
! charset = unicode(charset[2], charset[0]).encode('us-ascii')
# RFC 2046, $4.1.2 says charsets are not case sensitive
return charset.lower()
--- 814,819 ----
if isinstance(charset, TupleType):
# RFC 2231 encoded, so decode it, and it better end up as ascii.
! pcharset = charset[0] or 'us-ascii'
! charset = unicode(charset[2], pcharset).encode('us-ascii')
# RFC 2046, $4.1.2 says charsets are not case sensitive
return charset.lower()
Index: MIMEText.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/python-lib/email/MIMEText.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** MIMEText.py 21 Dec 2002 14:52:55 -0000 1.2
--- MIMEText.py 10 Nov 2003 12:44:16 -0000 1.3
***************
*** 18,23 ****
"""Create a text/* type MIME document.
! _text is the string for this message object. If the text does not end
! in a newline, one is added.
_subtype is the MIME sub content type, defaulting to "plain".
--- 18,22 ----
"""Create a text/* type MIME document.
! _text is the string for this message object.
_subtype is the MIME sub content type, defaulting to "plain".
***************
*** 36,41 ****
MIMENonMultipart.__init__(self, 'text', _subtype,
**{'charset': _charset})
- if _text and not _text.endswith('\n'):
- _text += '\n'
self.set_payload(_text, _charset)
if _encoder is not None:
--- 35,38 ----
Index: Parser.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/python-lib/email/Parser.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Parser.py 21 Dec 2002 14:52:55 -0000 1.2
--- Parser.py 10 Nov 2003 12:44:16 -0000 1.3
***************
*** 21,25 ****
False = 0
! nlcre = re.compile('\r\n|\r|\n')
--- 21,25 ----
False = 0
! NLCRE = re.compile('\r\n|\r|\n')
***************
*** 60,66 ****
"""
root = self._class()
! self._parseheaders(root, fp)
if not headersonly:
! self._parsebody(root, fp)
return root
--- 60,66 ----
"""
root = self._class()
! firstbodyline = self._parseheaders(root, fp)
if not headersonly:
! self._parsebody(root, fp, firstbodyline)
return root
***************
*** 81,84 ****
--- 81,85 ----
lastvalue = []
lineno = 0
+ firstbodyline = None
while True:
# Don't strip the line before we test for the end condition,
***************
*** 121,131 ****
if self._strict:
raise Errors.HeaderParseError(
! "Not a header, not a continuation: ``%s''"%line)
elif lineno == 1 and line.startswith('--'):
# allow through duplicate boundary tags.
continue
else:
! raise Errors.HeaderParseError(
! "Not a header, not a continuation: ``%s''"%line)
if lastheader:
container[lastheader] = NL.join(lastvalue)
--- 122,135 ----
if self._strict:
raise Errors.HeaderParseError(
! "Not a header, not a continuation: ``%s''" % line)
elif lineno == 1 and line.startswith('--'):
# allow through duplicate boundary tags.
continue
else:
! # There was no separating blank line as mandated by RFC
! # 2822, but we're in non-strict mode. So just offer up
! # this current line as the first body line.
! firstbodyline = line
! break
if lastheader:
container[lastheader] = NL.join(lastvalue)
***************
*** 135,140 ****
if lastheader:
container[lastheader] = NL.join(lastvalue)
! def _parsebody(self, container, fp):
# Parse the body, but first split the payload on the content-type
# boundary if present.
--- 139,145 ----
if lastheader:
container[lastheader] = NL.join(lastvalue)
+ return firstbodyline
! def _parsebody(self, container, fp, firstbodyline=None):
# Parse the body, but first split the payload on the content-type
# boundary if present.
***************
*** 153,156 ****
--- 158,163 ----
separator = '--' + boundary
payload = fp.read()
+ if firstbodyline is not None:
+ payload = firstbodyline + '\n' + payload
# We use an RE here because boundaries can have trailing
# whitespace.
***************
*** 170,174 ****
# Find out what kind of line endings we're using
start += len(mo.group('sep')) + len(mo.group('ws'))
! mo = nlcre.search(payload, start)
if mo:
start += len(mo.group(0))
--- 177,181 ----
# Find out what kind of line endings we're using
start += len(mo.group('sep')) + len(mo.group('ws'))
! mo = NLCRE.search(payload, start)
if mo:
start += len(mo.group(0))
***************
*** 222,228 ****
msgobj = self.parsestr(parthdrs, headersonly=1)
# while submsgobj is the message itself
- submsgobj = self.parsestr(part)
- msgobj.attach(submsgobj)
msgobj.set_default_type('message/rfc822')
else:
msgobj = self.parsestr(part)
--- 229,239 ----
msgobj = self.parsestr(parthdrs, headersonly=1)
# while submsgobj is the message itself
msgobj.set_default_type('message/rfc822')
+ maintype = msgobj.get_content_maintype()
+ if maintype in ('message', 'multipart'):
+ submsgobj = self.parsestr(part)
+ msgobj.attach(submsgobj)
+ else:
+ msgobj.set_payload(part)
else:
msgobj = self.parsestr(part)
***************
*** 257,261 ****
container.attach(msg)
else:
! container.set_payload(fp.read())
--- 268,275 ----
container.attach(msg)
else:
! text = fp.read()
! if firstbodyline is not None:
! text = firstbodyline + '\n' + text
! container.set_payload(text)
***************
*** 271,275 ****
interested in is the message headers.
"""
! def _parsebody(self, container, fp):
# Consume but do not parse, the body
! container.set_payload(fp.read())
--- 285,292 ----
interested in is the message headers.
"""
! def _parsebody(self, container, fp, firstbodyline=None):
# Consume but do not parse, the body
! text = fp.read()
! if firstbodyline is not None:
! text = firstbodyline + '\n' + text
! container.set_payload(text)
Index: Utils.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/python-lib/email/Utils.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Utils.py 21 Dec 2002 14:52:55 -0000 1.2
--- Utils.py 10 Nov 2003 12:44:16 -0000 1.3
***************
*** 14,24 ****
from types import ListType
! from rfc822 import quote
! from rfc822 import AddressList as _AddressList
! from rfc822 import mktime_tz
# We need wormarounds for bugs in these methods in older Pythons (see below)
! from rfc822 import parsedate as _parsedate
! from rfc822 import parsedate_tz as _parsedate_tz
try:
--- 14,24 ----
from types import ListType
! from email._parseaddr import quote
! from email._parseaddr import AddressList as _AddressList
! from email._parseaddr import mktime_tz
# We need wormarounds for bugs in these methods in older Pythons (see below)
! from email._parseaddr import parsedate as _parsedate
! from email._parseaddr import parsedate_tz as _parsedate_tz
try:
***************
*** 55,60 ****
CRLF = '\r\n'
! specialsre = re.compile(r'[][\()<>@,:;".]')
! escapesre = re.compile(r'[][\()"]')
--- 55,60 ----
CRLF = '\r\n'
! specialsre = re.compile(r'[][\\()<>@,:;".]')
! escapesre = re.compile(r'[][\\()"]')
***************
*** 67,72 ****
def _bdecode(s):
- if not s:
- return s
# We can't quite use base64.encodestring() since it tacks on a "courtesy
# newline". Blech!
--- 67,70 ----
***************
*** 281,287 ****
"""Decode string according to RFC 2231"""
import urllib
! charset, language, s = s.split("'", 2)
! s = urllib.unquote(s)
! return charset, language, s
--- 279,287 ----
"""Decode string according to RFC 2231"""
import urllib
! parts = s.split("'", 2)
! if len(parts) == 1:
! return None, None, urllib.unquote(s)
! charset, language, s = parts
! return charset, language, urllib.unquote(s)
***************
*** 336,340 ****
value.append(continuation)
charset, language, value = decode_rfc2231(EMPTYSTRING.join(value))
! new_params.append((name,
! (charset, language, '"%s"' % quote(value))))
return new_params
--- 336,340 ----
value.append(continuation)
charset, language, value = decode_rfc2231(EMPTYSTRING.join(value))
! new_params.append(
! (name, (charset, language, '"%s"' % quote(value))))
return new_params
|
Update of /cvsroot/wpdev/xmlscripts/python-lib/compiler
In directory sc8-pr-cvs1:/tmp/cvs-serv5168/compiler
Modified Files:
ast.py pyassem.py pycodegen.py symbols.py transformer.py
visitor.py
Log Message:
Updated to Python 2.3.2
Index: ast.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/python-lib/compiler/ast.py,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** ast.py 1 Jul 2002 01:57:00 -0000 1.1.1.1
--- ast.py 10 Nov 2003 12:44:15 -0000 1.2
***************
*** 20,26 ****
return [n for n in flatten(list) if isinstance(n, Node)]
! def asList(nodes):
l = []
! for item in nodes:
if hasattr(item, "asList"):
l.append(item.asList())
--- 20,26 ----
return [n for n in flatten(list) if isinstance(n, Node)]
! def asList(nodearg):
l = []
! for item in nodearg:
if hasattr(item, "asList"):
l.append(item.asList())
***************
*** 66,74 ****
def getChildNodes(self):
! nodes = []
! nodes.append(self.expr)
! if self.lower is not None: nodes.append(self.lower)
! if self.upper is not None: nodes.append(self.upper)
! return tuple(nodes)
def __repr__(self):
--- 66,74 ----
def getChildNodes(self):
! nodelist = []
! nodelist.append(self.expr)
! if self.lower is not None: nodelist.append(self.lower)
! if self.upper is not None: nodelist.append(self.upper)
! return tuple(nodelist)
def __repr__(self):
***************
*** 104,112 ****
def getChildNodes(self):
! nodes = []
! if self.expr1 is not None: nodes.append(self.expr1)
! if self.expr2 is not None: nodes.append(self.expr2)
! if self.expr3 is not None: nodes.append(self.expr3)
! return tuple(nodes)
def __repr__(self):
--- 104,112 ----
def getChildNodes(self):
! nodelist = []
! if self.expr1 is not None: nodelist.append(self.expr1)
! if self.expr2 is not None: nodelist.append(self.expr2)
! if self.expr3 is not None: nodelist.append(self.expr3)
! return tuple(nodelist)
def __repr__(self):
***************
*** 130,139 ****
def getChildNodes(self):
! nodes = []
! nodes.append(self.assign)
! nodes.append(self.list)
! nodes.append(self.body)
! if self.else_ is not None: nodes.append(self.else_)
! return tuple(nodes)
def __repr__(self):
--- 130,139 ----
def getChildNodes(self):
! nodelist = []
! nodelist.append(self.assign)
! nodelist.append(self.list)
! nodelist.append(self.body)
! if self.else_ is not None: nodelist.append(self.else_)
! return tuple(nodelist)
def __repr__(self):
***************
*** 151,157 ****
def getChildNodes(self):
! nodes = []
! nodes.extend(flatten_nodes(self.nodes))
! return tuple(nodes)
def __repr__(self):
--- 151,157 ----
def getChildNodes(self):
! nodelist = []
! nodelist.extend(flatten_nodes(self.nodes))
! return tuple(nodelist)
def __repr__(self):
***************
*** 213,219 ****
def getChildNodes(self):
! nodes = []
! nodes.extend(flatten_nodes(self.nodes))
! return tuple(nodes)
def __repr__(self):
--- 213,219 ----
def getChildNodes(self):
! nodelist = []
! nodelist.extend(flatten_nodes(self.nodes))
! return tuple(nodelist)
def __repr__(self):
***************
*** 261,267 ****
def getChildNodes(self):
! nodes = []
! nodes.extend(flatten_nodes(self.items))
! return tuple(nodes)
def __repr__(self):
--- 261,267 ----
def getChildNodes(self):
! nodelist = []
! nodelist.extend(flatten_nodes(self.items))
! return tuple(nodelist)
def __repr__(self):
***************
*** 339,346 ****
def getChildNodes(self):
! nodes = []
! nodes.extend(flatten_nodes(self.nodes))
! if self.dest is not None: nodes.append(self.dest)
! return tuple(nodes)
def __repr__(self):
--- 339,346 ----
def getChildNodes(self):
! nodelist = []
! nodelist.extend(flatten_nodes(self.nodes))
! if self.dest is not None: nodelist.append(self.dest)
! return tuple(nodelist)
def __repr__(self):
***************
*** 376,383 ****
def getChildNodes(self):
! nodes = []
! nodes.append(self.expr)
! nodes.extend(flatten_nodes(self.subs))
! return tuple(nodes)
def __repr__(self):
--- 376,383 ----
def getChildNodes(self):
! nodelist = []
! nodelist.append(self.expr)
! nodelist.extend(flatten_nodes(self.subs))
! return tuple(nodelist)
def __repr__(self):
***************
*** 399,407 ****
def getChildNodes(self):
! nodes = []
! nodes.append(self.body)
! nodes.extend(flatten_nodes(self.handlers))
! if self.else_ is not None: nodes.append(self.else_)
! return tuple(nodes)
def __repr__(self):
--- 399,407 ----
def getChildNodes(self):
! nodelist = []
! nodelist.append(self.body)
! nodelist.extend(flatten_nodes(self.handlers))
! if self.else_ is not None: nodelist.append(self.else_)
! return tuple(nodelist)
def __repr__(self):
***************
*** 419,425 ****
def getChildNodes(self):
! nodes = []
! nodes.extend(flatten_nodes(self.nodes))
! return tuple(nodes)
def __repr__(self):
--- 419,425 ----
def getChildNodes(self):
! nodelist = []
! nodelist.extend(flatten_nodes(self.nodes))
! return tuple(nodelist)
def __repr__(self):
***************
*** 468,475 ****
def getChildNodes(self):
! nodes = []
! nodes.extend(flatten_nodes(self.defaults))
! nodes.append(self.code)
! return tuple(nodes)
def __repr__(self):
--- 468,475 ----
def getChildNodes(self):
! nodelist = []
! nodelist.extend(flatten_nodes(self.defaults))
! nodelist.append(self.code)
! return tuple(nodelist)
def __repr__(self):
***************
*** 489,496 ****
def getChildNodes(self):
! nodes = []
! nodes.append(self.test)
! if self.fail is not None: nodes.append(self.fail)
! return tuple(nodes)
def __repr__(self):
--- 489,496 ----
def getChildNodes(self):
! nodelist = []
! nodelist.append(self.test)
! if self.fail is not None: nodelist.append(self.fail)
! return tuple(nodelist)
def __repr__(self):
***************
*** 541,549 ****
def getChildNodes(self):
! nodes = []
! nodes.append(self.expr)
! if self.locals is not None: nodes.append(self.locals)
! if self.globals is not None: nodes.append(self.globals)
! return tuple(nodes)
def __repr__(self):
--- 541,549 ----
def getChildNodes(self):
! nodelist = []
! nodelist.append(self.expr)
! if self.locals is not None: nodelist.append(self.locals)
! if self.globals is not None: nodelist.append(self.globals)
! return tuple(nodelist)
def __repr__(self):
***************
*** 561,567 ****
def getChildNodes(self):
! nodes = []
! nodes.extend(flatten_nodes(self.nodes))
! return tuple(nodes)
def __repr__(self):
--- 561,567 ----
def getChildNodes(self):
! nodelist = []
! nodelist.extend(flatten_nodes(self.nodes))
! return tuple(nodelist)
def __repr__(self):
***************
*** 579,585 ****
def getChildNodes(self):
! nodes = []
! nodes.extend(flatten_nodes(self.nodes))
! return tuple(nodes)
def __repr__(self):
--- 579,585 ----
def getChildNodes(self):
! nodelist = []
! nodelist.extend(flatten_nodes(self.nodes))
! return tuple(nodelist)
def __repr__(self):
***************
*** 611,617 ****
def getChildNodes(self):
! nodes = []
! nodes.extend(flatten_nodes(self.nodes))
! return tuple(nodes)
def __repr__(self):
--- 611,617 ----
def getChildNodes(self):
! nodelist = []
! nodelist.extend(flatten_nodes(self.nodes))
! return tuple(nodelist)
def __repr__(self):
***************
*** 679,686 ****
def getChildNodes(self):
! nodes = []
! nodes.extend(flatten_nodes(self.bases))
! nodes.append(self.code)
! return tuple(nodes)
def __repr__(self):
--- 679,686 ----
def getChildNodes(self):
! nodelist = []
! nodelist.extend(flatten_nodes(self.bases))
! nodelist.append(self.code)
! return tuple(nodelist)
def __repr__(self):
***************
*** 715,722 ****
def getChildNodes(self):
! nodes = []
! nodes.extend(flatten_nodes(self.nodes))
! if self.dest is not None: nodes.append(self.dest)
! return tuple(nodes)
def __repr__(self):
--- 715,722 ----
def getChildNodes(self):
! nodelist = []
! nodelist.extend(flatten_nodes(self.nodes))
! if self.dest is not None: nodelist.append(self.dest)
! return tuple(nodelist)
def __repr__(self):
***************
*** 734,740 ****
def getChildNodes(self):
! nodes = []
! nodes.extend(flatten_nodes(self.nodes))
! return tuple(nodes)
def __repr__(self):
--- 734,740 ----
def getChildNodes(self):
! nodelist = []
! nodelist.extend(flatten_nodes(self.nodes))
! return tuple(nodelist)
def __repr__(self):
***************
*** 799,805 ****
def getChildNodes(self):
! nodes = []
! nodes.extend(flatten_nodes(self.nodes))
! return tuple(nodes)
def __repr__(self):
--- 799,805 ----
def getChildNodes(self):
! nodelist = []
! nodelist.extend(flatten_nodes(self.nodes))
! return tuple(nodelist)
def __repr__(self):
***************
*** 865,873 ****
def getChildNodes(self):
! nodes = []
! nodes.append(self.test)
! nodes.append(self.body)
! if self.else_ is not None: nodes.append(self.else_)
! return tuple(nodes)
def __repr__(self):
--- 865,873 ----
def getChildNodes(self):
! nodelist = []
! nodelist.append(self.test)
! nodelist.append(self.body)
! if self.else_ is not None: nodelist.append(self.else_)
! return tuple(nodelist)
def __repr__(self):
***************
*** 944,951 ****
def getChildNodes(self):
! nodes = []
! nodes.extend(flatten_nodes(self.nodes))
! nodes.append(self.expr)
! return tuple(nodes)
def __repr__(self):
--- 944,951 ----
def getChildNodes(self):
! nodelist = []
! nodelist.extend(flatten_nodes(self.nodes))
! nodelist.append(self.expr)
! return tuple(nodelist)
def __repr__(self):
***************
*** 975,982 ****
def getChildNodes(self):
! nodes = []
! nodes.extend(flatten_nodes(self.defaults))
! nodes.append(self.code)
! return tuple(nodes)
def __repr__(self):
--- 975,982 ----
def getChildNodes(self):
! nodelist = []
! nodelist.extend(flatten_nodes(self.defaults))
! nodelist.append(self.code)
! return tuple(nodelist)
def __repr__(self):
***************
*** 994,1000 ****
def getChildNodes(self):
! nodes = []
! nodes.extend(flatten_nodes(self.nodes))
! return tuple(nodes)
def __repr__(self):
--- 994,1000 ----
def getChildNodes(self):
! nodelist = []
! nodelist.extend(flatten_nodes(self.nodes))
! return tuple(nodelist)
def __repr__(self):
***************
*** 1014,1021 ****
def getChildNodes(self):
! nodes = []
! nodes.append(self.expr)
! nodes.extend(flatten_nodes(self.ops))
! return tuple(nodes)
def __repr__(self):
--- 1014,1021 ----
def getChildNodes(self):
! nodelist = []
! nodelist.append(self.expr)
! nodelist.extend(flatten_nodes(self.ops))
! return tuple(nodelist)
def __repr__(self):
***************
*** 1033,1039 ****
def getChildNodes(self):
! nodes = []
! nodes.extend(flatten_nodes(self.nodes))
! return tuple(nodes)
def __repr__(self):
--- 1033,1039 ----
def getChildNodes(self):
! nodelist = []
! nodelist.extend(flatten_nodes(self.nodes))
! return tuple(nodelist)
def __repr__(self):
***************
*** 1051,1057 ****
def getChildNodes(self):
! nodes = []
! nodes.extend(flatten_nodes(self.nodes))
! return tuple(nodes)
def __repr__(self):
--- 1051,1057 ----
def getChildNodes(self):
! nodelist = []
! nodelist.extend(flatten_nodes(self.nodes))
! return tuple(nodelist)
def __repr__(self):
***************
*** 1075,1084 ****
def getChildNodes(self):
! nodes = []
! nodes.append(self.node)
! nodes.extend(flatten_nodes(self.args))
! if self.star_args is not None: nodes.append(self.star_args)
! if self.dstar_args is not None: nodes.append(self.dstar_args)
! return tuple(nodes)
def __repr__(self):
--- 1075,1084 ----
def getChildNodes(self):
! nodelist = []
! nodelist.append(self.node)
! nodelist.extend(flatten_nodes(self.args))
! if self.star_args is not None: nodelist.append(self.star_args)
! if self.dstar_args is not None: nodelist.append(self.dstar_args)
! return tuple(nodelist)
def __repr__(self):
***************
*** 1184,1191 ****
def getChildNodes(self):
! nodes = []
! nodes.extend(flatten_nodes(self.tests))
! if self.else_ is not None: nodes.append(self.else_)
! return tuple(nodes)
def __repr__(self):
--- 1184,1191 ----
def getChildNodes(self):
! nodelist = []
! nodelist.extend(flatten_nodes(self.tests))
! if self.else_ is not None: nodelist.append(self.else_)
! return tuple(nodelist)
def __repr__(self):
***************
*** 1205,1212 ****
def getChildNodes(self):
! nodes = []
! nodes.append(self.expr)
! nodes.extend(flatten_nodes(self.quals))
! return tuple(nodes)
def __repr__(self):
--- 1205,1212 ----
def getChildNodes(self):
! nodelist = []
! nodelist.append(self.expr)
! nodelist.extend(flatten_nodes(self.quals))
! return tuple(nodelist)
def __repr__(self):
***************
*** 1228,1236 ****
def getChildNodes(self):
! nodes = []
! nodes.append(self.assign)
! nodes.append(self.list)
! nodes.extend(flatten_nodes(self.ifs))
! return tuple(nodes)
def __repr__(self):
--- 1228,1236 ----
def getChildNodes(self):
! nodelist = []
! nodelist.append(self.assign)
! nodelist.append(self.list)
! nodelist.extend(flatten_nodes(self.ifs))
! return tuple(nodelist)
def __repr__(self):
Index: pyassem.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/python-lib/compiler/pyassem.py,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** pyassem.py 1 Jul 2002 01:57:01 -0000 1.1.1.1
--- pyassem.py 10 Nov 2003 12:44:15 -0000 1.2
***************
*** 3,20 ****
import dis
import new
- import string
import sys
import types
from compiler import misc
! from compiler.consts import CO_OPTIMIZED, CO_NEWLOCALS, CO_VARARGS, \
! CO_VARKEYWORDS
!
! def xxx_sort(l):
! l = l[:]
! def sorter(a, b):
! return cmp(a.bid, b.bid)
! l.sort(sorter)
! return l
class FlowGraph:
--- 3,12 ----
import dis
import new
import sys
import types
from compiler import misc
! from compiler.consts \
! import CO_OPTIMIZED, CO_NEWLOCALS, CO_VARARGS, CO_VARKEYWORDS
class FlowGraph:
***************
*** 79,83 ****
if self._debug:
print "\t", inst
! if inst[0] == 'RETURN_VALUE':
self.current.addOutEdge(self.exit)
if len(inst) == 2 and isinstance(inst[1], Block):
--- 71,75 ----
if self._debug:
print "\t", inst
! if inst[0] in ['RETURN_VALUE', 'YIELD_VALUE']:
self.current.addOutEdge(self.exit)
if len(inst) == 2 and isinstance(inst[1], Block):
***************
*** 247,251 ****
insts = map(str, self.insts)
return "<block %s %d:\n%s>" % (self.label, self.bid,
! string.join(insts, '\n'))
def emit(self, inst):
--- 239,243 ----
insts = map(str, self.insts)
return "<block %s %d:\n%s>" % (self.label, self.bid,
! '\n'.join(insts))
def emit(self, inst):
***************
*** 268,272 ****
assert len(self.next) == 1, map(str, self.next)
! _uncond_transfer = ('RETURN_VALUE', 'RAISE_VARARGS',
'JUMP_ABSOLUTE', 'JUMP_FORWARD', 'CONTINUE_LOOP')
--- 260,264 ----
assert len(self.next) == 1, map(str, self.next)
! _uncond_transfer = ('RETURN_VALUE', 'RAISE_VARARGS', 'YIELD_VALUE',
'JUMP_ABSOLUTE', 'JUMP_FORWARD', 'CONTINUE_LOOP')
***************
*** 445,449 ****
if len(inst) == 1:
pc = pc + 1
! else:
# arg takes 2 bytes
pc = pc + 3
--- 437,441 ----
if len(inst) == 1:
pc = pc + 1
! elif inst[0] != "SET_LINENO":
# arg takes 2 bytes
pc = pc + 3
***************
*** 454,458 ****
if len(inst) == 1:
pc = pc + 1
! else:
pc = pc + 3
opname = inst[0]
--- 446,450 ----
if len(inst) == 1:
pc = pc + 1
! elif inst[0] != "SET_LINENO":
pc = pc + 3
opname = inst[0]
***************
*** 582,585 ****
--- 574,578 ----
if opname == "SET_LINENO":
lnotab.nextLine(oparg)
+ continue
hi, lo = twobyte(oparg)
try:
***************
*** 699,703 ****
# compiler because it only generates a SET_LINENO instruction
# for the assignment.
! if line > 0:
push = self.lnotab.append
while addr > 255:
--- 692,696 ----
# compiler because it only generates a SET_LINENO instruction
# for the assignment.
! if line >= 0:
push = self.lnotab.append
while addr > 255:
***************
*** 714,721 ****
def getCode(self):
! return string.join(self.code, '')
def getTable(self):
! return string.join(map(chr, self.lnotab), '')
class StackDepthTracker:
--- 707,714 ----
def getCode(self):
! return ''.join(self.code)
def getTable(self):
! return ''.join(map(chr, self.lnotab))
class StackDepthTracker:
***************
*** 770,773 ****
--- 763,767 ----
'PRINT_ITEM': -1,
'RETURN_VALUE': -1,
+ 'YIELD_VALUE': -1,
'EXEC_STMT': -3,
'BUILD_CLASS': -2,
Index: pycodegen.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/python-lib/compiler/pycodegen.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** pycodegen.py 21 Dec 2002 14:52:54 -0000 1.2
--- pycodegen.py 10 Nov 2003 12:44:15 -0000 1.3
***************
*** 2,7 ****
import os
import marshal
- import stat
- import string
import struct
import sys
--- 2,5 ----
***************
*** 16,19 ****
--- 14,18 ----
from compiler.pyassem import TupleArg
+ # XXX The version-specific code can go, since this code only works with 2.x.
# Do we have Python 1.x or Python 2.x?
try:
***************
*** 35,48 ****
END_FINALLY = 4
- # XXX this doesn't seem to be used
- class BlockStack(misc.Stack):
- __super_init = misc.Stack.__init__
-
- def __init__(self):
- self.__super_init(self)
- self.loop = None
-
def compileFile(filename, display=0):
! f = open(filename)
buf = f.read()
f.close()
--- 34,39 ----
END_FINALLY = 4
def compileFile(filename, display=0):
! f = open(filename, 'U')
buf = f.read()
f.close()
***************
*** 50,54 ****
try:
mod.compile(display)
! except SyntaxError, err:
raise
else:
--- 41,45 ----
try:
mod.compile(display)
! except SyntaxError:
raise
else:
***************
*** 136,140 ****
# to indicate the type of the value. simplest way to get the
# same effect is to call marshal and then skip the code.
! mtime = os.stat(self.filename)[stat.ST_MTIME]
mtime = struct.pack('<i', mtime)
return self.MAGIC + mtime
--- 127,131 ----
# to indicate the type of the value. simplest way to get the
# same effect is to call marshal and then skip the code.
! mtime = os.path.getmtime(self.filename)
mtime = struct.pack('<i', mtime)
return self.MAGIC + mtime
***************
*** 313,319 ****
self.emit(prefix + '_NAME', name)
! def set_lineno(self, node, force=0):
! """Emit SET_LINENO if node has lineno attribute and it is
! different than the last lineno emitted.
Returns true if SET_LINENO was emitted.
--- 304,318 ----
self.emit(prefix + '_NAME', name)
! # The set_lineno() function and the explicit emit() calls for
! # SET_LINENO below are only used to generate the line number table.
! # As of Python 2.3, the interpreter does not have a SET_LINENO
! # instruction. pyassem treats SET_LINENO opcodes as a special case.
!
! def set_lineno(self, node, force=False):
! """Emit SET_LINENO if necessary.
!
! The instruction is considered necessary if the node has a
! lineno attribute and it is different than the last lineno
! emitted.
Returns true if SET_LINENO was emitted.
***************
*** 329,334 ****
self.emit('SET_LINENO', lineno)
self.last_lineno = lineno
! return 1
! return 0
# The first few visitor methods handle nodes that generator new
--- 328,333 ----
self.emit('SET_LINENO', lineno)
self.last_lineno = lineno
! return True
! return False
# The first few visitor methods handle nodes that generator new
***************
*** 447,451 ****
self.setups.push((LOOP, loop))
! self.set_lineno(node, force=1)
self.visit(node.test)
self.emit('JUMP_IF_FALSE', else_ or after)
--- 446,450 ----
self.setups.push((LOOP, loop))
! self.set_lineno(node, force=True)
self.visit(node.test)
self.emit('JUMP_IF_FALSE', else_ or after)
***************
*** 610,614 ****
self.emit('GET_ITER')
self.nextBlock(start)
! self.emit('SET_LINENO', node.lineno)
self.emit('FOR_ITER', anchor)
self.nextBlock()
--- 609,613 ----
self.emit('GET_ITER')
self.nextBlock(start)
! self.set_lineno(node, force=True)
self.emit('FOR_ITER', anchor)
self.nextBlock()
***************
*** 617,621 ****
def visitListCompIf(self, node, branch):
! self.set_lineno(node, force=1)
self.visit(node.test)
self.emit('JUMP_IF_FALSE', branch)
--- 616,620 ----
def visitListCompIf(self, node, branch):
! self.set_lineno(node, force=True)
self.visit(node.test)
self.emit('JUMP_IF_FALSE', branch)
***************
*** 762,767 ****
self.emit('LOAD_CONST', None)
self.emit('IMPORT_NAME', name)
! mod = string.split(name, ".")[0]
! self.storeName(alias or mod)
def visitFrom(self, node):
--- 761,770 ----
self.emit('LOAD_CONST', None)
self.emit('IMPORT_NAME', name)
! mod = name.split(".")[0]
! if alias:
! self._resolveDots(name)
! self.storeName(alias)
! else:
! self.storeName(mod)
def visitFrom(self, node):
***************
*** 788,792 ****
def _resolveDots(self, name):
! elts = string.split(name, ".")
if len(elts) == 1:
return
--- 791,795 ----
def _resolveDots(self, name):
! elts = name.split(".")
if len(elts) == 1:
return
***************
*** 975,979 ****
self.set_lineno(node)
self.visit(node.value)
! self.emit('YIELD_STMT')
# slice and subscript stuff
--- 978,982 ----
self.set_lineno(node)
self.visit(node.value)
! self.emit('YIELD_VALUE')
# slice and subscript stuff
***************
*** 1119,1135 ****
def visitDict(self, node):
! lineno = getattr(node, 'lineno', None)
! if lineno:
! self.emit('SET_LINENO', lineno)
self.emit('BUILD_MAP', 0)
for k, v in node.items:
- lineno2 = getattr(node, 'lineno', None)
- if lineno2 is not None and lineno != lineno2:
- self.emit('SET_LINENO', lineno2)
- lineno = lineno2
self.emit('DUP_TOP')
- self.visit(v)
- self.emit('ROT_TWO')
self.visit(k)
self.emit('STORE_SUBSCR')
--- 1122,1132 ----
def visitDict(self, node):
! self.set_lineno(node)
self.emit('BUILD_MAP', 0)
for k, v in node.items:
self.emit('DUP_TOP')
self.visit(k)
+ self.visit(v)
+ self.emit('ROT_THREE')
self.emit('STORE_SUBSCR')
***************
*** 1185,1189 ****
def get_module(self):
return self
!
def visitDiscard(self, node):
# XXX Discard means it's an expression. Perhaps this is a bad
--- 1182,1186 ----
def get_module(self):
return self
!
def visitDiscard(self, node):
# XXX Discard means it's an expression. Perhaps this is a bad
***************
*** 1266,1272 ****
self.graph.setFreeVars(self.scope.get_free_vars())
self.graph.setCellVars(self.scope.get_cell_vars())
! if self.graph.checkFlag(CO_GENERATOR_ALLOWED):
! if self.scope.generator is not None:
! self.graph.setFlag(CO_GENERATOR)
class AbstractClassCode:
--- 1263,1268 ----
self.graph.setFreeVars(self.scope.get_free_vars())
self.graph.setCellVars(self.scope.get_cell_vars())
! if self.scope.generator is not None:
! self.graph.setFlag(CO_GENERATOR)
class AbstractClassCode:
***************
*** 1305,1311 ****
self.graph.setCellVars(self.scope.get_cell_vars())
self.set_lineno(klass)
if klass.doc:
self.emit("LOAD_CONST", klass.doc)
! self.storeName("__doc__")
def generateArgList(arglist):
--- 1301,1309 ----
self.graph.setCellVars(self.scope.get_cell_vars())
self.set_lineno(klass)
+ self.emit("LOAD_GLOBAL", "__name__")
+ self.storeName("__module__")
if klass.doc:
self.emit("LOAD_CONST", klass.doc)
! self.storeName('__doc__')
def generateArgList(arglist):
***************
*** 1383,1388 ****
if __name__ == "__main__":
- import sys
-
for file in sys.argv[1:]:
compileFile(file)
--- 1381,1384 ----
Index: symbols.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/python-lib/compiler/symbols.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** symbols.py 21 Dec 2002 14:52:54 -0000 1.2
--- symbols.py 10 Nov 2003 12:44:15 -0000 1.3
***************
*** 252,255 ****
--- 252,256 ----
if node.doc is not None:
scope.add_def('__doc__')
+ scope.add_def('__module__')
self.scopes[node] = scope
prev = self.klass
Index: transformer.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/python-lib/compiler/transformer.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** transformer.py 21 Dec 2002 14:52:54 -0000 1.2
--- transformer.py 10 Nov 2003 12:44:15 -0000 1.3
***************
*** 29,33 ****
import symbol
import token
- import string
import sys
--- 29,32 ----
***************
*** 39,43 ****
def parseFile(path):
f = open(path)
! src = f.read()
f.close()
return parse(src)
--- 38,46 ----
def parseFile(path):
f = open(path)
! # XXX The parser API tolerates files without a trailing newline,
! # but not strings without a trailing newline. Always add an extra
! # newline to the file contents, since we're going through the string
! # version of the API.
! src = f.read() + "\n"
f.close()
return parse(src)
***************
*** 70,74 ****
if nodes.has_key(kind):
try:
! return apply(nodes[kind], args[1:])
except TypeError:
print nodes[kind], len(args), args
--- 73,77 ----
if nodes.has_key(kind):
try:
! return nodes[kind](*args[1:])
except TypeError:
print nodes[kind], len(args), args
***************
*** 102,105 ****
--- 105,109 ----
token.NAME: self.atom_name,
}
+ self.encoding = None
def transform(self, tree):
***************
*** 112,116 ****
"""Return a modified parse tree for the given suite text."""
# Hack for handling non-native line endings on non-DOS like OSs.
! text = string.replace(text, '\x0d', '')
return self.transform(parser.suite(text))
--- 116,121 ----
"""Return a modified parse tree for the given suite text."""
# Hack for handling non-native line endings on non-DOS like OSs.
! # this can go now we have universal newlines?
! text = text.replace('\x0d', '')
return self.transform(parser.suite(text))
***************
*** 133,136 ****
--- 138,147 ----
### emit a line-number node?
n = node[0]
+
+ if n == symbol.encoding_decl:
+ self.encoding = node[2]
+ node = node[1]
+ n = node[0]
+
if n == symbol.single_input:
return self.single_input(node[1:])
***************
*** 293,300 ****
return n
if nodelist[1][0] == token.EQUAL:
! nodes = []
for i in range(0, len(nodelist) - 2, 2):
! nodes.append(self.com_assign(nodelist[i], OP_ASSIGN))
! n = Assign(nodes, exprNode)
n.lineno = nodelist[1][2]
else:
--- 304,311 ----
return n
if nodelist[1][0] == token.EQUAL:
! nodesl = []
for i in range(0, len(nodelist) - 2, 2):
! nodesl.append(self.com_assign(nodelist[i], OP_ASSIGN))
! n = Assign(nodesl, exprNode)
n.lineno = nodelist[1][2]
else:
***************
*** 521,524 ****
--- 532,536 ----
testlist_safe = testlist # XXX
+ testlist1 = testlist
exprlist = testlist
***************
*** 640,643 ****
--- 652,656 ----
t = elt[0]
node = self.com_node(nodelist[-1])
+ # need to handle (unary op)constant here...
if t == token.PLUS:
node = UnaryAdd(node)
***************
*** 701,709 ****
return n
def atom_string(self, nodelist):
- ### need to verify this matches compile.c
k = ''
for node in nodelist:
! k = k + eval(node[1])
n = Const(k)
n.lineno = nodelist[0][2]
--- 714,732 ----
return n
+ def decode_literal(self, lit):
+ if self.encoding:
+ # this is particularly fragile & a bit of a
+ # hack... changes in compile.c:parsestr and
+ # tokenizer.c must be reflected here.
+ if self.encoding not in ['utf-8', 'iso-8859-1']:
+ lit = unicode(lit, 'utf-8').encode(self.encoding)
+ return eval("# coding: %s\n%s" % (self.encoding, lit))
+ else:
+ return eval(lit)
+
def atom_string(self, nodelist):
k = ''
for node in nodelist:
! k += self.decode_literal(node[1])
n = Const(k)
n.lineno = nodelist[0][2]
Index: visitor.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/python-lib/compiler/visitor.py,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** visitor.py 1 Jul 2002 01:57:03 -0000 1.1.1.1
--- visitor.py 10 Nov 2003 12:44:15 -0000 1.2
***************
*** 27,39 ****
the walk has occurred.) The ASTVisitor modifies the visitor
argument by adding a visit method to the visitor; this method can
! be used to visit a particular child node. If the visitor method
! returns a true value, the ASTVisitor will not traverse the child
! nodes.
!
! XXX The interface for controlling the preorder walk needs to be
! re-considered. The current interface is convenient for visitors
! that mostly let the ASTVisitor do everything. For something like
! a code generator, where you want to walk to occur in a specific
! order, it's a pain to add "return 1" to the end of each method.
"""
--- 27,31 ----
the walk has occurred.) The ASTVisitor modifies the visitor
argument by adding a visit method to the visitor; this method can
! be used to visit a child node of arbitrary type.
"""
|
|
From: <co...@us...> - 2003-11-10 12:44:20
|
Update of /cvsroot/wpdev/xmlscripts/python-lib/xml/sax
In directory sc8-pr-cvs1:/tmp/cvs-serv5168/xml/sax
Modified Files:
__init__.py expatreader.py handler.py saxutils.py xmlreader.py
Log Message:
Updated to Python 2.3.2
Index: __init__.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/python-lib/xml/sax/__init__.py,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** __init__.py 1 Jul 2002 02:00:12 -0000 1.1.1.1
--- __init__.py 10 Nov 2003 12:44:17 -0000 1.2
***************
*** 59,70 ****
import xml.sax.expatreader
! import os, string, sys
if os.environ.has_key("PY_SAX_PARSER"):
! default_parser_list = string.split(os.environ["PY_SAX_PARSER"], ",")
del os
_key = "python.xml.sax.parser"
if sys.platform[:4] == "java" and sys.registry.containsKey(_key):
! default_parser_list = string.split(sys.registry.getProperty(_key), ",")
--- 59,70 ----
import xml.sax.expatreader
! import os, sys
if os.environ.has_key("PY_SAX_PARSER"):
! default_parser_list = os.environ["PY_SAX_PARSER"].split(",")
del os
_key = "python.xml.sax.parser"
if sys.platform[:4] == "java" and sys.registry.containsKey(_key):
! default_parser_list = sys.registry.getProperty(_key).split(",")
Index: expatreader.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/python-lib/xml/sax/expatreader.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** expatreader.py 21 Dec 2002 14:52:55 -0000 1.2
--- expatreader.py 10 Nov 2003 12:44:17 -0000 1.3
***************
*** 1,4 ****
"""
! SAX driver for the Pyexpat C module. This driver works with
pyexpat.__version__ == '2.22'.
"""
--- 1,4 ----
"""
! SAX driver for the pyexpat C module. This driver works with
pyexpat.__version__ == '2.22'.
"""
***************
*** 7,10 ****
--- 7,15 ----
from xml.sax._exceptions import *
+ from xml.sax.handler import feature_validation, feature_namespaces
+ from xml.sax.handler import feature_namespace_prefixes
+ from xml.sax.handler import feature_external_ges, feature_external_pes
+ from xml.sax.handler import feature_string_interning
+ from xml.sax.handler import property_xml_string, property_interning_dict
# xml.parsers.expat does not raise ImportError in Jython
***************
*** 26,31 ****
AttributesNSImpl = xmlreader.AttributesNSImpl
! import string
! import weakref
# --- ExpatLocator
--- 31,46 ----
AttributesNSImpl = xmlreader.AttributesNSImpl
! # If we're using a sufficiently recent version of Python, we can use
! # weak references to avoid cycles between the parser and content
! # handler, otherwise we'll just have to pretend.
! try:
! import _weakref
! except ImportError:
! def _mkproxy(o):
! return o
! else:
! import weakref
! _mkproxy = weakref.proxy
! del weakref, _weakref
# --- ExpatLocator
***************
*** 38,57 ****
"""
def __init__(self, parser):
! self._ref = weakref.ref(parser)
def getColumnNumber(self):
! parser = self._ref()
! if parser is None or parser._parser is None:
return None
return parser._parser.ErrorColumnNumber
def getLineNumber(self):
! parser = self._ref()
! if parser is None or parser._parser is None:
return 1
return parser._parser.ErrorLineNumber
def getPublicId(self):
! parser = self._ref()
if parser is None:
return None
--- 53,72 ----
"""
def __init__(self, parser):
! self._ref = _mkproxy(parser)
def getColumnNumber(self):
! parser = self._ref
! if parser._parser is None:
return None
return parser._parser.ErrorColumnNumber
def getLineNumber(self):
! parser = self._ref
! if parser._parser is None:
return 1
return parser._parser.ErrorLineNumber
def getPublicId(self):
! parser = self._ref
if parser is None:
return None
***************
*** 59,63 ****
def getSystemId(self):
! parser = self._ref()
if parser is None:
return None
--- 74,78 ----
def getSystemId(self):
! parser = self._ref
if parser is None:
return None
***************
*** 68,72 ****
class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator):
! "SAX driver for the Pyexpat C module."
def __init__(self, namespaceHandling=0, bufsize=2**16-20):
--- 83,87 ----
class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator):
! """SAX driver for the pyexpat C module."""
def __init__(self, namespaceHandling=0, bufsize=2**16-20):
***************
*** 78,82 ****
self._parsing = 0
self._entity_stack = []
! self._ns_stack = []
# XMLReader methods
--- 93,98 ----
self._parsing = 0
self._entity_stack = []
! self._external_ges = 1
! self._interning = None
# XMLReader methods
***************
*** 95,99 ****
self._parser.SetBase(source.getSystemId())
! # Redefined setContentHandle to allow changing handlers during parsing
def setContentHandler(self, handler):
--- 111,115 ----
self._parser.SetBase(source.getSystemId())
! # Redefined setContentHandler to allow changing handlers during parsing
def setContentHandler(self, handler):
***************
*** 103,108 ****
def getFeature(self, name):
! if name == handler.feature_namespaces:
return self._namespaces
raise SAXNotRecognizedException("Feature '%s' not recognized" % name)
--- 119,131 ----
def getFeature(self, name):
! if name == feature_namespaces:
return self._namespaces
+ elif name == feature_string_interning:
+ return self._interning is not None
+ elif name in (feature_validation, feature_external_pes,
+ feature_namespace_prefixes):
+ return 0
+ elif name == feature_external_ges:
+ return self._external_ges
raise SAXNotRecognizedException("Feature '%s' not recognized" % name)
***************
*** 110,122 ****
if self._parsing:
raise SAXNotSupportedException("Cannot set features while parsing")
! if name == handler.feature_namespaces:
self._namespaces = state
else:
! raise SAXNotRecognizedException("Feature '%s' not recognized" %
! name)
def getProperty(self, name):
if name == handler.property_lexical_handler:
return self._lex_handler_prop
raise SAXNotRecognizedException("Property '%s' not recognized" % name)
--- 133,179 ----
if self._parsing:
raise SAXNotSupportedException("Cannot set features while parsing")
!
! if name == feature_namespaces:
self._namespaces = state
+ elif name == feature_external_ges:
+ self._external_ges = state
+ elif name == feature_string_interning:
+ if state:
+ if self._interning is None:
+ self._interning = {}
+ else:
+ self._interning = None
+ elif name == feature_validation:
+ if state:
+ raise SAXNotSupportedException(
+ "expat does not support validation")
+ elif name == feature_external_pes:
+ if state:
+ raise SAXNotSupportedException(
+ "expat does not read external parameter entities")
+ elif name == feature_namespace_prefixes:
+ if state:
+ raise SAXNotSupportedException(
+ "expat does not report namespace prefixes")
else:
! raise SAXNotRecognizedException(
! "Feature '%s' not recognized" % name)
def getProperty(self, name):
if name == handler.property_lexical_handler:
return self._lex_handler_prop
+ elif name == property_interning_dict:
+ return self._interning
+ elif name == property_xml_string:
+ if self._parser:
+ if hasattr(self._parser, "GetInputContext"):
+ return self._parser.GetInputContext()
+ else:
+ raise SAXNotRecognizedException(
+ "This version of expat does not support getting"
+ " the XML string")
+ else:
+ raise SAXNotSupportedException(
+ "XML string cannot be returned when not parsing")
raise SAXNotRecognizedException("Property '%s' not recognized" % name)
***************
*** 126,131 ****
if self._parsing:
self._reset_lex_handler_prop()
else:
! raise SAXNotRecognizedException("Property '%s' not recognized" % name)
# IncrementalParser methods
--- 183,194 ----
if self._parsing:
self._reset_lex_handler_prop()
+ elif name == property_interning_dict:
+ self._interning = value
+ elif name == property_xml_string:
+ raise SAXNotSupportedException("Property '%s' cannot be set" %
+ name)
else:
! raise SAXNotRecognizedException("Property '%s' not recognized" %
! name)
# IncrementalParser methods
***************
*** 143,149 ****
# except when invoked from close.
self._parser.Parse(data, isFinal)
! except expat.error:
! error_code = self._parser.ErrorCode
! exc = SAXParseException(expat.ErrorString(error_code), None, self)
# FIXME: when to invoke error()?
self._err_handler.fatalError(exc)
--- 206,211 ----
# except when invoked from close.
self._parser.Parse(data, isFinal)
! except expat.error, e:
! exc = SAXParseException(expat.ErrorString(e.code), e, self)
# FIXME: when to invoke error()?
self._err_handler.fatalError(exc)
***************
*** 165,179 ****
def _reset_lex_handler_prop(self):
! self._parser.CommentHandler = self._lex_handler_prop.comment
! self._parser.StartCdataSectionHandler = self._lex_handler_prop.startCDATA
! self._parser.EndCdataSectionHandler = self._lex_handler_prop.endCDATA
def reset(self):
if self._namespaces:
! self._parser = expat.ParserCreate(None, " ")
self._parser.StartElementHandler = self.start_element_ns
self._parser.EndElementHandler = self.end_element_ns
else:
! self._parser = expat.ParserCreate()
self._parser.StartElementHandler = self.start_element
self._parser.EndElementHandler = self.end_element
--- 227,254 ----
def _reset_lex_handler_prop(self):
! lex = self._lex_handler_prop
! parser = self._parser
! if lex is None:
! parser.CommentHandler = None
! parser.StartCdataSectionHandler = None
! parser.EndCdataSectionHandler = None
! parser.StartDoctypeDeclHandler = None
! parser.EndDoctypeDeclHandler = None
! else:
! parser.CommentHandler = lex.comment
! parser.StartCdataSectionHandler = lex.startCDATA
! parser.EndCdataSectionHandler = lex.endCDATA
! parser.StartDoctypeDeclHandler = self.start_doctype_decl
! parser.EndDoctypeDeclHandler = lex.endDTD
def reset(self):
if self._namespaces:
! self._parser = expat.ParserCreate(None, " ",
! intern=self._interning)
! self._parser.namespace_prefixes = 1
self._parser.StartElementHandler = self.start_element_ns
self._parser.EndElementHandler = self.end_element_ns
else:
! self._parser = expat.ParserCreate(intern = self._interning)
self._parser.StartElementHandler = self.start_element
self._parser.EndElementHandler = self.end_element
***************
*** 192,195 ****
--- 267,277 ----
# self._parser.NotStandaloneHandler =
self._parser.ExternalEntityRefHandler = self.external_entity_ref
+ try:
+ self._parser.SkippedEntityHandler = self.skipped_entity_handler
+ except AttributeError:
+ # This pyexpat does not support SkippedEntity
+ pass
+ self._parser.SetParamEntityParsing(
+ expat.XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE)
self._parsing = 0
***************
*** 222,270 ****
def start_element_ns(self, name, attrs):
! pair = string.split(name)
if len(pair) == 1:
pair = (None, name)
! qname = name
else:
pair = tuple(pair)
- qname = pair[1]
- if self._ns_stack:
- prefix = self._ns_stack[-1][pair[0]][-1]
- if prefix:
- qname = "%s:%s" % (prefix, pair[1])
newattrs = {}
qnames = {}
for (aname, value) in attrs.items():
! apair = string.split(aname)
! if len(apair) == 1:
apair = (None, aname)
! aqname = aname
else:
! apair = tuple(apair)
! # XXX need to guess the prefix
! prefix = self._ns_stack[-1][apair[0]][-1]
! aqname = "%s:%s" % (prefix, apair[1])
newattrs[apair] = value
! qnames[apair] = aqname
! self._cont_handler.startElementNS(pair, qname,
AttributesNSImpl(newattrs, qnames))
def end_element_ns(self, name):
! pair = string.split(name)
if len(pair) == 1:
pair = (None, name)
! qname = name
else:
pair = tuple(pair)
- qname = pair[1]
- if self._ns_stack:
- prefix = self._ns_stack[-1][pair[0]][-1]
- if prefix:
- qname = "%s:%s" % (prefix, pair[1])
! self._cont_handler.endElementNS(pair, qname)
# this is not used (call directly to ContentHandler)
--- 304,350 ----
def start_element_ns(self, name, attrs):
! pair = name.split()
if len(pair) == 1:
+ # no namespace
pair = (None, name)
! elif len(pair) == 3:
! pair = pair[0], pair[1]
else:
+ # default namespace
pair = tuple(pair)
newattrs = {}
qnames = {}
for (aname, value) in attrs.items():
! parts = aname.split()
! length = len(parts)
! if length == 1:
! # no namespace
! qname = aname
apair = (None, aname)
! elif length == 3:
! qname = "%s:%s" % (parts[2], parts[1])
! apair = parts[0], parts[1]
else:
! # default namespace
! qname = parts[1]
! apair = tuple(parts)
newattrs[apair] = value
! qnames[apair] = qname
! self._cont_handler.startElementNS(pair, None,
AttributesNSImpl(newattrs, qnames))
def end_element_ns(self, name):
! pair = name.split()
if len(pair) == 1:
pair = (None, name)
! elif len(pair) == 3:
! pair = pair[0], pair[1]
else:
pair = tuple(pair)
! self._cont_handler.endElementNS(pair, None)
# this is not used (call directly to ContentHandler)
***************
*** 277,297 ****
def start_namespace_decl(self, prefix, uri):
- if self._ns_stack:
- d = self._ns_stack[-1].copy()
- if d.has_key(uri):
- L = d[uri][:]
- d[uri] = L
- L.append(prefix)
- else:
- d[uri] = [prefix]
- else:
- d = {uri: [prefix]}
- self._ns_stack.append(d)
self._cont_handler.startPrefixMapping(prefix, uri)
def end_namespace_decl(self, prefix):
- del self._ns_stack[-1]
self._cont_handler.endPrefixMapping(prefix)
def unparsed_entity_decl(self, name, base, sysid, pubid, notation_name):
self._dtd_handler.unparsedEntityDecl(name, pubid, sysid, notation_name)
--- 357,368 ----
def start_namespace_decl(self, prefix, uri):
self._cont_handler.startPrefixMapping(prefix, uri)
def end_namespace_decl(self, prefix):
self._cont_handler.endPrefixMapping(prefix)
+ def start_doctype_decl(self, name, pubid, sysid, has_internal_subset):
+ self._lex_handler_prop.startDTD(name, pubid, sysid)
+
def unparsed_entity_decl(self, name, base, sysid, pubid, notation_name):
self._dtd_handler.unparsedEntityDecl(name, pubid, sysid, notation_name)
***************
*** 301,304 ****
--- 372,378 ----
def external_entity_ref(self, context, base, sysid, pubid):
+ if not self._external_ges:
+ return 1
+
source = self._ent_handler.resolveEntity(pubid, sysid)
source = saxutils.prepare_input_source(source,
***************
*** 319,326 ****
return 1
# ---
def create_parser(*args, **kwargs):
! return apply(ExpatParser, args, kwargs)
# ---
--- 393,406 ----
return 1
+ def skipped_entity_handler(self, name, is_pe):
+ if is_pe:
+ # The SAX spec requires to report skipped PEs with a '%'
+ name = '%'+name
+ self._cont_handler.skippedEntity(name)
+
# ---
def create_parser(*args, **kwargs):
! return ExpatParser(*args, **kwargs)
# ---
Index: handler.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/python-lib/xml/sax/handler.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** handler.py 21 Dec 2002 14:52:55 -0000 1.2
--- handler.py 10 Nov 2003 12:44:17 -0000 1.3
***************
*** 145,149 ****
name used in the source document, and the attrs parameter
holds an instance of the Attributes class containing the
! attributes of the element."""
def endElementNS(self, name, qname):
--- 145,152 ----
name used in the source document, and the attrs parameter
holds an instance of the Attributes class containing the
! attributes of the element.
!
! The uri part of the name tuple is None for elements which have
! no namespace."""
def endElementNS(self, name, qname):
***************
*** 316,321 ****
# access: read-only
all_properties = [property_lexical_handler,
property_dom_node,
property_declaration_handler,
! property_xml_string]
--- 319,345 ----
# access: read-only
+ property_encoding = "http://www.python.org/sax/properties/encoding"
+ # data type: String
+ # description: The name of the encoding to assume for input data.
+ # access: write: set the encoding, e.g. established by a higher-level
+ # protocol. May change during parsing (e.g. after
+ # processing a META tag)
+ # read: return the current encoding (possibly established through
+ # auto-detection.
+ # initial value: UTF-8
+ #
+
+ property_interning_dict = "http://www.python.org/sax/properties/interning-dict"
+ # data type: Dictionary
+ # description: The dictionary used to intern common strings in the document
+ # access: write: Request that the parser uses a specific dictionary, to
+ # allow interning across different documents
+ # read: return the current interning dictionary, or None
+ #
+
all_properties = [property_lexical_handler,
property_dom_node,
property_declaration_handler,
! property_xml_string,
! property_encoding,
! property_interning_dict]
Index: saxutils.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/python-lib/xml/sax/saxutils.py,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** saxutils.py 1 Jul 2002 02:00:11 -0000 1.1.1.1
--- saxutils.py 10 Nov 2003 12:44:17 -0000 1.2
***************
*** 13,16 ****
--- 13,21 ----
_StringTypes = [types.StringType]
+ def __dict_replace(s, d):
+ """Replace substrings of a string using a dictionary."""
+ for key, value in d.items():
+ s = s.replace(key, value)
+ return s
def escape(data, entities={}):
***************
*** 21,30 ****
strings; each key will be replaced with its corresponding value.
"""
data = data.replace("&", "&")
- data = data.replace("<", "<")
data = data.replace(">", ">")
! for chars, entity in entities.items():
! data = data.replace(chars, entity)
return data
def quoteattr(data, entities={}):
--- 26,51 ----
strings; each key will be replaced with its corresponding value.
"""
+
+ # must do ampersand first
data = data.replace("&", "&")
data = data.replace(">", ">")
! data = data.replace("<", "<")
! if entities:
! data = __dict_replace(data, entities)
return data
+
+ def unescape(data, entities={}):
+ """Unescape &, <, and > in a string of data.
+
+ You can unescape other strings of data by passing a dictionary as
+ the optional entities parameter. The keys and values must all be
+ strings; each key will be replaced with its corresponding value.
+ """
+ data = data.replace("<", "<")
+ data = data.replace(">", ">")
+ if entities:
+ data = __dict_replace(data, entities)
+ # must do ampersand last
+ return data.replace("&", "&")
def quoteattr(data, entities={}):
Index: xmlreader.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/python-lib/xml/sax/xmlreader.py,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** xmlreader.py 1 Jul 2002 02:00:12 -0000 1.1.1.1
--- xmlreader.py 10 Nov 2003 12:44:17 -0000 1.2
***************
*** 322,325 ****
--- 322,328 ----
return self._attrs.has_key(name)
+ def __contains__(self, name):
+ return self._attrs.has_key(name)
+
def get(self, name, alternative=None):
return self._attrs.get(name, alternative)
|
|
From: <co...@us...> - 2003-11-10 12:44:20
|
Update of /cvsroot/wpdev/xmlscripts/python-lib/xml In directory sc8-pr-cvs1:/tmp/cvs-serv5168/xml Modified Files: __init__.py Log Message: Updated to Python 2.3.2 Index: __init__.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/python-lib/xml/__init__.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** __init__.py 21 Dec 2002 14:52:55 -0000 1.2 --- __init__.py 10 Nov 2003 12:44:17 -0000 1.3 *************** *** 22,26 **** ! _MINIMUM_XMLPLUS_VERSION = (0, 6, 1) --- 22,26 ---- ! _MINIMUM_XMLPLUS_VERSION = (0, 8, 2) |
|
From: <co...@us...> - 2003-11-10 12:44:19
|
Update of /cvsroot/wpdev/xmlscripts/python-lib/hotshot
In directory sc8-pr-cvs1:/tmp/cvs-serv5168/hotshot
Modified Files:
__init__.py log.py
Log Message:
Updated to Python 2.3.2
Index: __init__.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/python-lib/hotshot/__init__.py,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** __init__.py 1 Jul 2002 01:57:26 -0000 1.1.1.1
--- __init__.py 10 Nov 2003 12:44:16 -0000 1.2
***************
*** 13,26 ****
--- 13,43 ----
logfn, self.lineevents, self.linetimings)
+ # Attempt to avoid confusing results caused by the presence of
+ # Python wrappers around these functions, but only if we can
+ # be sure the methods have not been overridden or extended.
+ if self.__class__ is Profile:
+ self.close = p.close
+ self.start = p.start
+ self.stop = p.stop
+ self.addinfo = p.addinfo
+
def close(self):
+ """Close the logfile and terminate the profiler."""
self._prof.close()
+ def fileno(self):
+ """Return the file descriptor of the profiler's log file."""
+ return self._prof.fileno()
+
def start(self):
+ """Start the profiler."""
self._prof.start()
def stop(self):
+ """Stop the profiler."""
self._prof.stop()
def addinfo(self, key, value):
+ """Add an arbitrary labelled value to the profile log."""
self._prof.addinfo(key, value)
***************
*** 29,32 ****
--- 46,55 ----
def run(self, cmd):
+ """Profile an exec-compatible string in the script
+ environment.
+
+ The globals from the __main__ module are used as both the
+ globals and locals for the script.
+ """
import __main__
dict = __main__.__dict__
***************
*** 34,37 ****
--- 57,65 ----
def runctx(self, cmd, globals, locals):
+ """Evaluate an exec-compatible string in a specific
+ environment.
+
+ The string is compiled before profiling begins.
+ """
code = compile(cmd, "<string>", "exec")
self._prof.runcode(code, globals, locals)
***************
*** 39,41 ****
--- 67,76 ----
def runcall(self, func, *args, **kw):
+ """Profile a single call of a callable.
+
+ Additional positional and keyword arguments may be passed
+ along; the result of the call is returned, and exceptions are
+ allowed to propogate cleanly, while ensuring that profiling is
+ disabled on the way out.
+ """
return self._prof.runcall(func, args, kw)
Index: log.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/python-lib/hotshot/log.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** log.py 21 Dec 2002 14:52:55 -0000 1.2
--- log.py 10 Nov 2003 12:44:16 -0000 1.3
***************
*** 22,31 ****
- try:
- StopIteration
- except NameError:
- StopIteration = IndexError
-
-
class LogReader:
def __init__(self, logfn):
--- 22,25 ----
***************
*** 42,49 ****
--- 36,56 ----
else:
self.cwd = None
+
+ # This mirrors the call stack of the profiled code as the log
+ # is read back in. It contains tuples of the form:
+ #
+ # (file name, line number of function def, function name)
+ #
self._stack = []
self._append = self._stack.append
self._pop = self._stack.pop
+ def close(self):
+ self._reader.close()
+
+ def fileno(self):
+ """Return the file descriptor of the log reader's log file."""
+ return self._reader.fileno()
+
def addinfo(self, key, value):
"""This method is called for each additional ADD_INFO record.
***************
*** 89,98 ****
def next(self, index=0):
while 1:
! try:
! what, tdelta, fileno, lineno = self._nextitem()
! except TypeError:
! # logreader().next() returns None at the end
! self._reader.close()
! raise StopIteration()
# handle the most common cases first
--- 96,101 ----
def next(self, index=0):
while 1:
! # This call may raise StopIteration:
! what, tdelta, fileno, lineno = self._nextitem()
# handle the most common cases first
***************
*** 100,112 ****
if what == WHAT_ENTER:
filename, funcname = self._decode_location(fileno, lineno)
! self._append((filename, funcname, lineno))
! return what, (filename, lineno, funcname), tdelta
if what == WHAT_EXIT:
! filename, funcname, lineno = self._pop()
! return what, (filename, lineno, funcname), tdelta
if what == WHAT_LINENO:
! filename, funcname, firstlineno = self._stack[-1]
return what, (filename, lineno, funcname), tdelta
--- 103,115 ----
if what == WHAT_ENTER:
filename, funcname = self._decode_location(fileno, lineno)
! t = (filename, lineno, funcname)
! self._append(t)
! return what, t, tdelta
if what == WHAT_EXIT:
! return what, self._pop(), tdelta
if what == WHAT_LINENO:
! filename, firstlineno, funcname = self._stack[-1]
return what, (filename, lineno, funcname), tdelta
***************
*** 127,137 ****
raise ValueError, "unknown event type"
! if sys.version < "2.2":
! # Don't add this for newer Python versions; we only want iteration
! # support, not general sequence support.
! __getitem__ = next
! else:
! def __iter__(self):
! return self
#
--- 130,135 ----
raise ValueError, "unknown event type"
! def __iter__(self):
! return self
#
|
|
From: <co...@us...> - 2003-11-10 12:35:44
|
Update of /cvsroot/wpdev/xmlscripts/web In directory sc8-pr-cvs1:/tmp/cvs-serv4569 Modified Files: sessions.py Log Message: Fixed "cannot find the path sessions/*" at first start. Index: sessions.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/web/sessions.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sessions.py 5 Jan 2003 20:37:38 -0000 1.3 --- sessions.py 10 Nov 2003 12:35:37 -0000 1.4 *************** *** 106,109 **** --- 106,112 ---- """ def clear_sessions(): + if not os.path.exists( 'sessions' ): + os.mkdir( 'sessions', 0700 ) + files = os.listdir( 'sessions/' ) for file in files: |
|
From: <co...@us...> - 2003-11-03 08:30:50
|
Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv13706
Modified Files:
accounts.cpp
Log Message:
Fixed case insensitive logins was sensitive.
Index: accounts.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/accounts.cpp,v
retrieving revision 1.70
retrieving revision 1.71
diff -C2 -d -r1.70 -r1.71
*** accounts.cpp 1 Oct 2003 20:47:34 -0000 1.70
--- accounts.cpp 3 Nov 2003 08:30:46 -0000 1.71
***************
*** 380,384 ****
account->blockUntil.setTime_t( result.getInt( 5 ) );
! accounts.insert( account->login_, account );
}
}
--- 380,384 ----
account->blockUntil.setTime_t( result.getInt( 5 ) );
! accounts.insert( account->login_.lower(), account );
}
}
***************
*** 441,445 ****
{
cAccount* d = new cAccount;
! d->login_ = login;
d->password_ = password;
accounts.insert(d->login(), d);
--- 441,445 ----
{
cAccount* d = new cAccount;
! d->login_ = login.lower();
d->password_ = password;
accounts.insert(d->login(), d);
|
|
From: <as...@us...> - 2003-11-03 01:17:12
|
Update of /cvsroot/wpdev/wolfpack In directory sc8-pr-cvs1:/tmp/cvs-serv13974 Modified Files: configure Log Message: ./configure should shut up with the "use ./configure" warning now. Index: configure =================================================================== RCS file: /cvsroot/wpdev/wolfpack/configure,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** configure 1 Oct 2003 17:42:39 -0000 1.2 --- configure 3 Nov 2003 01:17:09 -0000 1.3 *************** *** 66,72 **** if [ -x "$QTDIR/bin/qmake" ]; then ! $QTDIR/bin/qmake -o Makefile wolfpack.pro > /dev/null; else ! qmake -o Makefile wolfpack.pro > /dev/null; fi; --- 66,72 ---- if [ -x "$QTDIR/bin/qmake" ]; then ! $QTDIR/bin/qmake -o Makefile wolfpack.pro > /dev/null 2>&1; else ! qmake -o Makefile wolfpack.pro > /dev/null 2>&1; fi; |
|
From: <co...@us...> - 2003-11-01 14:51:44
|
Update of /cvsroot/wpdev/xmlscripts/definitions In directory sc8-pr-cvs1:/tmp/cvs-serv21835/definitions Modified Files: scripts.xml Log Message: Fixed paths Index: scripts.xml =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/definitions/scripts.xml,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** scripts.xml 8 Oct 2003 01:36:40 -0000 1.68 --- scripts.xml 1 Nov 2003 14:51:38 -0000 1.69 *************** *** 53,68 **** <script>runebook</script> <script>scroll</script> ! <script>wolfpack.magic</script> <script>wolfpack.magic.reactivearmor</script> <script>wolfpack.magic.trap</script> ! <script>wolfpack.magic.firefield</script> ! <script>wolfpack.magic.circle1</script> ! <script>wolfpack.magic.circle2</script> ! <script>wolfpack.magic.circle3</script> ! <script>wolfpack.magic.circle4</script> ! <script>wolfpack.magic.circle5</script> ! <script>wolfpack.magic.circle6</script> ! <script>wolfpack.magic.circle7</script> ! <script>wolfpack.magic.circle8</script> <!-- Multis --> --- 53,68 ---- <script>runebook</script> <script>scroll</script> ! <script>spells</script> <script>wolfpack.magic.reactivearmor</script> <script>wolfpack.magic.trap</script> ! <script>spells.circle4.firefield</script> ! <script>spells.circle1</script> ! <script>spells.circle2</script> ! <script>spells.circle3</script> ! <script>spells.circle4</script> ! <script>spells.circle5</script> ! <script>spells.circle6</script> ! <script>spells.circle7</script> ! <script>spells.circle8</script> <!-- Multis --> |
|
From: <co...@us...> - 2003-10-30 10:46:19
|
Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv26492
Modified Files:
items.cpp
Log Message:
Fixed: items copying
Index: items.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/items.cpp,v
retrieving revision 1.357
retrieving revision 1.358
diff -C2 -d -r1.357 -r1.358
*** items.cpp 25 Sep 2003 03:05:58 -0000 1.357
--- items.cpp 30 Oct 2003 10:46:16 -0000 1.358
***************
*** 84,123 ****
cItem::cItem( const cItem &src )
{
! changed( TOOLTIP );
! flagChanged();
this->name_ = src.name_;
- this->incognito = src.incognito;
-
this->setMultis( src.multis() );
- this->free = false;
- this->setId(src.id());
this->setPos(src.pos());
! this->color_ = src.color_;
! this->layer_ = src.layer_;
! this->type_ = src.type_;
! this->type2_ = src.type2_;
! this->weight_ = src.weight_;
this->amount_ = src.amount_;
this->def_ = src.def_;
! this->lodamage_=src.lodamage_;
this->hidamage_=src.hidamage_;
this->hp_ = src.hp_;
! this->maxhp_ = src.maxhp_;
! this->speed_=src.speed_;
this->magic_ = src.magic_;
! this->decaytime_ = src.decaytime_;
! this->setOwnSerialOnly(src.ownSerial());
! this->visible_=src.visible_;
! this->spawnregion_=src.spawnregion_;
this->priv_=src.priv_;
- this->buyprice_ = src.buyprice_;
- this->sellprice_ = src.sellprice_;
this->restock_ = src.restock_;
! this->poisoned_ = src.poisoned_;
this->time_unused=src.time_unused;
this->timeused_last=getNormalizedTime();
- this->container_ = src.container_;
this->totalweight_ = src.totalweight_;
! setTotalweight( amount_ * weight_ );
}
--- 84,134 ----
cItem::cItem( const cItem &src )
{
! //cUObject properties setting
! this->bindmenu_ = src.bindmenu();
! this->dir_ = src.direction();
! this->eventList_ = src.eventList_;
this->name_ = src.name_;
this->setMultis( src.multis() );
this->setPos(src.pos());
! this->tooltip_ = src.tooltip_;
!
! //cItem properties setting
this->amount_ = src.amount_;
+ this->antispamtimer_ = src.antispamtimer();
+ this->buyprice_ = src.buyprice_;
+ this->changed( TOOLTIP );
+ this->color_ = src.color_;
+ this->container_ = src.container_;
+ this->decaytime_ = src.decaytime_;
this->def_ = src.def_;
! this->flagChanged();
! this->free = false;
this->hidamage_=src.hidamage_;
this->hp_ = src.hp_;
! this->incognito = src.incognito;
! this->isPersistent = src.isPersistent;
! this->layer_ = src.layer_;
! this->lodamage_=src.lodamage_;
this->magic_ = src.magic_;
! this->maxhp_ = src.maxhp_;
! this->poisoned_ = src.poisoned_;
this->priv_=src.priv_;
this->restock_ = src.restock_;
! this->sellprice_ = src.sellprice_;
! this->setId(src.id());
! this->setOwnSerialOnly(src.ownSerial());
! this->spawnregion_=src.spawnregion_;
! this->speed_=src.speed_;
this->time_unused=src.time_unused;
this->timeused_last=getNormalizedTime();
this->totalweight_ = src.totalweight_;
! this->type2_ = src.type2_;
! this->type_ = src.type_;
! this->visible_=src.visible_;
! this->weight_ = src.weight_;
!
! this->setTotalweight( amount_ * weight_ );
! this->recreateEvents();
!
}
|
|
From: <co...@us...> - 2003-10-29 14:30:11
|
Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv9575
Modified Files:
console_win.cpp
Log Message:
Fixed uptime format
Index: console_win.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/console_win.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** console_win.cpp 13 Oct 2003 00:11:47 -0000 1.17
--- console_win.cpp 29 Oct 2003 14:30:08 -0000 1.18
***************
*** 264,268 ****
lblUptime = CreateWindow( "STATIC", 0, WS_CHILD|WS_VISIBLE, 400, 15, 250, 25, hwnd, 0, appInstance, 0 );
-
// Set up our timer to refresh the nice Uptime Counter
uptimeTimer = SetTimer( NULL, 0, 500, 0 );
--- 264,267 ----
***************
*** 509,513 ****
{
char message[512];
! sprintf( message, "Uptime: %02u:%02u:%02u", ( uiCurrentTime / 1000 / 3600 ), ( uiCurrentTime / 1000 / 60 ) % 60, ( uiCurrentTime / 1000 ) % 3600 );
SetWindowText( lblUptime, message );
}
--- 508,519 ----
{
char message[512];
!
! unsigned int msecs, seconds, minutes, hours, days;
! days = uiCurrentTime / 86400000;
! hours = (uiCurrentTime % 86400000) / 3600000;
! minutes = (( uiCurrentTime % 86400000 ) % 3600000 ) / 60000;
! seconds = ((( uiCurrentTime % 86400000 ) % 3600000 ) % 60000 ) / 1000;
!
! sprintf( message, "Uptime: %u:%02u:%02u:%02u", days, hours, minutes, seconds );
SetWindowText( lblUptime, message );
}
|
|
From: <co...@us...> - 2003-10-29 12:31:20
|
Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv21228
Modified Files:
world.cpp
Log Message:
Fixed crash at postprocessing
Index: world.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/world.cpp,v
retrieving revision 1.48
retrieving revision 1.49
diff -C2 -d -r1.48 -r1.49
*** world.cpp 30 Sep 2003 15:06:29 -0000 1.48
--- world.cpp 29 Oct 2003 12:31:17 -0000 1.49
***************
*** 530,534 ****
if( pCont )
{
! pCont->addItem( pi, false, true, true );
}
else
--- 530,534 ----
if( pCont )
{
! pCont->addItem( pi, false, isCharSerial( reinterpret_cast<SERIAL>( pCont->container() ) )?false:true, true );
}
else
|
|
From: <as...@us...> - 2003-10-24 12:05:52
|
Update of /cvsroot/wpdev/wolfpack/setup.d In directory sc8-pr-cvs1:/tmp/cvs-serv14375/setup.d Modified Files: check Log Message: wait for user so that he/she can check for errors ;) Index: check =================================================================== RCS file: /cvsroot/wpdev/wolfpack/setup.d/check,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** check 15 Oct 2003 02:46:49 -0000 1.4 --- check 23 Oct 2003 21:03:06 -0000 1.5 *************** *** 193,194 **** --- 193,197 ---- check_include SQLite SQLITE /usr/include/sqlite.h /usr/local/include/sqlite.h; # ++ SQLITE check_lib SQLite SQLITE /usr/lib/libsqlite.so /usr/local/lib/libsqlite.so; # -- SQLITE + + echo -en "\e[1mPress \e[32mENTER\e[m\e[1m to continue.\e[m"; + read; |
|
From: <as...@us...> - 2003-10-24 00:15:12
|
Update of /cvsroot/wpdev/wolfpack/setup.d
In directory sc8-pr-cvs1:/tmp/cvs-serv14985/setup.d
Modified Files:
config
Log Message:
added input menu to allow the user to change paths
Index: config
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/setup.d/config,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** config 15 Oct 2003 02:47:35 -0000 1.2
--- config 23 Oct 2003 21:05:19 -0000 1.3
***************
*** 19,30 ****
for CUR_INC in $INC_PRE;
do
! eval "echo -n \"\\\"\$(echo \"\$${CUR_INC}_INCDIRS\"|sed -e 's/^(\([^)]\+\)).*$/\1/') include dir\\\" \\\"\$(echo \"\$${CUR_INC}_INCDIRS\"|sed -e 's/^([^)]\+) \+\([^ ]\+\).*$/\1/')\\\" \";" >> "$DIALOG_CACHE";
done;
for CUR_LIB in $LIB_PRE;
do
! eval "echo -n \"\\\"\$(echo \"\$${CUR_LIB}_LIBDIRS\"|sed -e 's/^(\([^)]\+\)).*$/\1/') library dir\\\" \\\"\$(echo \"\$${CUR_LIB}_LIBDIRS\"|sed -e 's/^([^)]\+) \+\([^ ]\+\).*$/\1/')\\\" \";" >> "$DIALOG_CACHE";
! eval "echo -n \"\\\"\$(echo \"\$${CUR_LIB}_LIBFILES\"|sed -e 's/^(\([^)]\+\)).*$/\1/') library name\\\" \\\"\$(echo \"\$${CUR_LIB}_LIBFILES\"|sed -e 's/^([^)]\+) \+\([^ ]\+\).*$/\1/')\\\" \";" >> "$DIALOG_CACHE";
done;
! eval "$DIALOG --menu \"Wolfpack Emu Setup\" 0 0 0 $(< $DIALOG_CACHE)";
--- 19,53 ----
for CUR_INC in $INC_PRE;
do
! eval "echo -n \"\\\"\$(echo \"\$${CUR_INC}_INCDIRS\"|sed -e 's/^(\([^)]\+\)).*$/\1/') include dir\\\" \\\"\$(echo \"\$${CUR_INC}_INCDIRS\"|sed -e 's/^([^)]\+) \+\([^ ]\+\).*$\|^([^)]\+) \(.*\)$/\1/')\\\" \";" >> "$DIALOG_CACHE";
done;
for CUR_LIB in $LIB_PRE;
do
! eval "echo -n \"\\\"\$(echo \"\$${CUR_LIB}_LIBDIRS\"|sed -e 's/^(\([^)]\+\)).*$/\1/') library dir\\\" \\\"\$(echo \"\$${CUR_LIB}_LIBDIRS\"|sed -e 's/^([^)]\+) \+\([^ ]\+\).*$\|^([^)]\+) \(.*\)$/\1/')\\\" \";" >> "$DIALOG_CACHE";
! eval "echo -n \"\\\"\$(echo \"\$${CUR_LIB}_LIBFILES\"|sed -e 's/^(\([^)]\+\)).*$/\1/') library name\\\" \\\"\$(echo \"\$${CUR_LIB}_LIBFILES\"|sed -e 's/^([^)]\+) \+\([^ ]\+\).*$\|^([^)]\+) \(.*\)$/\1/')\\\" \";" >> "$DIALOG_CACHE";
done;
! get_varent()
! {
! AMOUNT=2;
! while ! cut -d'"' -f$AMOUNT "$DIALOG_CACHE"|grep "^${1}$" > /dev/null 2>&1;
! do
! AMOUNT=$(expr $AMOUNT + 4);
! done;
! cut -d'"' -f$(expr $AMOUNT + 2) "$DIALOG_CACHE";
! }
!
! # TODO: version fields should be read-only!
!
! eval "$DIALOG --menu \"Wolfpack Emu Setup\" 0 0 0 $(< $DIALOG_CACHE) \"\" \"\" \"Exit\" \"Exit configuration and proceed.\"" 2>> "$SETUP_CACHE";
!
! case "$?" in
! 0) ;;
! *) exit;;
! esac;
!
! # TODO: get the line spacer and loop
!
! tail -1 "$SETUP_CACHE"|grep "^Exit$" > /dev/null 2>&1 && exit;
!
! $DIALOG --inputbox "$(tail -1 "$SETUP_CACHE")?" 0 0 "$(get_varent "$(tail -1 "$SETUP_CACHE")")";
|
|
From: <as...@us...> - 2003-10-15 03:02:39
|
Update of /cvsroot/wpdev/wolfpack In directory sc8-pr-cvs1:/tmp/cvs-serv24955 Modified Files: setup.sh Log Message: aiieh, removed run-parts dependancy, because it's debian only Index: setup.sh =================================================================== RCS file: /cvsroot/wpdev/wolfpack/setup.sh,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** setup.sh 14 Oct 2003 14:12:10 -0000 1.4 --- setup.sh 15 Oct 2003 03:02:34 -0000 1.5 *************** *** 2,6 **** CONFIG_FILE="setup.cf"; SETUP_BASEDIR="setup.d"; ! NECESSARY_COMMANDS="bash seq run-parts expr grep sed cut head tail chmod dirname basename"; # --- 2,6 ---- CONFIG_FILE="setup.cf"; SETUP_BASEDIR="setup.d"; ! NECESSARY_COMMANDS="bash seq expr grep sed cut head tail chmod dirname basename"; # *************** *** 207,209 **** export CONFIG_FILE; ! run-parts "$SETUP_BASEDIR"; --- 207,215 ---- export CONFIG_FILE; ! for SETUP_FILE in $SETUP_BASEDIR/*; ! do ! if [ -f "$SETUP_FILE" ]; ! then ! "$SETUP_FILE"; ! fi; ! done; |
|
From: <as...@us...> - 2003-10-15 02:47:38
|
Update of /cvsroot/wpdev/wolfpack/setup.d
In directory sc8-pr-cvs1:/tmp/cvs-serv22897/setup.d
Modified Files:
config
Log Message:
base menu works (but has no functionality, yet)
Index: config
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/setup.d/config,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** config 14 Oct 2003 04:19:11 -0000 1.1
--- config 15 Oct 2003 02:47:35 -0000 1.2
***************
*** 1,2 ****
--- 1,30 ----
#!/bin/bash
. "$CONFIG_FILE";
+ . "$SETUP_CACHE";
+
+ # TODO: cleanup, the regexp are unreadable :/
+
+ BIN_PRE="$(grep '^[^#]\+# ||' "$CHECK"|sed -e 's/^[^#]\+# || \(.*\)$/\1/')";
+ INC_PRE="$(grep '^[^#]\+# ++' "$CHECK"|sed -e 's/^[^#]\+# ++ \(.*\)$/\1/')";
+ LIB_PRE="$(grep '^[^#]\+# --' "$CHECK"|sed -e 's/^[^#]\+# -- \(.*\)$/\1/')";
+
+ echo -n > "$DIALOG_CACHE";
+
+ for CUR_BIN in $BIN_PRE;
+ do
+ eval "echo -n \"\\\"$CUR_BIN path\\\" \\\"\$${CUR_BIN}_PATH\\\" \";" >> "$DIALOG_CACHE";
+ eval "echo -n \"\\\"$CUR_BIN version\\\" \\\"\$${CUR_BIN}_VERSION\\\" \";" >> "$DIALOG_CACHE";
+ done;
+
+ for CUR_INC in $INC_PRE;
+ do
+ eval "echo -n \"\\\"\$(echo \"\$${CUR_INC}_INCDIRS\"|sed -e 's/^(\([^)]\+\)).*$/\1/') include dir\\\" \\\"\$(echo \"\$${CUR_INC}_INCDIRS\"|sed -e 's/^([^)]\+) \+\([^ ]\+\).*$/\1/')\\\" \";" >> "$DIALOG_CACHE";
+ done;
+
+ for CUR_LIB in $LIB_PRE;
+ do
+ eval "echo -n \"\\\"\$(echo \"\$${CUR_LIB}_LIBDIRS\"|sed -e 's/^(\([^)]\+\)).*$/\1/') library dir\\\" \\\"\$(echo \"\$${CUR_LIB}_LIBDIRS\"|sed -e 's/^([^)]\+) \+\([^ ]\+\).*$/\1/')\\\" \";" >> "$DIALOG_CACHE";
+ eval "echo -n \"\\\"\$(echo \"\$${CUR_LIB}_LIBFILES\"|sed -e 's/^(\([^)]\+\)).*$/\1/') library name\\\" \\\"\$(echo \"\$${CUR_LIB}_LIBFILES\"|sed -e 's/^([^)]\+) \+\([^ ]\+\).*$/\1/')\\\" \";" >> "$DIALOG_CACHE";
+ done;
+
+ eval "$DIALOG --menu \"Wolfpack Emu Setup\" 0 0 0 $(< $DIALOG_CACHE)";
|
|
From: <as...@us...> - 2003-10-15 02:46:53
|
Update of /cvsroot/wpdev/wolfpack/setup.d
In directory sc8-pr-cvs1:/tmp/cvs-serv22828/setup.d
Modified Files:
check
Log Message:
ident chars for config script
Index: check
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/setup.d/check,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** check 14 Oct 2003 14:12:56 -0000 1.3
--- check 15 Oct 2003 02:46:49 -0000 1.4
***************
*** 2,5 ****
--- 2,7 ----
. "$CONFIG_FILE";
+ echo "CHECK=\"$0\"" > "$SETUP_CACHE";
+
check_dialog()
{
***************
*** 9,17 ****
if [ -x "$DIALOG" ];
then
! echo "DIALOG=\"$DIALOG\"" > "$SETUP_CACHE";
echo "${DIALOG}.";
elif [ -x "$WHIPTAIL" ];
then
! echo "DIALOG=\"$WHIPTAIL\"" > "$SETUP_CACHE";
echo "${WHIPTAIL}.";
else
--- 11,19 ----
if [ -x "$DIALOG" ];
then
! echo "DIALOG=\"$DIALOG\"" >> "$SETUP_CACHE";
echo "${DIALOG}.";
elif [ -x "$WHIPTAIL" ];
then
! echo "DIALOG=\"$WHIPTAIL\"" >> "$SETUP_CACHE";
echo "${WHIPTAIL}.";
else
***************
*** 57,62 ****
if [ "$MAKE_VERSION" ];
then
! echo "MAKE_PATH=\"$(which make)\";" >> "$SETUP_CACHE";
! echo "MAKE_VERSION=\"$(echo "$MAKE_VERSION"|cut -d' ' -f4)\";" >> "$SETUP_CACHE";
echo "${MAKE_VERSION}.";
else
--- 59,64 ----
if [ "$MAKE_VERSION" ];
then
! echo "MAKE_PATH=\"$(which make)\"" >> "$SETUP_CACHE";
! echo "MAKE_VERSION=\"$(echo "$MAKE_VERSION"|cut -d' ' -f4)\"" >> "$SETUP_CACHE";
echo "${MAKE_VERSION}.";
else
***************
*** 71,75 ****
if [ ! "$QMAKE_PATH" ];
then
! QMAKE_PATH="which $QTDIR/bin/qmake";
fi;
--- 73,86 ----
if [ ! "$QMAKE_PATH" ];
then
! if [ "$QTDIR" ];
! then
! QMAKE_PATH="which $QTDIR/bin/qmake";
! else
! QMAKE_PATH="which /usr/share/qt3/bin/qmake";
! if [ ! "$QMAKE_PATH" ];
! then
! QMAKE_PATH="which /usr/share/qt/bin/qmake";
! fi;
! fi;
fi;
***************
*** 111,115 ****
done;
! echo "${CONF_VAR}_INCDIRS=\"$INCLUDE_DIRLIST\"" >> "$SETUP_CACHE";
if [ "$INCLUDE_DIRLIST" ];
then
--- 122,126 ----
done;
! echo "${CONF_VAR}_INCDIRS=\"($LIBRARY) $INCLUDE_DIRLIST\"" >> "$SETUP_CACHE";
if [ "$INCLUDE_DIRLIST" ];
then
***************
*** 149,154 ****
done;
! echo "${CONF_VAR}_LIBDIRS=\"$LIBRARY_DIRLIST\"" >> "$SETUP_CACHE";
! echo "${CONF_VAR}_LIBFILES=\"$LIBRARY_FILELIST\"" >> "$SETUP_CACHE";
if [ "$LIBRARY_DIRLIST" ] && [ "$LIBRARY_FILELIST" ];
--- 160,165 ----
done;
! echo "${CONF_VAR}_LIBDIRS=\"($LIBRARY) $LIBRARY_DIRLIST\"" >> "$SETUP_CACHE";
! echo "${CONF_VAR}_LIBFILES=\"($LIBRARY) $LIBRARY_FILELIST\"" >> "$SETUP_CACHE";
if [ "$LIBRARY_DIRLIST" ] && [ "$LIBRARY_FILELIST" ];
***************
*** 160,169 ****
}
! check_dialog;
! check_gcc;
! check_make;
! check_qmake;
! check_include Python PYTHON /usr/include/python*/Python.h /usr/local/include/python*/Python.h;
! check_lib Python PYTHON /usr/lib/libpython*.so /usr/local/lib/libpython*.so;
! echo -e "\e[1;44;32msetup.sh doesn't work currently, yet!\e[m";
--- 171,194 ----
}
! #
! # || -> binary depends
! # ++ -> include depends
! # -- -> library depends
! #
! check_dialog; # || GCC
! check_gcc; # || GPP
! check_make; # || MAKE
! check_qmake; # || QMAKE
!
! check_include Qt QT /usr/include/qt3/qt.h /usr/include/qt/qt.h /usr/local/include/qt3/qt.h /usr/local/include/qt/qt.h /usr/share/qt3/include/qt.h /usr/share/qt/include/qt.h; # ++ QT
! check_lib Qt QT /usr/lib/libqt-mt.so /usr/local/lib/libqt-mt.so /usr/share/qt/lib/libqt-mt.so /usr/share/qt3/lib/libqt-mt.so; # -- QT
!
! check_include Python PYTHON /usr/include/python*/Python.h /usr/local/include/python*/Python.h; # ++ PYTHON
! check_lib Python PYTHON /usr/lib/libpython*.so /usr/local/lib/libpython*.so; # -- PYTHON
!
! check_include MySQL MYSQL /usr/include/mysql/mysql.h /usr/local/include/mysql/mysql.h; # ++ MYSQL
! check_lib MySQL MYSQL /usr/lib/libmysqlclient.so /usr/local/lib/libmysqlclient.so; # -- MYSQL
!
! check_include SQLite SQLITE /usr/include/sqlite.h /usr/local/include/sqlite.h; # ++ SQLITE
! check_lib SQLite SQLITE /usr/lib/libsqlite.so /usr/local/lib/libsqlite.so; # -- SQLITE
|
|
From: <as...@us...> - 2003-10-15 02:46:01
|
Update of /cvsroot/wpdev/wolfpack In directory sc8-pr-cvs1:/tmp/cvs-serv22729 Modified Files: setup.cf Log Message: temporary file for dialog Index: setup.cf =================================================================== RCS file: /cvsroot/wpdev/wolfpack/setup.cf,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** setup.cf 14 Oct 2003 06:35:18 -0000 1.2 --- setup.cf 15 Oct 2003 02:45:56 -0000 1.3 *************** *** 1,2 **** --- 1,3 ---- # config file for setup.sh SETUP_CACHE="setup.tmp" + DIALOG_CACHE="setup.mnu" |
|
From: <as...@us...> - 2003-10-14 14:13:00
|
Update of /cvsroot/wpdev/wolfpack/setup.d
In directory sc8-pr-cvs1:/tmp/cvs-serv13238
Modified Files:
check
Log Message:
library checking now works (current example entry is for python).
Index: check
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/setup.d/check,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** check 14 Oct 2003 06:35:52 -0000 1.2
--- check 14 Oct 2003 14:12:56 -0000 1.3
***************
*** 92,103 ****
check_include()
{
! LIBRARY="$1";
! echo "Checking for $LIBRARY includes...";
}
check_lib()
{
! LIBRARY="$1";
! echo "Checking for $LIBRARY library...";
}
--- 92,161 ----
check_include()
{
! LIBRARY="$1"; shift;
! CONF_VAR="$1"; shift;
! DEFAULT_INCLUDES="$@";
! echo -n "Checking for $LIBRARY includes... ";
! INCLUDE_DIRS="";
! for INCFILE in $@;
! do
! if [ -f "$INCFILE" ];
! then
! INCLUDE_DIRS="$INCLUDE_DIRS\n$(dirname "$INCFILE")";
! fi;
! done;
!
! INCLUDE_DIRLIST="";
! for INC_FIELD in $(echo -e "$INCLUDE_DIRS"|sort -ru);
! do
! INCLUDE_DIRLIST="$INCLUDE_DIRLIST${INCLUDE_DIRLIST:+ }$INC_FIELD";
! done;
!
! echo "${CONF_VAR}_INCDIRS=\"$INCLUDE_DIRLIST\"" >> "$SETUP_CACHE";
! if [ "$INCLUDE_DIRLIST" ];
! then
! echo "$(echo "$INCLUDE_DIRLIST"|cut -d' ' -f1)."
! else
! echo "not found.";
! fi;
}
check_lib()
{
! LIBRARY="$1"; shift;
! CONF_VAR="$1"; shift;
! DEFAULT_INCLUDES="$@";
! echo -n "Checking for $LIBRARY library... ";
! LIBRARY_DIRS="";
! LIBRARY_FILES="";
! for LIBFILE in $@;
! do
! if [ -f "$LIBFILE" ];
! then
! LIBRARY_DIRS="$LIBRARY_DIRS\n$(dirname "$LIBFILE")";
! LIBRARY_FILES="$LIBRARY_FILES\n$(basename "$LIBFILE"|sed -e 's/^lib\(.\+\)\.so$/\1/')";
! fi;
! done;
!
! LIBRARY_DIRLIST="";
! for LIB_FIELD in $(echo -e "$LIBRARY_DIRS"|sort -ru);
! do
! LIBRARY_DIRLIST="$LIBRARY_DIRLIST${LIBRARY_DIRLIST:+ }$LIB_FIELD";
! done;
!
! LIBRARY_FILELIST="";
! for LIB_FIELD in $(echo -e "$LIBRARY_FILES"|sort -ru);
! do
! LIBRARY_FILELIST="$LIBRARY_FILELIST${LIBRARY_FILELIST:+ }$LIB_FIELD";
! done;
!
! echo "${CONF_VAR}_LIBDIRS=\"$LIBRARY_DIRLIST\"" >> "$SETUP_CACHE";
! echo "${CONF_VAR}_LIBFILES=\"$LIBRARY_FILELIST\"" >> "$SETUP_CACHE";
!
! if [ "$LIBRARY_DIRLIST" ] && [ "$LIBRARY_FILELIST" ];
! then
! echo "$(echo "$LIBRARY_DIRLIST"|cut -d' ' -f1) -l$(echo "$LIBRARY_FILELIST"|cut -d' ' -f1)."
! else
! echo "not found.";
! fi;
}
***************
*** 106,111 ****
check_make;
check_qmake;
! check_include MySQL;
! check_lib MySQL;
! echo -e "\e[1;44;32msetup.sh doesn't work currently!\e[m";
--- 164,169 ----
check_make;
check_qmake;
! check_include Python PYTHON /usr/include/python*/Python.h /usr/local/include/python*/Python.h;
! check_lib Python PYTHON /usr/lib/libpython*.so /usr/local/lib/libpython*.so;
! echo -e "\e[1;44;32msetup.sh doesn't work currently, yet!\e[m";
|
|
From: <as...@us...> - 2003-10-14 14:12:14
|
Update of /cvsroot/wpdev/wolfpack In directory sc8-pr-cvs1:/tmp/cvs-serv12477 Modified Files: setup.sh Log Message: added two new dependancies: basename and dirname. Index: setup.sh =================================================================== RCS file: /cvsroot/wpdev/wolfpack/setup.sh,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** setup.sh 14 Oct 2003 06:34:30 -0000 1.3 --- setup.sh 14 Oct 2003 14:12:10 -0000 1.4 *************** *** 2,6 **** CONFIG_FILE="setup.cf"; SETUP_BASEDIR="setup.d"; ! NECESSARY_COMMANDS="bash seq run-parts expr grep sed cut head tail chmod"; # --- 2,6 ---- CONFIG_FILE="setup.cf"; SETUP_BASEDIR="setup.d"; ! NECESSARY_COMMANDS="bash seq run-parts expr grep sed cut head tail chmod dirname basename"; # |
|
From: <as...@us...> - 2003-10-14 06:35:56
|
Update of /cvsroot/wpdev/wolfpack/setup.d
In directory sc8-pr-cvs1:/tmp/cvs-serv504
Modified Files:
check
Log Message:
checks for base binaries.
Index: check
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/setup.d/check,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** check 14 Oct 2003 04:19:11 -0000 1.1
--- check 14 Oct 2003 06:35:52 -0000 1.2
***************
*** 4,35 ****
check_dialog()
{
! echo "Checking for dialog...";
}
check_gcc()
{
! echo "Checking for gcc and g++...";
}
! check_gpp()
{
! echo "Checking for cpp...";
}
check_include()
{
! echo "Checking for \$INCLUDE include...";
}
check_lib()
{
! echo "Checking for \$LIBRARY library...";
}
check_dialog;
check_gcc;
! check_gpp;
! check_include;
! check_lib;
echo -e "\e[1;44;32msetup.sh doesn't work currently!\e[m";
--- 4,111 ----
check_dialog()
{
! echo -n "Checking for dialog... ";
! DIALOG="$(which dialog)";
! WHIPTAIL="$(which whiptail)";
! if [ -x "$DIALOG" ];
! then
! echo "DIALOG=\"$DIALOG\"" > "$SETUP_CACHE";
! echo "${DIALOG}.";
! elif [ -x "$WHIPTAIL" ];
! then
! echo "DIALOG=\"$WHIPTAIL\"" > "$SETUP_CACHE";
! echo "${WHIPTAIL}.";
! else
! echo "not available.";
! fi;
}
check_gcc()
{
! echo -n "Checking for gcc and g++... ";
! GCC_VERSION="$(gcc -v 2>&1 | grep 'gcc version \([0-9]\+\.\)\+[0-9]'|cut -d' ' -f3)";
! GPP_VERSION="$(g++ -v 2>&1 | grep 'gcc version \([0-9]\+\.\)\+[0-9]'|cut -d' ' -f3)";
!
! if [ "$GCC_VERSION" ];
! then
! echo "GCC_PATH=\"$(which gcc)\"" >> "$SETUP_CACHE";
! echo "GCC_VERSION=\"$GCC_VERSION\"" >> "$SETUP_CACHE";
! echo -n "gcc version ${GCC_VERSION}";
! fi;
!
! if [ "$GPP_VERSION" ];
! then
! echo "GPP_PATH=\"$(which g++)\"" >> "$SETUP_CACHE";
! echo "GPP_VERSION=\"$GPP_VERSION\"" >> "$SETUP_CACHE";
! [ "$GCC_VERSION" ] && echo -n ", ";
! echo "g++ version ${GPP_VERSION}.";
! elif [ "$GCC_VERSION" ];
! then
! echo ".";
! fi;
!
! if [ ! "$GCC_VERSION" ] && [ ! "$GPP_VERSION" ];
! then
! echo "none found.";
! fi;
}
! check_make()
{
! echo -n "Checking for make... ";
! MAKE_FULL_VERSION="$((make -v 2> /dev/null || gmake -v 2> /dev/null) | head -1 | cut -d, -f1)";
! MAKE_VERSION="$(echo "$MAKE_FULL_VERSION"|sed -e 's/.* \(\+\)$/\1/')";
! if [ "$MAKE_VERSION" ];
! then
! echo "MAKE_PATH=\"$(which make)\";" >> "$SETUP_CACHE";
! echo "MAKE_VERSION=\"$(echo "$MAKE_VERSION"|cut -d' ' -f4)\";" >> "$SETUP_CACHE";
! echo "${MAKE_VERSION}.";
! else
! echo "not found.";
! fi;
! }
!
! check_qmake()
! {
! echo -n "Checking for qmake version... ";
! QMAKE_PATH="$(which qmake)";
! if [ ! "$QMAKE_PATH" ];
! then
! QMAKE_PATH="which $QTDIR/bin/qmake";
! fi;
!
! if [ "$QMAKE_PATH" ];
! then
! QMAKE_VERSION="$($QMAKE_PATH -v 2>&1 | head -1 | cut -d: -f2 | cut -d' ' -f2-)";
! if [ "$QMAKE_VERSION" ];
! then
! echo "QMAKE_PATH=\"$QMAKE_PATH\"" >> "$SETUP_CACHE";
! echo "QMAKE_VERSION=\"$(echo "$QMAKE_VERSION"|cut -d' ' -f1)\"" >> "$SETUP_CACHE";
! echo "${QMAKE_VERSION}.";
! else
! echo "nothing found.";
! fi;
! else
! echo "nothing found.";
! fi;
}
check_include()
{
! LIBRARY="$1";
! echo "Checking for $LIBRARY includes...";
}
check_lib()
{
! LIBRARY="$1";
! echo "Checking for $LIBRARY library...";
}
check_dialog;
check_gcc;
! check_make;
! check_qmake;
! check_include MySQL;
! check_lib MySQL;
echo -e "\e[1;44;32msetup.sh doesn't work currently!\e[m";
|
|
From: <as...@us...> - 2003-10-14 06:35:23
|
Update of /cvsroot/wpdev/wolfpack In directory sc8-pr-cvs1:/tmp/cvs-serv426 Modified Files: setup.cf Log Message: variable for temporary file Index: setup.cf =================================================================== RCS file: /cvsroot/wpdev/wolfpack/setup.cf,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** setup.cf 14 Oct 2003 04:19:11 -0000 1.1 --- setup.cf 14 Oct 2003 06:35:18 -0000 1.2 *************** *** 1 **** --- 1,2 ---- # config file for setup.sh + SETUP_CACHE="setup.tmp" |
|
From: <as...@us...> - 2003-10-14 06:34:34
|
Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv32508
Modified Files:
setup.sh
Log Message:
autocorrection of setup.d variable.
Index: setup.sh
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/setup.sh,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** setup.sh 14 Oct 2003 04:35:48 -0000 1.2
--- setup.sh 14 Oct 2003 06:34:30 -0000 1.3
***************
*** 35,38 ****
--- 35,47 ----
# check for permissions which are required by run-parts {{{
+ #
+ # correct path if necessary
+ #
+ if ! echo "$SETUP_BASEDIR"|grep '^/' > /dev/null 2>&1;
+ then
+ SETUP_BASEDIR="$PWD/$SETUP_BASEDIR";
+ fi
+ SETUP_BASEDIR="$(echo -n "$SETUP_BASEDIR"|sed -e 's|/\.*/|/|g')";
+
echo -e "\e[33m--> \e[1mPermissions correctly set?\e[m";
#
|
|
From: <as...@us...> - 2003-10-14 04:35:53
|
Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv16907
Modified Files:
setup.sh
Log Message:
folding is useful when working without functions ;)
Index: setup.sh
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/setup.sh,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** setup.sh 14 Oct 2003 04:19:11 -0000 1.1
--- setup.sh 14 Oct 2003 04:35:48 -0000 1.2
***************
*** 9,15 ****
echo -e "\e[1;32mChecking for base dependencies:\e[m";
! #
! # check for base commands:
! #
echo -e "\e[33m--> \e[1mAre necessary commands available?\e[m";
echo -en "\e[36m---->\e[m ";
--- 9,14 ----
echo -e "\e[1;32mChecking for base dependencies:\e[m";
!
! # check for base commands {{{
echo -e "\e[33m--> \e[1mAre necessary commands available?\e[m";
echo -en "\e[36m---->\e[m ";
***************
*** 33,39 ****
fi;
#
! #
! # check for permissions which are required by run-parts:
! #
echo -e "\e[33m--> \e[1mPermissions correctly set?\e[m";
#
--- 32,38 ----
fi;
#
! # }}}
!
! # check for permissions which are required by run-parts {{{
echo -e "\e[33m--> \e[1mPermissions correctly set?\e[m";
#
***************
*** 147,153 ****
fi;
#
! #
! # Check configuration file:
! #
echo -e "\e[33m--> \e[1mIs configuration okay?\e[m";
#
--- 146,152 ----
fi;
#
! # }}}
!
! # Check configuration file {{{
echo -e "\e[33m--> \e[1mIs configuration okay?\e[m";
#
***************
*** 193,197 ****
fi
#
! #
echo -e "\e[1;32mOkay, starting setup scripts:\e[m";
--- 192,197 ----
fi
#
! # }}}
!
echo -e "\e[1;32mOkay, starting setup scripts:\e[m";
|
|
From: <as...@us...> - 2003-10-14 04:19:15
|
Update of /cvsroot/wpdev/wolfpack/setup.d
In directory sc8-pr-cvs1:/tmp/cvs-serv14718/setup.d
Added Files:
check config make
Log Message:
new setup script (currently just structure of it)
--- NEW FILE: check ---
#!/bin/bash
. "$CONFIG_FILE";
check_dialog()
{
echo "Checking for dialog...";
}
check_gcc()
{
echo "Checking for gcc and g++...";
}
check_gpp()
{
echo "Checking for cpp...";
}
check_include()
{
echo "Checking for \$INCLUDE include...";
}
check_lib()
{
echo "Checking for \$LIBRARY library...";
}
check_dialog;
check_gcc;
check_gpp;
check_include;
check_lib;
echo -e "\e[1;44;32msetup.sh doesn't work currently!\e[m";
--- NEW FILE: config ---
#!/bin/bash
. "$CONFIG_FILE";
--- NEW FILE: make ---
#!/bin/bash
. "$CONFIG_FILE";
|