Created
May 29, 2012 11:58
-
-
Save dsuch/2828049 to your computer and use it in GitHub Desktop.
Decompress any archive in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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