This is a 7-Zip archive support patch for the newest downloadable Comix release.
I wrote a similar patch for Comix 3.6.4 (or something like that) last summer, but it was discarded along with the old release. This patch has been rewritten from scratch for the new version. The patch adds the 7z support in a fashion similar to the existing RAR file support.
In addition to 7z functionality, the patch adds the following other tweaks:
- 7z executables and rar executables are searched for in an uniform manner. This is written to archive.py, but the external binary search is done as a generic function, that should probably go somewhere else. You can cut and paste it where appropriate.
- Both 7z and rar files pose a potential problem, since it is possible to do solid archiving with them. If the archives are solid, extracting individual files takes significant amounts of time, much akin to tar-gzip or tar-bzip2. I added an extra flag 'files_is_all_files' that starts as true when the extractor setup is ran. When set_files is called for the extractor, this flag is set to false assuming that the new file list is shorter than the full list (as it is with thumbnail extraction). Otherwise, the flag stays true, and rar or 7z executable calls extract the full archive contents in one go, which speeds up solid archive opens by several orders of magnitude.
Note: Setting the file list in the manner specified above is kind of clumsy, how about some kind of extract_one_file or extract_all_files -methods for the extractor class so it'd be easier to cut corners? If not, I believe RAR and 7-Zip should both support extracting multiple named files in one pass, this could easily be used to circumvent the problem altogether.
I can rewrite the patch for the SVN trunk version on request.