From 0c743e12488a328a839a402fdd755293e05e6455 Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Fri, 27 Jun 2014 21:12:52 +0200 Subject: [PATCH] Handle *.apk as ZIP files. --- doc/changelog.txt | 2 +- patoolib/util.py | 1 + tests/archives/test_unzip.py | 4 ++++ tests/data/t.apk | Bin 0 -> 5266 bytes tests/data/t.apk.foo | Bin 0 -> 5266 bytes tests/test_mime.py | 2 ++ 6 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 tests/data/t.apk create mode 100644 tests/data/t.apk.foo diff --git a/doc/changelog.txt b/doc/changelog.txt index d0c323f..29c1024 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -2,7 +2,7 @@ * Configure the xz program to also extract LZMA files. * Fixed creation of LZMA files with the Python lzma module. -* Handle *.epub files as ZIP files. +* Handle *.epub and *.apk files as ZIP files. 1.6 (released 8.6.2014) diff --git a/patoolib/util.py b/patoolib/util.py index 5f13345..4f91d6f 100644 --- a/patoolib/util.py +++ b/patoolib/util.py @@ -130,6 +130,7 @@ def add_mimedb_data(mimedb): add_mimetype(mimedb, 'application/x-chm', '.chm') add_mimetype(mimedb, 'application/x-iso9660-image', '.iso') add_mimetype(mimedb, 'application/zip', '.epub') + add_mimetype(mimedb, 'application/zip', '.apk') def add_mimetype(mimedb, mimetype, extension): diff --git a/tests/archives/test_unzip.py b/tests/archives/test_unzip.py index 4939809..aa07970 100644 --- a/tests/archives/test_unzip.py +++ b/tests/archives/test_unzip.py @@ -31,6 +31,8 @@ class TestUnzip (ArchiveTest): self.archive_extract('t.epub', check=None) self.archive_list('t.epub') self.archive_test('t.epub') + self.archive_list('t.apk') + self.archive_test('t.apk') @needs_program('file') @needs_program(program) @@ -44,3 +46,5 @@ class TestUnzip (ArchiveTest): self.archive_extract('t.epub.foo', check=None) self.archive_list('t.epub.foo') self.archive_test('t.epub.foo') + self.archive_list('t.apk.foo') + self.archive_test('t.apk.foo') diff --git a/tests/data/t.apk b/tests/data/t.apk new file mode 100644 index 0000000000000000000000000000000000000000..4e4b4875a980ba4ee11cbb5d38d500462375beae GIT binary patch literal 5266 zcmdT|cUTn5vL7;%lL7*QN|Y=)i--ymR9KL7V95*1F6=HDBngV-927jFWJ!WtBqu?V zpa?6n1W6JE7RmX}a;``8-TU5m|9myybk$T(*Yy0VySl4y-XI}m0Vu&sF40{6B0V0p z1pt5v5dg3Nq=2rbp}MG+-c@m3bv>=Cng)hqx>pZ60l=l(LO=K>XW)vjY&}Ve48QoR zyie6Yzt=4xw}+!uEniAFRcbMGJovftL8I4*CyU#`Ho2lY;8qQ|-enlul}!tbvS@B56@G*Id=es$mp+L%ar zzZYE}hK9=!MNIKbFFG;}?d*0PEF1ziZ%|Mk$LQuS=%H}A()1v5(csMhqWCv@8k)Ba z#SE^xbelPcNC079e47qqyJ*WOTt%sBN22 z5n?l!uNdsa?<_ajyH~sM8flO#y_aoalHylA>-3ftRvpl4AQTxB{edfLfBJdYjazpr zr?pyqYgjdf8I4E;Px|mw!ZV|rU7XfF6!k7ZVk_%hQk>%+au7@AeLVRVzx_03_Jk%P z$;>vSpx{;XcEvg9WBj+=h9fYKL-s3}PVCCq5K;hmNe%#v{{zh12I^9d)@JQ(`2#cW zH!@Pq z^h5RsfuuvB-u|mMR<)U=R#}=a8g$W;(QI9sFmL`A?JcCaohBr~h@fG#zxNixg&>T}ieZGIY`D(qlQ=B}SySGW`|7Z@@!tKNcH@ickS7T24s z>;0^J+n_6$4<=BMgDaJts?e6h_Ukh$#-=Q+NnV~fP@8F!QZ_b6Oyg8)HTW)n2yrWS zdRTgR;47u)l<12)NY6akJj{l&-W1x%h{0(@k;T~d?qmim_oUT#e-$`oFfpBT=xE>p6)P(<7R^=y`g*D~Dr>?cMCJ0>YO( zJ)*NXL%VbDuPznaKtJWq6|{Wu&qEA1SIeL`wPppkTxd@1G5KiNnSELm@J!_7pHHsb zUr4>sRW&g-=zdG@L{piX4vh&U5$Dr=X3p`={$rHxMz#82Lc&;%wzz7ZxU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 zNQbkJ0s<~Q5dW?_`t}vWle4hfY^=&o4VyM^&Z0p^SSJwZ6TSx!cE4 zER8vx%dXrpaL3GL+(_vl;Pc=U^M(#utY32-2j+8Mas7gg=VXJm26A_ojDYZQ90>?h zfmi}ZN%Jy3UCa=Sn}nMVAR!=(bVu2MkrRqS+kh_-12jjK1TPQ)oPgnx4lD=+DtZ5s zj!GV|=2Kfp<}2D&!@Y-~EjU3u!K@K*1UcxBBfND$PS70@ zs2BMmgB)Dzj&gN&kdu-^F&Gp;PX5>Y00lG#1w%Lh#KbULu%6&MbC4749ua6u@P`a? zLYhjjO-J|Z%mUchepOgv?7T2X1^7*Z47!k*;iw;=$s-~>vw#xlR>BZDA|hgWfbcIr zbjqN7eC+)7*1s<)|D^``QTKn?{|lqPDu3Ajq5E&`6Z%Q8PvAf76L9~%|37s9t$o6O zgZ7y~25!BHh*>~{{?o}7;hmrK_esoe=UBg6Ier{LIKlZzs^CxjZRKC*Ils3)o(d4g z!cU3-yZ&oy@BriY=ErwtgnZ#A>4Ky5-((NJ8#ulQ5H@f>Y5&A8+qvHx9*=E=HR31r s)BYbT2Eh~+@SlR=PeTA8Lw{uISZKU?gA7cK2y>7EXa(`DI`Zs40T$33AOHXW literal 0 HcmV?d00001 diff --git a/tests/data/t.apk.foo b/tests/data/t.apk.foo new file mode 100644 index 0000000000000000000000000000000000000000..4e4b4875a980ba4ee11cbb5d38d500462375beae GIT binary patch literal 5266 zcmdT|cUTn5vL7;%lL7*QN|Y=)i--ymR9KL7V95*1F6=HDBngV-927jFWJ!WtBqu?V zpa?6n1W6JE7RmX}a;``8-TU5m|9myybk$T(*Yy0VySl4y-XI}m0Vu&sF40{6B0V0p z1pt5v5dg3Nq=2rbp}MG+-c@m3bv>=Cng)hqx>pZ60l=l(LO=K>XW)vjY&}Ve48QoR zyie6Yzt=4xw}+!uEniAFRcbMGJovftL8I4*CyU#`Ho2lY;8qQ|-enlul}!tbvS@B56@G*Id=es$mp+L%ar zzZYE}hK9=!M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~>vw#xlR>BZDA|hgWfbcIr zbjqN7eC+)7*1s<)|D^``QTKn?{|lqPDu3Ajq5E&`6Z%Q8PvAf76L9~%|37s9t$o6O zgZ7y~25!BHh*>~{{?o}7;hmrK_esoe=UBg6Ier{LIKlZzs^CxjZRKC*Ils3)o(d4g z!cU3-yZ&oy@BriY=ErwtgnZ#A>4Ky5-((NJ8#ulQ5H@f>Y5&A8+qvHx9*=E=HR31r s)BYbT2Eh~+@SlR=PeTA8Lw{uISZKU?gA7cK2y>7EXa(`DI`Zs40T$33AOHXW literal 0 HcmV?d00001 diff --git a/tests/test_mime.py b/tests/test_mime.py index 117e5e9..64bab11 100644 --- a/tests/test_mime.py +++ b/tests/test_mime.py @@ -125,6 +125,7 @@ class TestMime (unittest.TestCase): self.mime_test_file("t.chm.foo", "application/x-chm") self.mime_test_file("t.iso", "application/x-iso9660-image") self.mime_test_file("t.epub", "application/zip") + self.mime_test_file("t.apk", "application/zip") @needs_program('file') @needs_program('lzip') @@ -200,3 +201,4 @@ class TestMime (unittest.TestCase): self.mime_test_mimedb("t.chm", "application/x-chm") self.mime_test_mimedb("t.iso", "application/x-iso9660-image") self.mime_test_mimedb("t.epub", "application/zip") + self.mime_test_mimedb("t.apk", "application/zip")