Issue1445
Created on 2009-08-21.12:50:07 by pjdm, last changed 2010-03-09.05:07:35 by pjenvey.
| msg5061 (view) |
Author: Peter Mayne (pjdm) |
Date: 2009-08-21.12:50:07 |
|
Jython does not include the bz2 module.
|
| msg5170 (view) |
Author: Steve Lewis (spiritmech) |
Date: 2009-09-15.00:25:55 |
|
I'm looking into this one. I'll update this ticket if for some reason I
get in too deep, but I'm trying to follow the
PortingPythonModulesToJython wiki page.
|
| msg5189 (view) |
Author: Steve Lewis (spiritmech) |
Date: 2009-09-24.00:53:21 |
|
Hey Peter,
I'm just curious what need you had for bz2. Is another library using it?
The reason I ask is because Philip Jenvey mentioned that the hard part
is handling streaming, which the Java library from Apache doesn't support.
I'm not sure if the current test cases test for streaming or not, I'm
going to check into it. If they don't, maybe your need for bz2 can help
me think of a use case beyond "stream random data into/out of bz2".
Although if I have to create those use cases I can do that, too.
|
| msg5193 (view) |
Author: Peter Mayne (pjdm) |
Date: 2009-09-24.13:12:16 |
|
Mercurial uses bz2 for bundles and archives. See "hg help bundle" and
"hg help archive".
|
| msg5482 (view) |
Author: ita (ita) |
Date: 2010-02-02.14:40:08 |
|
The module bz2 is still missing, and opening tar.bz2 files fails with:
"file could not be opened successfully"
|
| msg5484 (view) |
Author: ita (ita) |
Date: 2010-02-02.19:38:46 |
|
It seems there are classes for bzip2 support in ant. Would it be possible to import them in the jython tree?
http://www.kohsuke.org/bzip2/
|
| msg5485 (view) |
Author: Philip Jenvey (pjenvey) |
Date: 2010-02-02.19:53:14 |
|
Here's a jython-dev thread with a little more detail
http://markmail.org/message/fwpt4nlvgiskgfur
Basically we can implement bz2 with the Apache library but it does not support streaming of decompression (which Python's bz2.BZ2Decompressor does). It should support encoding via a stream however (bz2.BZ2Compressor).
This would be better than nothing as I think most uses of the bz2 module are via bz2.BZ2File, which doesn't stream
Another alternative is a former Jython contributor tried implementing a port of the libbz2 C code to Java for his Jythonx project. I don't know what state this code is in though
|
| msg5486 (view) |
Author: Philip Jenvey (pjenvey) |
Date: 2010-02-02.19:55:41 |
|
Furthermore here's my attempt at writing a bz2 module with the Apache lib from a couple years ago. I think I updated it slightly to work with the Apache commons bz2 compressor, which is pretty much the same as http://www.kohsuke.org/bzip2/ under a different name
It'd be a good starting point
|
| msg5487 (view) |
Author: Philip Jenvey (pjenvey) |
Date: 2010-02-02.19:56:14 |
|
Attaching the other jythonx bz2 implemention
|
| msg5519 (view) |
Author: ita (ita) |
Date: 2010-02-11.18:23:19 |
|
Please have a look at the following patch, which enables jython to read tar.bz2 files:
http://freehackers.org/~tnagy/bz2.diff
* is it permitted to import the apache classes like this?
* is a PyFile wrapper ok or is it more recommendable to use a class (in a python file or in a java file?)
* are there gotchas with using PyFile (memory leaks, file remaining open on win32, ...) ?
Note: this bug tracker does not allow attachments. It would be fine if the error message did not eat the message (not nice!)
|
| msg5563 (view) |
Author: Philip Jenvey (pjenvey) |
Date: 2010-03-07.23:31:19 |
|
ita -
I was hoping the bz2.tar.bz2 I posted could be used as a starting point. It actually has a lot of BZ2File implemented and at least some of work for the stream objects (I think BZ2Compressor is done). Though it's in Java code which may not be as easy to deal with. Have you looked at it?
There's a test_bz2 that we need to be passing at least most of before we ship a bz2 module
|
| msg5564 (view) |
Author: Philip Jenvey (pjenvey) |
Date: 2010-03-09.05:07:35 |
|
Here's an updated version of the code that compiles against the current trunk. There's no BZ2Decompressor code included, fully supporting it will be the tricky bit
|
|
| Date |
User |
Action |
Args |
| 2010-03-09 05:07:36 | pjenvey | set | files:
+ bz2_v2.tar.bz2 messages:
+ msg5564 |
| 2010-03-07 23:31:20 | pjenvey | set | messages:
+ msg5563 |
| 2010-02-11 18:23:20 | ita | set | messages:
+ msg5519 |
| 2010-02-02 19:56:15 | pjenvey | set | files:
+ jythonx-bits.tar.bz2 messages:
+ msg5487 |
| 2010-02-02 19:55:41 | pjenvey | set | files:
+ bz2.tar.bz2 messages:
+ msg5486 |
| 2010-02-02 19:53:14 | pjenvey | set | messages:
+ msg5485 |
| 2010-02-02 19:38:46 | ita | set | messages:
+ msg5484 |
| 2010-02-02 14:40:09 | ita | set | nosy:
+ ita messages:
+ msg5482 |
| 2009-09-26 02:42:08 | pjenvey | set | nosy:
+ pjenvey |
| 2009-09-24 13:12:16 | pjdm | set | messages:
+ msg5193 |
| 2009-09-24 00:53:22 | spiritmech | set | messages:
+ msg5189 |
| 2009-09-15 00:25:56 | spiritmech | set | nosy:
+ spiritmech messages:
+ msg5170 |
| 2009-08-21 12:50:07 | pjdm | create | |
|