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