You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(107) |
Dec
(67) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(76) |
Feb
(125) |
Mar
(72) |
Apr
(13) |
May
(18) |
Jun
(12) |
Jul
(129) |
Aug
(47) |
Sep
(1) |
Oct
(36) |
Nov
(128) |
Dec
(124) |
2002 |
Jan
(59) |
Feb
|
Mar
(14) |
Apr
(14) |
May
(72) |
Jun
(9) |
Jul
(3) |
Aug
(5) |
Sep
(18) |
Oct
(65) |
Nov
(28) |
Dec
(12) |
2003 |
Jan
(10) |
Feb
(2) |
Mar
(4) |
Apr
(33) |
May
(21) |
Jun
(9) |
Jul
(29) |
Aug
(34) |
Sep
(4) |
Oct
(8) |
Nov
(15) |
Dec
(4) |
2004 |
Jan
(26) |
Feb
(12) |
Mar
(11) |
Apr
(9) |
May
(7) |
Jun
|
Jul
(5) |
Aug
|
Sep
(3) |
Oct
(7) |
Nov
(1) |
Dec
(10) |
2005 |
Jan
(2) |
Feb
(72) |
Mar
(16) |
Apr
(39) |
May
(48) |
Jun
(97) |
Jul
(57) |
Aug
(13) |
Sep
(16) |
Oct
(24) |
Nov
(100) |
Dec
(24) |
2006 |
Jan
(15) |
Feb
(34) |
Mar
(33) |
Apr
(31) |
May
(79) |
Jun
(64) |
Jul
(41) |
Aug
(64) |
Sep
(31) |
Oct
(46) |
Nov
(55) |
Dec
(37) |
2007 |
Jan
(32) |
Feb
(61) |
Mar
(11) |
Apr
(58) |
May
(46) |
Jun
(30) |
Jul
(94) |
Aug
(93) |
Sep
(86) |
Oct
(69) |
Nov
(125) |
Dec
(177) |
2008 |
Jan
(169) |
Feb
(97) |
Mar
(74) |
Apr
(113) |
May
(120) |
Jun
(334) |
Jul
(215) |
Aug
(237) |
Sep
(72) |
Oct
(189) |
Nov
(126) |
Dec
(160) |
2009 |
Jan
(180) |
Feb
(45) |
Mar
(98) |
Apr
(140) |
May
(151) |
Jun
(71) |
Jul
(107) |
Aug
(119) |
Sep
(73) |
Oct
(121) |
Nov
(14) |
Dec
(6) |
2010 |
Jan
(13) |
Feb
(9) |
Mar
(10) |
Apr
(64) |
May
(3) |
Jun
(16) |
Jul
(7) |
Aug
(23) |
Sep
(17) |
Oct
(37) |
Nov
(5) |
Dec
(8) |
2011 |
Jan
(10) |
Feb
(11) |
Mar
(77) |
Apr
(11) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Finn B. <bc...@us...> - 2001-07-18 10:57:07
|
Update of /cvsroot/jython/jython In directory usw-pr-cvs1:/tmp/cvs-serv29049 Modified Files: build.xml Log Message: Added optimize option. Index: build.xml =================================================================== RCS file: /cvsroot/jython/jython/build.xml,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** build.xml 2001/03/27 17:39:51 1.11 --- build.xml 2001/07/18 10:57:04 1.12 *************** *** 1,5 **** <!-- Copyright 2000 Dj Walker-Morgan --> ! <project name="jython" default="compile" basedir="."> <target name="init"> <property name="sourceDir" value="." /> --- 1,5 ---- <!-- Copyright 2000 Dj Walker-Morgan --> ! <project name="jython" default="jar" basedir="."> <target name="init"> <property name="sourceDir" value="." /> *************** *** 7,10 **** --- 7,11 ---- <property name="apidocDir" value="Doc/api" /> <property name="debug" value="off" /> + <property name="optimize" value="on" /> <available classname="java.util.List" property="java2" /> *************** *** 94,97 **** --- 95,99 ---- ${exclude.readline.files}" debug="${debug}" + optimize="${optimize}" /> *************** *** 101,104 **** --- 103,107 ---- destdir="${outputDir}/" debug="${debug}" + optimize="${optimize}" /> *************** *** 127,129 **** <target name="all" depends="init,clean,prepare,parser,compile,jar"> </target> ! </project> \ No newline at end of file --- 130,133 ---- <target name="all" depends="init,clean,prepare,parser,compile,jar"> </target> ! </project> ! |
From: Finn B. <bc...@us...> - 2001-07-18 10:56:15
|
Update of /cvsroot/jython/jython In directory usw-pr-cvs1:/tmp/cvs-serv28860 Modified Files: ACKNOWLEDGMENTS Log Message: More acks. Index: ACKNOWLEDGMENTS =================================================================== RCS file: /cvsroot/jython/jython/ACKNOWLEDGMENTS,v retrieving revision 2.11 retrieving revision 2.12 diff -C2 -r2.11 -r2.12 *** ACKNOWLEDGMENTS 2001/03/13 20:31:57 2.11 --- ACKNOWLEDGMENTS 2001/07/18 10:56:12 2.12 *************** *** 47,50 **** --- 47,52 ---- Ian Castleden Kent Johnson + Robert W. Bill + Durant Schoon Local Variables: |
From: Finn B. <bc...@us...> - 2001-07-18 10:53:29
|
Update of /cvsroot/jython/bugtests In directory usw-pr-cvs1:/tmp/cvs-serv28161 Modified Files: test296.py Log Message: Throw an error instead of a warning now that the bug is fixed. Index: test296.py =================================================================== RCS file: /cvsroot/jython/bugtests/test296.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** test296.py 2001/07/14 21:26:33 1.1 --- test296.py 2001/07/18 10:53:26 1.2 *************** *** 10,13 **** print test296p.abc except java.lang.StackOverflowError: ! raise support.TestWarning("Shouldn't raise a Stack overflow") --- 10,15 ---- print test296p.abc except java.lang.StackOverflowError: ! raise support.TestError("Shouldn't raise a Stack overflow") ! except Exception: ! pass |
From: Finn B. <bc...@us...> - 2001-07-18 10:31:35
|
Update of /cvsroot/jython/jython/Lib In directory usw-pr-cvs1:/tmp/cvs-serv23675 Added Files: zlib.py Log Message: A port of the zlib module. Support most of the functionality except - The advanced flush features - The unused_data string on decompressobj objects. --- NEW FILE --- from java import util, lang import jarray, binascii class error(Exception): pass DEFLATED = 8 MAX_WBITS = 15 DEF_MEM_LEVEL = 8 ZLIB_VERSION = "1.1.3" Z_BEST_COMPRESSION = 9 Z_BEST_SPEED = 1 Z_FILTERED = 1 Z_HUFFMAN_ONLY = 2 Z_DEFAULT_COMPRESSION = -1 Z_DEFAULT_STRATEGY = 0 # Most options are removed because java does not support them # Z_NO_FLUSH = 0 # Z_SYNC_FLUSH = 2 # Z_FULL_FLUSH = 3 Z_FINISH = 4 def adler32(string, value=1): if value != 1: raise ValueError, "adler32 only support start value of 1" checksum = util.zip.Adler32() checksum.update(lang.String.getBytes(string)) return lang.Long(checksum.getValue()).intValue() def crc32(string, value=0): return binascii.crc32(string, value) def compress(string, level=6): if level < Z_BEST_SPEED or level > Z_BEST_COMPRESSION: raise error, "Bad compression level" deflater = util.zip.Deflater(level, 0) deflater.setInput(string) deflater.finish() return _get_deflate_data(deflater) def decompress(string, wbits=0, bufsize=16384): inflater = util.zip.Inflater(wbits < 0) inflater.setInput(string) return _get_inflate_data(inflater) class compressobj: def __init__(self, level=6, method=DEFLATED, wbits=MAX_WBITS, memLevel=0, strategy=0): if abs(wbits) > MAX_WBITS or abs(wbits) < 8: raise ValueError, "Invalid initialization option" self.deflater = util.zip.Deflater(level, wbits < 0) self.deflater.setStrategy(strategy) if wbits < 0: _get_deflate_data(self.deflater) def compress(self, string): self.deflater.setInput(string) return _get_deflate_data(self.deflater) def flush(self, mode=Z_FINISH): if mode != Z_FINISH: raise ValueError, "Invalid flush option" self.deflater.finish() return _get_deflate_data(self.deflater) class decompressobj: def __init__(self, wbits=0): if abs(wbits) > MAX_WBITS or abs(wbits) < 8: raise ValueError, "Invalid initialization option" self.inflater = util.zip.Inflater(wbits < 0) self.unused_data = "" def decompress(self, string): self.inflater.setInput(string) r = _get_inflate_data(self.inflater) # Arrgh. This suck. self.unused_data = " " * self.inflater.getRemaining() return r def flush(self): #self.inflater.finish() return _get_inflate_data(self.inflater) def _get_deflate_data(deflater): buf = jarray.zeros(1024, 'b') sb = lang.StringBuffer() while not deflater.finished(): l = deflater.deflate(buf) if l == 0: break sb.append(lang.String(buf, 0, 0, l)) return sb.toString() def _get_inflate_data(inflater): buf = jarray.zeros(1024, 'b') sb = lang.StringBuffer() while not inflater.finished(): l = inflater.inflate(buf) if l == 0: break sb.append(lang.String(buf, 0, 0, l)) return sb.toString() |
From: Finn B. <bc...@us...> - 2001-07-18 10:27:14
|
Update of /cvsroot/jython/jython/Lib In directory usw-pr-cvs1:/tmp/cvs-serv22804 Added Files: zipfile.py Log Message: Adding a patched version of zipfile.py. Hopefully this copy can be removed again in 2.2 when CPython patch #442128 is applied and CPython-2.2 is released. --- NEW FILE --- "Read and write ZIP files." # Written by James C. Ahlstrom ji...@in... # All rights transferred to CNRI pursuant to the Python contribution agreement import struct, os, time import binascii try: import zlib # We may need its compression method except ImportError: zlib = None __all__ = ["BadZipfile", "error", "ZIP_STORED", "ZIP_DEFLATED", "is_zipfile", "ZipInfo", "ZipFile", "PyZipFile"] class BadZipfile(Exception): pass error = BadZipfile # The exception raised by this module # constants for Zip file compression methods ZIP_STORED = 0 ZIP_DEFLATED = 8 # Other ZIP compression methods not supported # Here are some struct module formats for reading headers structEndArchive = "<4s4H2lH" # 9 items, end of archive, 22 bytes stringEndArchive = "PK\005\006" # magic number for end of archive record structCentralDir = "<4s4B4H3l5H2l"# 19 items, central directory, 46 bytes stringCentralDir = "PK\001\002" # magic number for central directory structFileHeader = "<4s2B4H3l2H" # 12 items, file header record, 30 bytes stringFileHeader = "PK\003\004" # magic number for file header structExtHeader = "<4s3l" # 4 items, extra header record, 16 bytes stringExtHeader = "PK\007\010" # magic number for ext header # indexes of entries in the central directory structure _CD_SIGNATURE = 0 _CD_CREATE_VERSION = 1 _CD_CREATE_SYSTEM = 2 _CD_EXTRACT_VERSION = 3 _CD_EXTRACT_SYSTEM = 4 # is this meaningful? _CD_FLAG_BITS = 5 _CD_COMPRESS_TYPE = 6 _CD_TIME = 7 _CD_DATE = 8 _CD_CRC = 9 _CD_COMPRESSED_SIZE = 10 _CD_UNCOMPRESSED_SIZE = 11 _CD_FILENAME_LENGTH = 12 _CD_EXTRA_FIELD_LENGTH = 13 _CD_COMMENT_LENGTH = 14 _CD_DISK_NUMBER_START = 15 _CD_INTERNAL_FILE_ATTRIBUTES = 16 _CD_EXTERNAL_FILE_ATTRIBUTES = 17 _CD_LOCAL_HEADER_OFFSET = 18 # indexes of entries in the local file header structure _FH_SIGNATURE = 0 _FH_EXTRACT_VERSION = 1 _FH_EXTRACT_SYSTEM = 2 # is this meaningful? _FH_GENERAL_PURPOSE_FLAG_BITS = 3 _FH_COMPRESSION_METHOD = 4 _FH_LAST_MOD_TIME = 5 _FH_LAST_MOD_DATE = 6 _FH_CRC = 7 _FH_COMPRESSED_SIZE = 8 _FH_UNCOMPRESSED_SIZE = 9 _FH_FILENAME_LENGTH = 10 _FH_EXTRA_FIELD_LENGTH = 11 # Used to compare file passed to ZipFile _STRING_TYPES = (type('s'), type(u's')) def is_zipfile(filename): """Quickly see if file is a ZIP file by checking the magic number. Will not accept a ZIP archive with an ending comment. """ try: fpin = open(filename, "rb") fpin.seek(-22, 2) # Seek to end-of-file record endrec = fpin.read() fpin.close() if endrec[0:4] == "PK\005\006" and endrec[-2:] == "\000\000": return 1 # file has correct magic number except IOError: pass class ZipInfo: """Class with attributes describing each file in the ZIP archive.""" def __init__(self, filename="NoName", date_time=(1980,1,1,0,0,0)): self.filename = filename # Name of the file in the archive self.date_time = date_time # year, month, day, hour, min, sec # Standard values: self.compress_type = ZIP_STORED # Type of compression for the file self.comment = "" # Comment for each file self.extra = "" # ZIP extra data self.create_system = 0 # System which created ZIP archive self.create_version = 20 # Version which created ZIP archive self.extract_version = 20 # Version needed to extract archive self.reserved = 0 # Must be zero self.flag_bits = 0 # ZIP flag bits self.volume = 0 # Volume number of file header self.internal_attr = 0 # Internal attributes self.external_attr = 0 # External file attributes # Other attributes are set by class ZipFile: # header_offset Byte offset to the file header # file_offset Byte offset to the start of the file data # CRC CRC-32 of the uncompressed file # compress_size Size of the compressed file # file_size Size of the uncompressed file def FileHeader(self): """Return the per-file header as a string.""" dt = self.date_time dosdate = (dt[0] - 1980) << 9 | dt[1] << 5 | dt[2] dostime = dt[3] << 11 | dt[4] << 5 | dt[5] / 2 if self.flag_bits & 0x08: # Set these to zero because we write them after the file data CRC = compress_size = file_size = 0 else: CRC = self.CRC compress_size = self.compress_size file_size = self.file_size header = struct.pack(structFileHeader, stringFileHeader, self.extract_version, self.reserved, self.flag_bits, self.compress_type, dostime, dosdate, CRC, compress_size, file_size, len(self.filename), len(self.extra)) return header + self.filename + self.extra class ZipFile: """ Class with methods to open, read, write, close, list zip files. z = ZipFile(file, mode="r", compression=ZIP_STORED) file: Either the path to the file, or a file-like object. If it is a path, the file will be opened and closed by ZipFile. mode: The mode can be either read "r", write "w" or append "a". compression: ZIP_STORED (no compression) or ZIP_DEFLATED (requires zlib). """ fp = None # Set here since __del__ checks it def __init__(self, file, mode="r", compression=ZIP_STORED): """Open the ZIP file with mode read "r", write "w" or append "a".""" if compression == ZIP_STORED: pass elif compression == ZIP_DEFLATED: if not zlib: raise RuntimeError,\ "Compression requires the (missing) zlib module" else: raise RuntimeError, "That compression method is not supported" self.debug = 0 # Level of printing: 0 through 3 self.NameToInfo = {} # Find file info given name self.filelist = [] # List of ZipInfo instances for archive self.compression = compression # Method of compression self.mode = key = mode[0] # Check if we were passed a file-like object if type(file) in _STRING_TYPES: self._filePassed = 0 self.filename = file modeDict = {'r' : 'rb', 'w': 'wb', 'a' : 'r+b'} self.fp = open(file, modeDict[mode]) else: self._filePassed = 1 self.fp = file self.filename = getattr(file, 'name', None) if key == 'r': self._GetContents() elif key == 'w': pass elif key == 'a': fp = self.fp fp.seek(-22, 2) # Seek to end-of-file record endrec = fp.read() if endrec[0:4] == stringEndArchive and \ endrec[-2:] == "\000\000": self._GetContents() # file is a zip file # seek to start of directory and overwrite fp.seek(self.start_dir, 0) else: # file is not a zip file, just append fp.seek(0, 2) else: if not self._filePassed: self.fp.close() self.fp = None raise RuntimeError, 'Mode must be "r", "w" or "a"' def _GetContents(self): """Read the directory, making sure we close the file if the format is bad.""" try: self._RealGetContents() except BadZipfile: if not self._filePassed: self.fp.close() self.fp = None raise def _RealGetContents(self): """Read in the table of contents for the ZIP file.""" fp = self.fp fp.seek(-22, 2) # Start of end-of-archive record filesize = fp.tell() + 22 # Get file size endrec = fp.read(22) # Archive must not end with a comment! if endrec[0:4] != stringEndArchive or endrec[-2:] != "\000\000": raise BadZipfile, "File is not a zip file, or ends with a comment" endrec = struct.unpack(structEndArchive, endrec) if self.debug > 1: print endrec size_cd = endrec[5] # bytes in central directory offset_cd = endrec[6] # offset of central directory x = filesize - 22 - size_cd # "concat" is zero, unless zip was concatenated to another file concat = x - offset_cd if self.debug > 2: print "given, inferred, offset", offset_cd, x, concat # self.start_dir: Position of start of central directory self.start_dir = offset_cd + concat fp.seek(self.start_dir, 0) total = 0 while total < size_cd: centdir = fp.read(46) total = total + 46 if centdir[0:4] != stringCentralDir: raise BadZipfile, "Bad magic number for central directory" centdir = struct.unpack(structCentralDir, centdir) if self.debug > 2: print centdir filename = fp.read(centdir[_CD_FILENAME_LENGTH]) # Create ZipInfo instance to store file information x = ZipInfo(filename) x.extra = fp.read(centdir[_CD_EXTRA_FIELD_LENGTH]) x.comment = fp.read(centdir[_CD_COMMENT_LENGTH]) total = (total + centdir[_CD_FILENAME_LENGTH] + centdir[_CD_EXTRA_FIELD_LENGTH] + centdir[_CD_COMMENT_LENGTH]) x.header_offset = centdir[_CD_LOCAL_HEADER_OFFSET] + concat # file_offset must be computed below... (x.create_version, x.create_system, x.extract_version, x.reserved, x.flag_bits, x.compress_type, t, d, x.CRC, x.compress_size, x.file_size) = centdir[1:12] x.volume, x.internal_attr, x.external_attr = centdir[15:18] # Convert date/time code to (year, month, day, hour, min, sec) x.date_time = ( (d>>9)+1980, (d>>5)&0xF, d&0x1F, t>>11, (t>>5)&0x3F, (t&0x1F) * 2 ) self.filelist.append(x) self.NameToInfo[x.filename] = x if self.debug > 2: print "total", total for data in self.filelist: fp.seek(data.header_offset, 0) fheader = fp.read(30) if fheader[0:4] != stringFileHeader: raise BadZipfile, "Bad magic number for file header" fheader = struct.unpack(structFileHeader, fheader) # file_offset is computed here, since the extra field for # the central directory and for the local file header # refer to different fields, and they can have different # lengths data.file_offset = (data.header_offset + 30 + fheader[_FH_FILENAME_LENGTH] + fheader[_FH_EXTRA_FIELD_LENGTH]) fname = fp.read(fheader[_FH_FILENAME_LENGTH]) if fname != data.filename: raise RuntimeError, \ 'File name in directory "%s" and header "%s" differ.' % ( data.filename, fname) def namelist(self): """Return a list of file names in the archive.""" l = [] for data in self.filelist: l.append(data.filename) return l def infolist(self): """Return a list of class ZipInfo instances for files in the archive.""" return self.filelist def printdir(self): """Print a table of contents for the zip file.""" print "%-46s %19s %12s" % ("File Name", "Modified ", "Size") for zinfo in self.filelist: date = "%d-%02d-%02d %02d:%02d:%02d" % zinfo.date_time print "%-46s %s %12d" % (zinfo.filename, date, zinfo.file_size) def testzip(self): """Read all the files and check the CRC.""" for zinfo in self.filelist: try: self.read(zinfo.filename) # Check CRC-32 except: return zinfo.filename def getinfo(self, name): """Return the instance of ZipInfo given 'name'.""" return self.NameToInfo[name] def read(self, name): """Return file bytes (as a string) for name.""" if self.mode not in ("r", "a"): raise RuntimeError, 'read() requires mode "r" or "a"' if not self.fp: raise RuntimeError, \ "Attempt to read ZIP archive that was already closed" zinfo = self.getinfo(name) filepos = self.fp.tell() self.fp.seek(zinfo.file_offset, 0) bytes = self.fp.read(zinfo.compress_size) self.fp.seek(filepos, 0) if zinfo.compress_type == ZIP_STORED: pass elif zinfo.compress_type == ZIP_DEFLATED: if not zlib: raise RuntimeError, \ "De-compression requires the (missing) zlib module" # zlib compress/decompress code by Jeremy Hylton of CNRI dc = zlib.decompressobj(-15) bytes = dc.decompress(bytes) # need to feed in unused pad byte so that zlib won't choke ex = dc.decompress('Z') + dc.flush() if ex: bytes = bytes + ex else: raise BadZipfile, \ "Unsupported compression method %d for file %s" % \ (zinfo.compress_type, name) crc = binascii.crc32(bytes) if crc != zinfo.CRC: raise BadZipfile, "Bad CRC-32 for file %s" % name return bytes def _writecheck(self, zinfo): """Check for errors before writing a file to the archive.""" if self.NameToInfo.has_key(zinfo.filename): if self.debug: # Warning for duplicate names print "Duplicate name:", zinfo.filename if self.mode not in ("w", "a"): raise RuntimeError, 'write() requires mode "w" or "a"' if not self.fp: raise RuntimeError, \ "Attempt to write ZIP archive that was already closed" if zinfo.compress_type == ZIP_DEFLATED and not zlib: raise RuntimeError, \ "Compression requires the (missing) zlib module" if zinfo.compress_type not in (ZIP_STORED, ZIP_DEFLATED): raise RuntimeError, \ "That compression method is not supported" def write(self, filename, arcname=None, compress_type=None): """Put the bytes from filename into the archive under the name arcname.""" st = os.stat(filename) mtime = time.localtime(st[8]) date_time = mtime[0:6] # Create ZipInfo instance to store file information if arcname is None: zinfo = ZipInfo(filename, date_time) else: zinfo = ZipInfo(arcname, date_time) zinfo.external_attr = st[0] << 16 # Unix attributes if compress_type is None: zinfo.compress_type = self.compression else: zinfo.compress_type = compress_type self._writecheck(zinfo) fp = open(filename, "rb") zinfo.flag_bits = 0x08 zinfo.header_offset = self.fp.tell() # Start of header bytes self.fp.write(zinfo.FileHeader()) zinfo.file_offset = self.fp.tell() # Start of file bytes CRC = 0 compress_size = 0 file_size = 0 if zinfo.compress_type == ZIP_DEFLATED: cmpr = zlib.compressobj(zlib.Z_DEFAULT_COMPRESSION, zlib.DEFLATED, -15) else: cmpr = None while 1: buf = fp.read(1024 * 8) if not buf: break file_size = file_size + len(buf) CRC = binascii.crc32(buf, CRC) if cmpr: buf = cmpr.compress(buf) compress_size = compress_size + len(buf) self.fp.write(buf) fp.close() if cmpr: buf = cmpr.flush() compress_size = compress_size + len(buf) self.fp.write(buf) zinfo.compress_size = compress_size else: zinfo.compress_size = file_size zinfo.CRC = CRC zinfo.file_size = file_size # Write CRC and file sizes after the file data self.fp.write(struct.pack(structExtHeader, stringExtHeader, zinfo.CRC, zinfo.compress_size, zinfo.file_size)) self.filelist.append(zinfo) self.NameToInfo[zinfo.filename] = zinfo def writestr(self, zinfo, bytes): """Write a file into the archive. The contents is the string 'bytes'.""" self._writecheck(zinfo) zinfo.file_size = len(bytes) # Uncompressed size zinfo.CRC = binascii.crc32(bytes) # CRC-32 checksum if zinfo.compress_type == ZIP_DEFLATED: co = zlib.compressobj(zlib.Z_DEFAULT_COMPRESSION, zlib.DEFLATED, -15) bytes = co.compress(bytes) + co.flush() zinfo.compress_size = len(bytes) # Compressed size else: zinfo.compress_size = zinfo.file_size zinfo.header_offset = self.fp.tell() # Start of header bytes self.fp.write(zinfo.FileHeader()) zinfo.file_offset = self.fp.tell() # Start of file bytes self.fp.write(bytes) if zinfo.flag_bits & 0x08: # Write CRC and file sizes after the file data self.fp.write(struct.pack(structExtHeader, stringExtHeader, zinfo.CRC, zinfo.compress_size, zinfo.file_size)) self.filelist.append(zinfo) self.NameToInfo[zinfo.filename] = zinfo def __del__(self): """Call the "close()" method in case the user forgot.""" if self.fp and not self._filePassed: self.fp.close() self.fp = None def close(self): """Close the file, and for mode "w" and "a" write the ending records.""" if self.mode in ("w", "a"): # write ending records count = 0 pos1 = self.fp.tell() for zinfo in self.filelist: # write central directory count = count + 1 dt = zinfo.date_time dosdate = (dt[0] - 1980) << 9 | dt[1] << 5 | dt[2] dostime = dt[3] << 11 | dt[4] << 5 | dt[5] / 2 centdir = struct.pack(structCentralDir, stringCentralDir, zinfo.create_version, zinfo.create_system, zinfo.extract_version, zinfo.reserved, zinfo.flag_bits, zinfo.compress_type, dostime, dosdate, zinfo.CRC, zinfo.compress_size, zinfo.file_size, len(zinfo.filename), len(zinfo.extra), len(zinfo.comment), 0, zinfo.internal_attr, zinfo.external_attr, zinfo.header_offset) self.fp.write(centdir) self.fp.write(zinfo.filename) self.fp.write(zinfo.extra) self.fp.write(zinfo.comment) pos2 = self.fp.tell() # Write end-of-zip-archive record endrec = struct.pack(structEndArchive, stringEndArchive, 0, 0, count, count, pos2 - pos1, pos1, 0) self.fp.write(endrec) self.fp.flush() if not self._filePassed: self.fp.close() self.fp = None class PyZipFile(ZipFile): """Class to create ZIP archives with Python library files and packages.""" def writepy(self, pathname, basename = ""): """Add all files from "pathname" to the ZIP archive. If pathname is a package directory, search the directory and all package subdirectories recursively for all *.py and enter the modules into the archive. If pathname is a plain directory, listdir *.py and enter all modules. Else, pathname must be a Python *.py file and the module will be put into the archive. Added modules are always module.pyo or module.pyc. This method will compile the module.py into module.pyc if necessary. """ dir, name = os.path.split(pathname) if os.path.isdir(pathname): initname = os.path.join(pathname, "__init__.py") if os.path.isfile(initname): # This is a package directory, add it if basename: basename = "%s/%s" % (basename, name) else: basename = name if self.debug: print "Adding package in", pathname, "as", basename fname, arcname = self._get_codename(initname[0:-3], basename) if self.debug: print "Adding", arcname self.write(fname, arcname) dirlist = os.listdir(pathname) dirlist.remove("__init__.py") # Add all *.py files and package subdirectories for filename in dirlist: path = os.path.join(pathname, filename) root, ext = os.path.splitext(filename) if os.path.isdir(path): if os.path.isfile(os.path.join(path, "__init__.py")): # This is a package directory, add it self.writepy(path, basename) # Recursive call elif ext == ".py": fname, arcname = self._get_codename(path[0:-3], basename) if self.debug: print "Adding", arcname self.write(fname, arcname) else: # This is NOT a package directory, add its files at top level if self.debug: print "Adding files from directory", pathname for filename in os.listdir(pathname): path = os.path.join(pathname, filename) root, ext = os.path.splitext(filename) if ext == ".py": fname, arcname = self._get_codename(path[0:-3], basename) if self.debug: print "Adding", arcname self.write(fname, arcname) else: if pathname[-3:] != ".py": raise RuntimeError, \ 'Files added with writepy() must end with ".py"' fname, arcname = self._get_codename(pathname[0:-3], basename) if self.debug: print "Adding file", arcname self.write(fname, arcname) def _get_codename(self, pathname, basename): """Return (filename, archivename) for the path. Given a module name path, return the correct file path and archive name, compiling if necessary. For example, given /python/lib/string, return (/python/lib/string.pyc, string). """ file_py = pathname + ".py" file_pyc = pathname + ".pyc" file_pyo = pathname + ".pyo" if os.path.isfile(file_pyo) and \ os.stat(file_pyo)[8] >= os.stat(file_py)[8]: fname = file_pyo # Use .pyo file elif not os.path.isfile(file_pyc) or \ os.stat(file_pyc)[8] < os.stat(file_py)[8]: import py_compile if self.debug: print "Compiling", file_py py_compile.compile(file_py, file_pyc) fname = file_pyc else: fname = file_pyc archivename = os.path.split(fname)[1] if basename: archivename = "%s/%s" % (basename, archivename) return (fname, archivename) |
From: Finn B. <bc...@us...> - 2001-07-18 10:24:58
|
Update of /cvsroot/jython/jython/Lib In directory usw-pr-cvs1:/tmp/cvs-serv22498 Added Files: copy.py Log Message: Added a patched version of copy.py. Hopefully this copy can be removed again in 2.2 when CPython patch #442351 is applied and CPython-2.2 is released. |
From: Samuele P. <ped...@us...> - 2001-07-17 20:38:47
|
Update of /cvsroot/jython/jython/org/python/util In directory usw-pr-cvs1:/tmp/cvs-serv25162 Added Files: PyMetaClass.java Log Message: experimental PyMetaClass hook. --- NEW FILE --- package org.python.util; // experimental PyMetaClass hook interface public interface PyMetaClass { } |
From: Samuele P. <ped...@us...> - 2001-07-17 20:37:23
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv24704 Modified Files: Py.java Log Message: experimental PyMetaClass hook. Index: Py.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/Py.java,v retrieving revision 2.47 retrieving revision 2.48 diff -C2 -r2.47 -r2.48 *** Py.java 2001/07/17 20:34:35 2.47 --- Py.java 2001/07/17 20:37:20 2.48 *************** *** 1436,1439 **** --- 1436,1440 ---- dict); } else if (bases[i] instanceof org.python.util.PyMetaClass) { + // experimental PyMetaClass hook try { return (PyObject)bases[i].getClass().getConstructor(pyClassCtrSignature).newInstance( |
From: Samuele P. <ped...@us...> - 2001-07-17 20:34:38
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv23579 Modified Files: Py.java PyModule.java imp.java Log Message: - yet another import logic rework: fixes #438108 __getitem__ called when it shouldn't? - experimental PyMetaClass hook. Index: Py.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/Py.java,v retrieving revision 2.46 retrieving revision 2.47 diff -C2 -r2.46 -r2.47 *** Py.java 2001/07/03 20:20:27 2.46 --- Py.java 2001/07/17 20:34:35 2.47 *************** *** 1407,1410 **** --- 1407,1412 ---- + private static Class[] pyClassCtrSignature = {String.class,PyTuple.class,PyObject.class,Class.class}; + public static PyObject makeClass(String name, PyObject[] bases, PyCode code, PyObject doc, *************** *** 1433,1437 **** --- 1435,1447 ---- new PyTuple(bases), dict); + } else if (bases[i] instanceof org.python.util.PyMetaClass) { + try { + return (PyObject)bases[i].getClass().getConstructor(pyClassCtrSignature).newInstance( + new Object[] { name, new PyTuple(bases), dict, proxyClass }); + } catch(Exception e) { + throw Py.TypeError("meta-class fails to supply proper ctr: "+bases[i].safeRepr()); + } } + } Index: PyModule.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyModule.java,v retrieving revision 2.10 retrieving revision 2.11 diff -C2 -r2.10 -r2.11 *** PyModule.java 2001/07/03 21:01:15 2.10 --- PyModule.java 2001/07/17 20:34:35 2.11 *************** *** 24,33 **** String fullName = (name+'.'+attr).intern(); ! PyObject modules = Py.getSystemState().modules; ! ! PyObject ret = modules.__finditem__(fullName); ! if (ret == Py.None) ret = null; ! else if (ret != null) return ret; ! if (path == Py.None) { /* disabled: --- 24,29 ---- String fullName = (name+'.'+attr).intern(); ! PyObject ret = null; ! if (path == Py.None) { /* disabled: *************** *** 49,54 **** if (ret != null) { ! // Allow a package component to change its own meaning ! PyObject tmp = modules.__finditem__(fullName); if (tmp != null) ret = tmp; __dict__.__setitem__(attr, ret); --- 45,50 ---- if (ret != null) { ! // Allow a package component to change its own meaning ! PyObject tmp = Py.getSystemState().modules.__finditem__(fullName); if (tmp != null) ret = tmp; __dict__.__setitem__(attr, ret); Index: imp.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/imp.java,v retrieving revision 2.47 retrieving revision 2.48 diff -C2 -r2.47 -r2.48 *** imp.java 2001/07/14 22:25:35 2.47 --- imp.java 2001/07/17 20:34:35 2.48 *************** *** 396,414 **** } ! Py.writeComment("import", "'" + name + "' not found (ImportError)"); ! throw Py.ImportError("no module named "+name); } public static PyObject load(String name) { ! PyObject modules = Py.getSystemState().modules; ! PyObject ret = modules.__finditem__(name); ! if (ret != null) return ret; ! ! ret = load(name, Py.getSystemState().path); ! if (modules.__finditem__(name) == null) ! modules.__setitem__(name, ret); ! else ! ret = modules.__finditem__(name); ! return ret; } --- 396,406 ---- } ! Py.writeComment("import", "'" + name + "' not found (=> ImportError)"); ! return null; ! } public static PyObject load(String name) { ! return import_first(name,new StringBuffer("")); } *************** *** 428,547 **** } ! // Hierarchy-recursivly search for dotted name in mod. ! private static PyObject dottedFind(PyObject mod, String name) { ! int dot = 0; ! int last_dot= 0; ! ! do { ! String tmpName; ! dot = name.indexOf('.', last_dot); ! if (dot == -1) { ! tmpName = name.substring(last_dot).intern(); } else { ! tmpName = name.substring(last_dot, dot).intern(); } ! mod = mod.impAttr(tmpName); ! if (mod == null) ! throw Py.ImportError("No module named " + tmpName); ! last_dot = dot + 1; ! } while (dot != -1); ! return mod; } ! public static PyObject importName(String name, boolean top) { ! if (name.length() == 0) ! throw Py.ValueError("Empty module name"); ! int dot = name.indexOf('.'); ! if (dot != -1) { ! PyObject modules = Py.getSystemState().modules; ! PyObject mod = modules.__finditem__(name); ! if (mod == Py.None) mod = null; ! else if (mod != null && !top) return mod; ! ! int last_dot = dot; ! String firstName = name.substring(0,dot).intern(); ! PyObject pkg = load(firstName); ! ! if (mod == null) { ! mod = pkg; ! if (dot != -1) mod = dottedFind(mod, name.substring(dot+1)); ! } ! if (modules.__finditem__(name) == null) ! modules.__setitem__(name, mod); ! else ! mod = modules.__finditem__(name); ! if (top) ! return pkg; ! else ! return mod; ! } ! else return load(name); } ! ! // This version should deal properly with package relative imports. ! // Assumption (runtime enforced): ! // x.y.z key in sys.modules => any subseq (e.g x, x.y) is a present ! // key too. ! // ??pending: check if result is really a module/jpkg/jclass? ! public synchronized static PyObject importName(String name, boolean top, ! PyObject modDict) ! { ! //System.err.println("importName: "+name); ! String pkgName = getParent(modDict); ! PyObject mod; ! ! if (pkgName != null) { ! PyObject modules = Py.getSystemState().modules; ! int dot = name.indexOf('.'); ! String firstName; ! if (dot == -1) firstName = name; ! else firstName = name.substring(0,dot); ! ! String topNewName = (pkgName+'.'+firstName).intern(); ! ! PyObject topMod = modules.__finditem__(topNewName); ! ! if (topMod != Py.None) { ! if (dot == -1 && topMod != null) { ! //System.err.println("refound-1-top: "+topMod); // ?? dbg ! return topMod; ! } ! String newName = (pkgName+'.'+name).intern(); ! mod = modules.__finditem__(newName); ! if (mod != null && mod != Py.None) { ! //System.err.println("refound: "+name); // ?? dbg ! if (!top) return mod; ! else return topMod; ! } ! ! PyObject pkg = modules.__finditem__(pkgName); ! if (pkg != null) { ! topMod = pkg.impAttr(firstName.intern()); ! if (topMod != null ) { ! if (dot == -1 ) { ! //System.err.println("found-1-top: "+ ! // topMod); // ?? dbg ! return topMod; ! } ! ! //System.err.println(".-find: "+topMod+","+ ! // name.substring(dot+1)); // ?? dbg ! mod = dottedFind(topMod,name.substring(dot+1)); ! ! if(top) return topMod; ! else return mod; ! ! } ! } ! //System.err.println("mark: "+topNewName); // ?? dbg ! modules.__setitem__(topNewName,Py.None); } } ! return importName(name, top); ! } /** * Called from jpython generated code when a statement like "import spam" --- 420,511 ---- } ! // can return null, None ! private static PyObject import_next(PyObject mod, StringBuffer parentNameBuffer, String name) { ! if (parentNameBuffer.length()>0) parentNameBuffer.append('.'); ! parentNameBuffer.append(name); ! String fullName = parentNameBuffer.toString().intern(); ! PyObject modules = Py.getSystemState().modules; ! PyObject ret = modules.__finditem__(fullName); ! if (ret != null) return ret; ! if (mod == null) { ! ret = load(name.intern(), Py.getSystemState().path); // ?? intern superfluous? } else { ! ret = mod.impAttr(name.intern()); } ! if (ret == null || ret == Py.None) return ret; ! if (modules.__finditem__(fullName) == null) modules.__setitem__(fullName, ret); ! else ret = modules.__finditem__(fullName); ! return ret; } ! // never returns null or None ! private static PyObject import_first(String name, StringBuffer parentNameBuffer) { ! PyObject ret = import_next(null,parentNameBuffer,name); ! if (ret == null || ret == Py.None) throw Py.ImportError("no module named "+name); ! return ret; } ! ! // Hierarchy-recursively search for dotted name in mod; never returns null or None ! // ??pending: check if result is really a module/jpkg/jclass? ! private static PyObject import_logic(PyObject mod, StringBuffer parentNameBuffer, String dottedName) { ! int dot = 0; ! int last_dot= 0; ! ! do { ! String name; ! dot = dottedName.indexOf('.', last_dot); ! if (dot == -1) { ! name = dottedName.substring(last_dot); ! } else { ! name = dottedName.substring(last_dot, dot); ! } ! mod = import_next(mod,parentNameBuffer,name); ! if (mod == null || mod == Py.None) ! throw Py.ImportError("No module named " + name); ! last_dot = dot + 1; ! } while (dot != -1); ! return mod; ! } ! public static PyObject import_name(String name,boolean top,PyObject modDict) { ! if (name.length() == 0) ! throw Py.ValueError("Empty module name"); ! PyObject modules = Py.getSystemState().modules; ! PyObject pkgMod = null; ! String pkgName = null; ! if (modDict != null) { ! pkgName = getParent(modDict); ! pkgMod = modules.__finditem__(pkgName); ! if (pkgMod != null && !(pkgMod instanceof PyModule)) pkgMod = null; ! } ! int dot = name.indexOf('.'); ! String firstName; ! if (dot == -1) firstName = name; ! else firstName = name.substring(0,dot); ! StringBuffer parentNameBuffer = new StringBuffer(pkgMod != null?pkgName:""); ! PyObject topMod = import_next(pkgMod,parentNameBuffer,firstName); // None or null or module-like ! if (topMod == Py.None || topMod == null) { ! if (topMod == null) { ! modules.__setitem__(parentNameBuffer.toString().intern(),Py.None); } + parentNameBuffer = new StringBuffer(""); + topMod = import_first(firstName,parentNameBuffer); // could throw ImportError } + PyObject mod = topMod; + if (dot != -1) mod = import_logic(topMod,parentNameBuffer,name.substring(dot+1)); // could throw ImportError + if (top) return topMod; + else return mod; + } ! public static PyObject importName(String name, boolean top) { ! return import_name(name,top,null); ! } + public synchronized static PyObject importName(String name, boolean top, + PyObject modDict) { + return import_name(name,top,modDict); + } + /** * Called from jpython generated code when a statement like "import spam" |
From: Finn B. <bc...@us...> - 2001-07-16 17:04:59
|
Update of /cvsroot/jython/jython/Lib In directory usw-pr-cvs1:/tmp/cvs-serv11100 Modified Files: javaos.py socket.py Log Message: Added __all__ attribute. Index: javaos.py =================================================================== RCS file: /cvsroot/jython/jython/Lib/javaos.py,v retrieving revision 2.6 retrieving revision 2.7 diff -C2 -r2.6 -r2.7 *** javaos.py 2001/03/13 20:32:47 2.6 --- javaos.py 2001/07/16 17:04:56 2.7 *************** *** 20,23 **** --- 20,26 ---- """ + __all__ = ["altsep", "curdir", "pardir", "sep", "pathsep", "linesep", + "defpath", "name"] + import java from java.io import File *************** *** 32,35 **** --- 35,39 ---- #curdir, pardir?? sep = java.io.File.separator + altsep = None pathsep = java.io.File.pathSeparator defpath = '.' Index: socket.py =================================================================== RCS file: /cvsroot/jython/jython/Lib/socket.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** socket.py 2001/02/07 09:18:08 1.10 --- socket.py 2001/07/16 17:04:56 1.11 *************** *** 15,18 **** --- 15,22 ---- import string + __all__ = ['AF_INET', 'SOCK_DGRAM', 'SOCK_RAW', 'SOCK_RDM', 'SOCK_SEQPACKET', + 'SOCK_STREAM', 'SocketType', 'error', 'getfqdn', 'gethostbyaddr', + 'gethostbyname', 'gethostname', 'socket'] + error = IOError |
From: Finn B. <bc...@us...> - 2001-07-16 17:02:35
|
Update of /cvsroot/jython/jython/org/python/modules In directory usw-pr-cvs1:/tmp/cvs-serv10459 Modified Files: py_compile.java re.java Log Message: Add __all__ attribute. Index: py_compile.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/py_compile.java,v retrieving revision 2.2 retrieving revision 2.3 diff -C2 -r2.2 -r2.3 *** py_compile.java 2001/02/02 11:29:42 2.2 --- py_compile.java 2001/07/16 17:02:33 2.3 *************** *** 6,9 **** --- 6,14 ---- public class py_compile { + public static PyList __all__ = new PyList(new PyString[] { + new PyString("compile") + }); + + public static void compile(String filename, String cfile) { compile(filename, cfile, null); Index: re.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/re.java,v retrieving revision 2.7 retrieving revision 2.8 diff -C2 -r2.7 -r2.8 *** re.java 2001/02/02 11:29:42 2.7 --- re.java 2001/07/16 17:02:33 2.8 *************** *** 7,10 **** --- 7,16 ---- public class re implements ClassDictInit { + public static String[] __all__ = new String[] { + "match","search","sub","subn","split","findall","escape","compile", + "I","L","M","S","X","IGNORECASE","LOCALE","MULTILINE","DOTALL", + "VERBOSE","error" + }; + public static PyObject error = new PyString("re.error"); |
From: Finn B. <bc...@us...> - 2001-07-16 16:25:09
|
Update of /cvsroot/jython/jython/org/python/modules In directory usw-pr-cvs1:/tmp/cvs-serv1494 Modified Files: codeop.java Log Message: classDictInit(): Fix spelling typo. Index: codeop.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/codeop.java,v retrieving revision 2.4 retrieving revision 2.5 diff -C2 -r2.4 -r2.5 *** codeop.java 2001/05/27 18:49:15 2.4 --- codeop.java 2001/07/16 16:25:04 2.5 *************** *** 12,16 **** { dict.__delitem__("compile_command_flags"); ! dict.__delitem__("classInitDict"); } --- 12,16 ---- { dict.__delitem__("compile_command_flags"); ! dict.__delitem__("classDictInit"); } |
From: Finn B. <bc...@us...> - 2001-07-16 16:16:56
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv31650 Modified Files: PyComplex.java Log Message: _div(): Minic the way CPython-2.1 does complex division. Index: PyComplex.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyComplex.java,v retrieving revision 2.6 retrieving revision 2.7 diff -C2 -r2.6 -r2.7 *** PyComplex.java 2001/04/04 19:06:45 2.6 --- PyComplex.java 2001/07/16 16:16:53 2.7 *************** *** 154,163 **** } ! private final static PyObject _div(PyComplex o1, PyComplex o2) { ! double denom = o2.real*o2.real+o2.imag*o2.imag; ! if (denom == 0) ! throw Py.ZeroDivisionError("complex division"); ! return new PyComplex((o1.real*o2.real + o1.imag*o2.imag)/denom, ! (o1.imag*o2.real - o1.real*o2.imag)/denom); } --- 154,176 ---- } ! private final static PyObject _div(PyComplex a, PyComplex b) { ! double abs_breal = b.real < 0 ? -b.real : b.real; ! double abs_bimag = b.imag < 0 ? -b.imag : b.imag; ! if (abs_breal >= abs_bimag) { ! // Divide tops and bottom by b.real ! if (abs_breal == 0.0) { ! throw Py.ZeroDivisionError("complex division"); ! } ! double ratio = b.imag / b.real; ! double denom = b.real + b.imag * ratio; ! return new PyComplex((a.real + a.imag * ratio) / denom, ! (a.imag - a.real * ratio) / denom); ! } else { ! /* divide tops and bottom by b.imag */ ! double ratio = b.real / b.imag; ! double denom = b.real * ratio + b.imag; ! return new PyComplex((a.real * ratio + a.imag) / denom, ! (a.imag * ratio - a.real) / denom); ! } } |
From: Finn B. <bc...@us...> - 2001-07-16 13:21:04
|
Update of /cvsroot/jython/jython/Doc In directory usw-pr-cvs1:/tmp/cvs-serv21771 Modified Files: compile.ht Log Message: Nicer indenting of example files. Index: compile.ht =================================================================== RCS file: /cvsroot/jython/jython/Doc/compile.ht,v retrieving revision 2.3 retrieving revision 2.4 diff -C2 -r2.3 -r2.4 *** compile.ht 2001/07/16 13:09:36 2.3 --- compile.ht 2001/07/16 13:20:21 2.4 *************** *** 20,29 **** <code>ant.properties</code> which can contain values to control paths and local options. My <code>ant.properties</code> file look like this: ! <pre> javaccHome = i:\\java\\Javacc2.0\\bin\\lib #build.compiler = classic build.compiler = jikes debug=on ! </pre> <p> --- 20,29 ---- <code>ant.properties</code> which can contain values to control paths and local options. My <code>ant.properties</code> file look like this: ! <blockquote><pre> javaccHome = i:\\java\\Javacc2.0\\bin\\lib #build.compiler = classic build.compiler = jikes debug=on ! </pre></blockquote> <p> *************** *** 63,69 **** creating a file ".jython" in your home directory and including a line like this: ! <pre> ! python.path=d:\\python\\Python-2.1\\Lib ! </pre> </ul> --- 63,69 ---- creating a file ".jython" in your home directory and including a line like this: ! <blockquote><pre> ! python.path=d:\\python\\Python-2.1\\Lib ! </pre><blockquote> </ul> |
From: Finn B. <bc...@us...> - 2001-07-16 13:10:49
|
Update of /cvsroot/jython/jython/Doc In directory usw-pr-cvs1:/tmp/cvs-serv19462 Modified Files: compile.ht Log Message: Added hints about ant.properties and using modules from CPython. Index: compile.ht =================================================================== RCS file: /cvsroot/jython/jython/Doc/compile.ht,v retrieving revision 2.2 retrieving revision 2.3 diff -C2 -r2.2 -r2.3 *** compile.ht 2001/02/07 09:32:11 2.2 --- compile.ht 2001/07/16 13:09:36 2.3 *************** *** 17,21 **** --- 17,32 ---- We are using ant-1.2 to compile the sources and create the .jar file. <p> + The build.xml file will search for a properties file called + <code>ant.properties</code> which can contain values to control paths + and local options. My <code>ant.properties</code> file look like this: + <pre> + javaccHome = i:\\java\\Javacc2.0\\bin\\lib + #build.compiler = classic + build.compiler = jikes + debug=on + </pre> + <p> + <li>Some of the sources in the org.python.parser package are generated from python.jtt file by the JavaCC parser generator. If you need to *************** *** 46,50 **** --- 57,70 ---- a conditional check and will not compile the PyServlet class if the servlet classes isn't available during compilation. + <p> + <li>The CVS only contain a few of the standard python modules. The rest + most come from a CPython installation. Setting this up can be performed by + creating a file ".jython" in your home directory and including a line like + this: + <pre> + python.path=d:\\python\\Python-2.1\\Lib + </pre> + </ul> *************** *** 66,68 **** <li> <A HREF="http://jakarta.apache.org/ant/">Ant 1.2</A> <li> <A HREF="http://java.sun.com/products/servlet/index.html">Servlet classes</A> ! </ul> \ No newline at end of file --- 86,89 ---- <li> <A HREF="http://jakarta.apache.org/ant/">Ant 1.2</A> <li> <A HREF="http://java.sun.com/products/servlet/index.html">Servlet classes</A> ! </ul> ! |
From: Finn B. <bc...@us...> - 2001-07-16 12:32:55
|
Update of /cvsroot/jython/bugtests In directory usw-pr-cvs1:/tmp/cvs-serv12238 Modified Files: test300.py Log Message: Removed debug output. Index: test300.py =================================================================== RCS file: /cvsroot/jython/bugtests/test300.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** test300.py 2001/07/16 11:34:01 1.1 --- test300.py 2001/07/16 12:32:51 1.2 *************** *** 12,16 **** def verify(pos, res): ! print pos, res if pos != res: raise support.TestError, "Wrong filepos #1 (%d, %d)" % (pos, res) --- 12,16 ---- def verify(pos, res): ! #print pos, res if pos != res: raise support.TestError, "Wrong filepos #1 (%d, %d)" % (pos, res) |
From: Finn B. <bc...@us...> - 2001-07-16 11:35:37
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv967 Modified Files: PyFile.java Log Message: seek(): When seeking relative use the logical filePosition, not the fysical filePointer. Fixes test300. Index: PyFile.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyFile.java,v retrieving revision 2.20 retrieving revision 2.21 diff -C2 -r2.20 -r2.21 *** PyFile.java 2001/07/16 10:57:21 2.20 --- PyFile.java 2001/07/16 11:35:34 2.21 *************** *** 421,425 **** public void seek(long pos, int how) throws java.io.IOException { if (how == 1) ! pos += file.getFilePointer(); else if (how == 2) pos += file.length(); --- 421,425 ---- public void seek(long pos, int how) throws java.io.IOException { if (how == 1) ! pos += filePosition; else if (how == 2) pos += file.length(); |
From: Finn B. <bc...@us...> - 2001-07-16 11:34:04
|
Update of /cvsroot/jython/bugtests In directory usw-pr-cvs1:/tmp/cvs-serv789 Added Files: test300.py Log Message: Found bug in multiple seeks without any io in between. --- NEW FILE --- """ test of double seek """ import support s1 = "abcdefghijklmnopqrstuvwxyz" s2 = "0123456789" f = open("test299.out", "wb") f.write(s1) f.close() def verify(pos, res): print pos, res if pos != res: raise support.TestError, "Wrong filepos #1 (%d, %d)" % (pos, res) f = open("test299.out", "rb") f.read() verify(f.tell(), 26) f.seek(-10, 1) verify(f.tell(), 16) f.seek(-10, 1) verify(f.tell(), 6) f.seek(-1, 1) verify(f.tell(), 5) f.seek(-1, 1) verify(f.tell(), 4) f.close() #raise support.TestWarning('A test of TestWarning. It is not an error') |
From: Finn B. <bc...@us...> - 2001-07-16 10:57:24
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv26682 Modified Files: PyFile.java Log Message: Fix for [ #417665 ] open(filename, "a") fails to append. Note that the docs for open() leaves itundefined regarding how much the append flag actually means. Index: PyFile.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyFile.java,v retrieving revision 2.19 retrieving revision 2.20 diff -C2 -r2.19 -r2.20 *** PyFile.java 2001/07/14 22:27:46 2.19 --- PyFile.java 2001/07/16 10:57:21 2.20 *************** *** 721,727 **** java.io.RandomAccessFile rfile = new java.io.RandomAccessFile(f, jmode); - if (c1 == 'a') - rfile.seek(rfile.length()); RFileWrapper iofile = new RFileWrapper(rfile); return iofile; } catch (java.io.IOException e) { --- 721,727 ---- java.io.RandomAccessFile rfile = new java.io.RandomAccessFile(f, jmode); RFileWrapper iofile = new RFileWrapper(rfile); + if (c1 == 'a') + iofile.seek(0, 2); return iofile; } catch (java.io.IOException e) { |
From: Finn B. <bc...@us...> - 2001-07-16 10:55:43
|
Update of /cvsroot/jython/bugtests In directory usw-pr-cvs1:/tmp/cvs-serv26378 Added Files: test299.py Log Message: [ #417665 ] open(filename, "a") fails to append --- NEW FILE --- """ Test that open append position filepointer at the end """ import support s1 = "abcdefghijklmnopqrstuvwxyz" s2 = "0123456789" f = open("test299.out", "wb") f.write(s1) f.close() f = open("test299.out", "ab") f.write(s2) f.close() f = open("test299.out", "rb") res = f.read() f.close() if res != s1 + s2: raise support.TestError('File did not append correctly') |
From: Finn B. <bc...@us...> - 2001-07-16 10:20:26
|
Update of /cvsroot/jython/jython In directory usw-pr-cvs1:/tmp/cvs-serv14049 Added Files: jython.bat jythonc.bat Log Message: Some generic windows startup scripts. They should hopefully make it easier for users of the CVS version to install and setup jython. --- NEW FILE --- @echo off REM This file is *not* generated by any installers. REM It is here only as an convinience to users running from REM the jython CVS. rem -Xmx90mb java.exe -Dpython.home=%JYTHON_HOME% org.python.util.jython %1 %2 %3 %4 %5 %6 %7 %8 %9 --- NEW FILE --- @echo off REM This file is *not* generated by or included with the installer. REM It is here only as an convinience to users running from REM the jython CVS. %JYTHON_HOME%\jython %JYTHON_HOME%\Tools\jythonc\jythonc.py %1 %2 %3 %4 %5 %6 %7 %8 %9 |
From: Finn B. <bc...@us...> - 2001-07-14 22:27:49
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv30373 Modified Files: PyFile.java Log Message: RFileWrapper.seek(): Reset the eof flag when seeking into the buffer. The problem was exposed by test_zipfile.py. Index: PyFile.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyFile.java,v retrieving revision 2.18 retrieving revision 2.19 diff -C2 -r2.18 -r2.19 *** PyFile.java 2001/03/13 20:21:27 2.18 --- PyFile.java 2001/07/14 22:27:46 2.19 *************** *** 430,433 **** --- 430,434 ---- if (pos >= bufferStart && pos < dataEnd) { filePosition = pos; + endOfFile = false; return; } |
From: Finn B. <bc...@us...> - 2001-07-14 22:25:38
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv30087 Modified Files: imp.java Log Message: getSyspathJavaLoader(): Added separate locking object to avoid synchronizing on the class. While the import mechanism was running, another thread was not able to load java code. The problem was exposed by test266. Index: imp.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/imp.java,v retrieving revision 2.46 retrieving revision 2.47 diff -C2 -r2.46 -r2.47 *** imp.java 2001/06/14 19:40:01 2.46 --- imp.java 2001/07/14 22:25:35 2.47 *************** *** 168,176 **** } private static ClassLoader syspathJavaLoader = null; ! public static synchronized ClassLoader getSyspathJavaLoader() { ! if (syspathJavaLoader == null) ! syspathJavaLoader = new SyspathJavaLoader(); return syspathJavaLoader; } --- 168,180 ---- } + private static Object syspathJavaLoaderLock = new Object(); private static ClassLoader syspathJavaLoader = null; ! public static ClassLoader getSyspathJavaLoader() { ! synchronized (syspathJavaLoaderLock) { ! if (syspathJavaLoader == null) { ! syspathJavaLoader = new SyspathJavaLoader(); ! } ! } return syspathJavaLoader; } |
From: Finn B. <bc...@us...> - 2001-07-14 22:23:07
|
Update of /cvsroot/jython/jython/org/python/modules In directory usw-pr-cvs1:/tmp/cvs-serv29824 Modified Files: _codecs.java Log Message: charmap_encode()/charmap_decode(): Remove 1-n mapping restriction. Index: _codecs.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/_codecs.java,v retrieving revision 2.7 retrieving revision 2.8 diff -C2 -r2.7 -r2.8 *** _codecs.java 2001/02/02 11:29:42 2.7 --- _codecs.java 2001/07/14 22:23:03 2.8 *************** *** 88,96 **** "character maps to <undefined>"); } else if (x instanceof PyString) { - if (x.__len__() != 1) { - /* 1-n mapping */ - throw new PyException(Py.NotImplementedError, - "1-n mappings are currently not implemented"); - } v.append(x.toString()); } --- 88,91 ---- *************** *** 136,144 **** "character maps to <undefined>"); } else if (x instanceof PyString) { - if (x.__len__() != 1) { - /* 1-n mapping */ - throw new PyException(Py.NotImplementedError, - "1-n mappings are currently not implemented"); - } v.append(x.toString()); } --- 131,134 ---- |
From: Finn B. <bc...@us...> - 2001-07-14 22:21:39
|
Update of /cvsroot/jython/jython/org/python/modules In directory usw-pr-cvs1:/tmp/cvs-serv29606 Modified Files: binascii.java Log Message: crc32(): Fix a bug exposed by test_zipfile.py. Index: binascii.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/binascii.java,v retrieving revision 2.5 retrieving revision 2.6 diff -C2 -r2.5 -r2.6 *** binascii.java 2001/02/02 11:29:42 2.5 --- binascii.java 2001/07/14 22:21:36 2.6 *************** *** 797,800 **** --- 797,801 ---- int len = bin_data.length(); + crc &= 0xFFFFFFFFL; crc = crc ^ 0xFFFFFFFFL; for (int i = 0; i < len; i++) { |