def unarchive(host, source_material):
 if (source_material.endswith('.gz') or source_material.endswith('.gzip')):
  host.run(('gunzip "%s"' % utils.sh_escape(source_material)))
  source_material = '.'.join(source_material.split('.')[:(-1)])
 elif source_material.endswith('bz2'):
  host.run(('bunzip2 "%s"' % utils.sh_escape(source_material)))
  source_material = '.'.join(source_material.split('.')[:(-1)])
 if source_material.endswith('.tar'):
  retval = host.run(('tar -C "%s" -xvf "%s"' % (utils.sh_escape(os.path.dirname(source_material)), utils.sh_escape(source_material))))
  source_material = os.path.join(os.path.dirname(source_material), retval.stdout.split()[0])
 return source_material

def unarchive ( host , source_material ) : if ( source_material . endswith ( '.gz' ) or source_material . endswith ( '.gzip' ) ) : host . run ( ( 'gunzip "%s"' % utils . sh_escape ( source_material ) ) ) source_material = '.' . join ( source_material . split ( '.' ) [ : ( - 1 ) ] ) elif source_material . endswith ( 'bz2' ) : host . run ( ( 'bunzip2 "%s"' % utils . sh_escape ( source_material ) ) ) source_material = '.' . join ( source_material . split ( '.' ) [ : ( - 1 ) ] ) if source_material . endswith ( '.tar' ) : retval = host . run ( ( 'tar -C "%s" -xvf "%s"' % ( utils . sh_escape ( os . path . dirname ( source_material ) ) , utils . sh_escape ( source_material ) ) ) ) source_material = os . path . join ( os . path . dirname ( source_material ) , retval . stdout . split ( ) [ 0 ] ) return source_material
extract the contents of a tar or zip file at *archive_path* into the directory *dest* .