On 10/10/2013 12:59 AM, William Deegan wrote:
All,

On Oct 9, 2013, at 3:38 PM, Andrew Featherstone 
<[email protected]> wrote:

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.
The ZIPCOMPRESSION is stored in the OverrideEnvironment used for the target, 
and not on the sources (sadly), in this case.
Definitely worth filing an enhancement report (bug) on tigris.org.

I'm thinking there's likely an entire class of use cases where storing such on 
the source rather on the Builder would be useful..
(forced static library,etc)..

-Bill
_______________________________________________
Scons-dev mailing list
[email protected]
http://two.pairlist.net/mailman/listinfo/scons-dev

Dirk: I've pushed what I've got so far to https://bitbucket.org/ajf58/scons_docbook/branch/epub . I've run a basic Docbook through it and generated an EPUB file that passes the validation test here http://validator.idpf.org/ . In it's current form there's a bug in that the files added to the OEBPS directory aren't re-added when the source files are changed. Is it possible for the action functions passed to a Command builder to modify target and source lists?

Bill: I can raise an issue there if you think that's sensible. A quick glance at http://scons.tigris.org/ shows a large number of open tickets. Is this because issues are tracked elsewhere? https://bitbucket.org/scons/scons itself seems to be active, and indeed shows some work using Ghostscript to create EPUB files.

Cheers,
Andrew
_______________________________________________
Scons-dev mailing list
[email protected]
http://two.pairlist.net/mailman/listinfo/scons-dev

Reply via email to