diff --git a/doc/changelog.txt b/doc/changelog.txt
index 7643e9e..edff005 100644
--- a/doc/changelog.txt
+++ b/doc/changelog.txt
@@ -3,7 +3,7 @@
* Fixed unadf archive listing.
* Added support for Python 3.x.
* Use importlib to find program modules and depend on Python >= 2.7.
-* Added support for archmage handling CHM (.chm) archives.
+* Added support for archmage and chmlib handling CHM (.chm) archives.
0.17 "I am Bruce Lee" (released 4.8.2012)
diff --git a/patoolib/__init__.py b/patoolib/__init__.py
index 92ffd3c..e4bda93 100644
--- a/patoolib/__init__.py
+++ b/patoolib/__init__.py
@@ -126,7 +126,7 @@ ArchivePrograms = {
'test': ('cabextract', '7z'),
},
'chm': {
- 'extract': ('archmage',),
+ 'extract': ('archmage', 'extract_chmLib'),
'test': ('archmage',),
},
'flac': {
@@ -247,6 +247,7 @@ ProgramModules = {
'7za': 'p7azip',
'uncompress.real': 'uncompress',
'dpkg-deb': 'dpkg',
+ 'extract_chmlib': 'chmlib',
}
diff --git a/patoolib/programs/chmlib.py b/patoolib/programs/chmlib.py
new file mode 100644
index 0000000..5a73ce3
--- /dev/null
+++ b/patoolib/programs/chmlib.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+# Copyright (C) 2012 Bastian Kleineidam
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+"""Archive commands for the chmlib programs."""
+import os
+
+
+def extract_chm (archive, compression, cmd, **kwargs):
+ """Extract a CHM archive."""
+ return [cmd, os.path.abspath(archive), kwargs['outdir']]
diff --git a/tests/archives/test_chmlib.py b/tests/archives/test_chmlib.py
new file mode 100644
index 0000000..c2c94c6
--- /dev/null
+++ b/tests/archives/test_chmlib.py
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+# Copyright (C) 2012 Bastian Kleineidam
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+from . import ArchiveTest
+from .. import needs_program
+
+class TestChmlib (ArchiveTest):
+
+ program = 'extract_chmLib'
+
+ @needs_program(program)
+ def test_archmage (self):
+ self.archive_extract('t.chm', check=None)
+
+ @needs_program('file')
+ @needs_program(program)
+ def test_archmage_file (self):
+ self.archive_extract('t.chm.foo', check=None)