On 10/09/2013 09:18 AM, Dirk Bächle wrote:
Andrew,
thanks for the update on your progress. Sounds good so far...
On 09.10.2013 00:26, Andrew Featherstone wrote:
Hi Dirk,
Yes my tool takes care of zipping up and formatting the container
correctly. Unfortunately the SCons Zip builder method doesn't support
source files with different compression types; perhaps that's a
separate feature that could be added. For now I'm using the Python
zipfile module directly and achieving what's required.
I had a look at the Zip Builder too. From what I understood you should
be able to call it repeatedly, such that you append files to an
already existing archive. Wouldn't this open the possibility of
specifying different compression modes then?
Whilst that's true, I can't get the desired results. As a simple example
where foo.txt and bar.txt are two files to be compressed using different
compression algorithms
# SConstruct
import zipfile
Zip('out', 'foo.txt', ZIPCOMPRESSION=zipfile.ZIP_STORED)
Zip('out', 'bar.txt', ZIPCOMPRESSION=zipfile.ZIP_DEFLATED)
$ scons
scons: Reading SConscript files ...
scons: *** Two environments with different actions were specified for
the same target: out.zip
Creating a intermediate target doesn't help, as the result is simply
nested zip archives. E.g.
# SConstruct
import zipfile
Zip('tmp', 'foo.txt', ZIPCOMPRESSION=zipfile.ZIP_STORED)
Zip('outer', ['bar.txt', 'tmp.zip'], ZIPCOMPRESSION=zipfile.ZIP_DEFLATED)
results in outer.zip containing bar.txt compressed using the deflate
algorithm, and an archive containing a single uncompressed foo.txt.
The EPUB recipes on the Internet that I found used the simple "zip
-X9rD OEBPS" to archive the stuff together. So I'm wondering whether
it's really required to support special compression settings...
My understanding of the specification is that the mimetype file needs to
be uncompressed. See
http://www.idpf.org/epub/30/spec/epub30-ocf.html#sec-zip-container-mime
. It's permitted for all files to be uncompressed, but that results in
needlessly large EPUB files. I imagine that lots of EPUB readers are
designed to be tolerant of recipes that compress everything, despite it
being against the specification.
Regards,
Andrew
_______________________________________________
Scons-dev mailing list
Scons-dev@scons.org
http://two.pairlist.net/mailman/listinfo/scons-dev