Skip to content

Instantly share code, notes, and snippets.

@dsuch
Created May 29, 2012 11:58
Show Gist options
  • Save dsuch/2828049 to your computer and use it in GitHub Desktop.
Save dsuch/2828049 to your computer and use it in GitHub Desktop.
Decompress any archive in Python
# pip
from pip.download import unpack_file_url
class _DummyLink(object):
""" A dummy class for staying consistent with pip's API in certain places
below.
"""
def __init__(self, url):
self.url = url
def decompress(archive, dir_name):
""" Decompresses an archive into a directory, the directory must already exist.
"""
unpack_file_url(_DummyLink('file:' + archive), dir_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment