Archive: Support for LZMA (patch)

Bernard Jungen <[email protected]>
Newsgroups gmane.comp.desktop.rox.devel
Message-ID <[email protected]>
Hi,

Attached is a little patch to support LZMA in Archive.

Cheers,

Bernard.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
rox-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rox-devel
archive_lzma (text/plain, 3.7 KB)
diff -rc Archive.old/AppInfo.xml Archive/AppInfo.xml
*** Archive.old/AppInfo.xml	2006-05-27 13:02:10.000000000 +0200
--- Archive/AppInfo.xml	2008-05-31 16:52:42.000000000 +0200
***************
*** 1,20 ****
  <?xml version="1.0"?>
  <AppInfo>
    <Summary xml:lang="en">Create or read archive files.
! Such files usually have names ending in .gz, .tar, .tgz, .bz2, .rar or .zip.</Summary>
    <Summary xml:lang="it">Legge e crea file di archivio.
! Normalmente tali file hanno estensione .gz, .tar, .tgz, .bz2, .rar or .zip.</Summary>
    <Summary xml:lang="es">Crea o lee archivos de ficheros.
! Usualmente estos archivos tienen extensiones .gz, .tar, .tgz, .bz2, .rar o .zip.</Summary>
    <Summary xml:lang="de">Schnüren von oder entpacken aus Paketen (Archiven).
! Pakete enden üblicherweise auf .gz, .tar, .tgz, .bz2, .rar
! oder .zip.</Summary>
    <Summary xml:lang="zh_CN">建立或读取压缩档案.
! 档案的副档名一般为 .gz, .tar, .tgz, .bz2, .rar 或 .zip.</Summary>
    <Summary xml:lang="zh_TW">建立或讀取壓縮檔案.
! 檔案的副檔名一般為 .gz, .tar, .tgz, .bz2, .rar 或 .zip.</Summary>
    <Summary xml:lang="hu">Archív fájlok készítése vagy kicsomagolása.
! E fájlok nevének végződése általában .gz, .tar, .tgz, .bz2, .rar vagy .zip.</Summary>
    <About xml:lang="en">
      <Purpose>Create and read archive files</Purpose>
      <Version>2.1 (27-May-2006)</Version>
--- 1,20 ----
  <?xml version="1.0"?>
  <AppInfo>
    <Summary xml:lang="en">Create or read archive files.
! Such files usually have names ending in .gz, .tar, .tgz, .bz2, .rar, .zip or .lzma.</Summary>
    <Summary xml:lang="it">Legge e crea file di archivio.
! Normalmente tali file hanno estensione .gz, .tar, .tgz, .bz2, .rar, .zip or .lzma.</Summary>
    <Summary xml:lang="es">Crea o lee archivos de ficheros.
! Usualmente estos archivos tienen extensiones .gz, .tar, .tgz, .bz2, .rar, .zip o .lzma.</Summary>
    <Summary xml:lang="de">Schnüren von oder entpacken aus Paketen (Archiven).
! Pakete enden üblicherweise auf .gz, .tar, .tgz, .bz2, .rar, .zip
! oder .lzma.</Summary>
    <Summary xml:lang="zh_CN">建立或读取压缩档案.
! 档案的副档名一般为 .gz, .tar, .tgz, .bz2, .rar, .zip 或 .lzma.</Summary>
    <Summary xml:lang="zh_TW">建立或讀取壓縮檔案.
! 檔案的副檔名一般為 .gz, .tar, .tgz, .bz2, .rar, .zip 或 .lzma.</Summary>
    <Summary xml:lang="hu">Archív fájlok készítése vagy kicsomagolása.
! E fájlok nevének végződése általában .gz, .tar, .tgz, .bz2, .rar, .zip vagy .lzma.</Summary>
    <About xml:lang="en">
      <Purpose>Create and read archive files</Purpose>
      <Version>2.1 (27-May-2006)</Version>
diff -rc Archive.old/formats.py Archive/formats.py
*** Archive.old/formats.py	2005-04-17 17:29:31.000000000 +0200
--- Archive/formats.py	2008-05-31 16:48:45.000000000 +0200
***************
*** 156,167 ****
--- 156,169 ----
  # Note: these go afterwards so that .tar.gz matches before .gz
  make_gz = Compress('gz', "gzip -c -", 'application/x-gzip')
  Compress('bz2', "bzip2 -c -", 'application/x-bzip')
+ Compress('lzma', "lzma -c -", 'application/x-lzma')
  Compress('uue', "uuencode /dev/stdout", 'application/x-uuencoded')
  
  gz = Decompress('gz',   "gunzip -c -")
  bz2 = Decompress('bz2',  "bunzip2 -ck -")
  uue = Decompress('uue',  "uudecode -o /dev/stdout")
  z   = Decompress('Z',   "uncompress -c -")
+ lzma= Decompress('lzma', "unlzma -c -")
  
  
  # Can bzip2 read bzip files?
***************
*** 275,280 ****
--- 277,284 ----
  			   self.path.endswith('.tbz') or self.path.endswith('.tbz2'):
  				return tbz
  			return bz2
+ 		if string(0, ']\0\0') and (0 == ord(data[3]) & 0x7f):
+ 			return lzma
  		if string(0, 'begin '):
  			return uue
  		if string(0, '\037\235'):
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.