Make cpio more platform compatible.

This commit is contained in:
Bastian Kleineidam 2012-05-23 05:39:39 +02:00
parent 9a8ef2678d
commit 5e43aaffb7
1 changed files with 5 additions and 2 deletions

View File

@ -15,13 +15,16 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Archive commands for the cpio program."""
import os
import sys
from patoolib import util
def extract_cpio (archive, compression, cmd, **kwargs):
"""Extract a CPIO archive."""
cmdlist = [util.shell_quote(cmd), '--extract', '--make-directories',
'--preserve-modification-time', '--no-absolute-filenames',
'--force-local', '--nonmatching', r'"*\.\.*"']
'--preserve-modification-time']
if sys.platform != 'darwin':
cmdlist.extend(['--no-absolute-filenames',
'--force-local', '--nonmatching', r'"*\.\.*"'])
if kwargs['verbose']:
cmdlist.append('-v')
cmdlist.extend(['<', util.shell_quote(os.path.abspath(archive))])