Merge pull request #127 from ignatenkobrain/untar_xz

add support for tar.xz file. Closes #126
pull/131/head
jpakkane 10 years ago
commit 49686c29f2
  1. 8
      wrap.py

@ -15,6 +15,7 @@
import mlog import mlog
import urllib.request, os, hashlib, shutil import urllib.request, os, hashlib, shutil
import subprocess import subprocess
import sys
class PackageDefinition: class PackageDefinition:
def __init__(self, fname): def __init__(self, fname):
@ -121,6 +122,13 @@ class Resolver:
open(ofname, 'wb').write(srcdata) open(ofname, 'wb').write(srcdata)
def extract_package(self, package): def extract_package(self, package):
if sys.version_info < (3, 5):
try:
import lzma
del lzma
shutil.register_unpack_format('xztar', ['.tar.xz', '.txz'], shutil._unpack_tarfile, [], "xz'ed tar-file")
except ImportError:
pass
if os.path.isdir(os.path.join(self.subdir_root, package.get('directory'))): if os.path.isdir(os.path.join(self.subdir_root, package.get('directory'))):
return return
shutil.unpack_archive(os.path.join(self.cachedir, package.get('source_filename')), self.subdir_root) shutil.unpack_archive(os.path.join(self.cachedir, package.get('source_filename')), self.subdir_root)

Loading…
Cancel
Save