[Scons-dev] Documentation in EPUB-format

William Deegan bill at baddogconsulting.com
Wed Oct 9 19:59:09 EDT 2013


All,

On Oct 9, 2013, at 3:38 PM, Andrew Featherstone <andrew.featherstone at cantab.net> 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


More information about the Scons-dev mailing list