@@ -422,35 +422,29 @@ def unpack(self, arch):
422422 extraction_filename = join (
423423 self .ctx .packages_path , self .name , filename )
424424 if isfile (extraction_filename ):
425- if extraction_filename .endswith ('.tar.gz' ) or \
426- extraction_filename .endswith ('.tgz' ):
427- sh .tar ('xzf' , extraction_filename )
428- root_directory = shprint (
429- sh .tar , 'tzf' , extraction_filename ).stdout .decode (
430- 'utf-8' ).split ('\n ' )[0 ].split ('/' )[0 ]
431- if root_directory != directory_name :
432- shprint (sh .mv , root_directory , directory_name )
433- elif (extraction_filename .endswith ('.tar.bz2' ) or
434- extraction_filename .endswith ('.tbz2' )):
435- info ('Extracting {} at {}'
436- .format (extraction_filename , filename ))
437- sh .tar ('xjf' , extraction_filename )
438- root_directory = sh .tar (
439- 'tjf' , extraction_filename ).stdout .decode (
440- 'utf-8' ).split ('\n ' )[0 ].split ('/' )[0 ]
441- if root_directory != directory_name :
442- shprint (sh .mv , root_directory , directory_name )
443- elif extraction_filename .endswith ('.zip' ):
425+ if extraction_filename .endswith ('.zip' ):
444426 sh .unzip (extraction_filename )
445427 import zipfile
446428 fileh = zipfile .ZipFile (extraction_filename , 'r' )
447429 root_directory = fileh .filelist [0 ].filename .split ('/' )[0 ]
448430 if root_directory != directory_name :
449431 shprint (sh .mv , root_directory , directory_name )
432+ elif (extraction_filename .endswith ('.tar.gz' ) or
433+ extraction_filename .endswith ('.tgz' ) or
434+ extraction_filename .endswith ('.tar.bz2' ) or
435+ extraction_filename .endswith ('.tbz2' ) or
436+ extraction_filename .endswith ('.tar.xz' ) or
437+ extraction_filename .endswith ('.txz' )):
438+ sh .tar ('xf' , extraction_filename )
439+ root_directory = shprint (
440+ sh .tar , 'tf' , extraction_filename ).stdout .decode (
441+ 'utf-8' ).split ('\n ' )[0 ].split ('/' )[0 ]
442+ if root_directory != directory_name :
443+ shprint (sh .mv , root_directory , directory_name )
450444 else :
451445 raise Exception (
452446 'Could not extract {} download, it must be .zip, '
453- '.tar.gz or .tar.bz2' )
447+ '.tar.gz or .tar.bz2 or .tar.xz ' )
454448 elif isdir (extraction_filename ):
455449 mkdir (directory_name )
456450 for entry in listdir (extraction_filename ):
0 commit comments