Michele Lacchia  committed d8143f8

Wheel unpack

  • Participants
  • Parent commits 656a87b
  • Branches default

Comments (0)

Files changed (2)

File wheel/

 Wheel command-line utility.
+import os
 import baker
 import ed25519ll
 import sys
 wb = baker.Baker()
 def keygen():
     """Generate a public/private key pair."""
     keypair = ed25519ll.crypto_sign_keypair()
     if sk2 != sk:
         raise Exception("Keyring is broken. Could not retrieve secret key.")
 def sign(wheelfile, replace=False):
     """Sign a wheel"""
     import hashlib    
     wf.zipfile.writestr(sig_name, json.dumps(sig, sort_keys=True))
 def verify(wheelfile):
     """Verify a wheel."""
     import pprint
     sys.stdout.write("Signatures are internally consistent.\n%s\n" % (
-def main():
+@wb.command(shortopts={'dest': 'd'})
+def unpack(wheelfile, dest='.'):
+    """Unpack a wheel.
+    Wheel content will be unpacked to {dest}/{name}-{ver}, where {name}
+    is the package name and {ver} its version.
+    :param wheelfile: The path to the wheel.
+    :param dest: Destination directory (default to current directory).
+    """
+    wf = wheel.install.WheelFile(wheelfile)
+    namever ='namever')
+    destination = os.path.join(dest, namever)
+    sys.stdout.write("Unpacking to: %s\n" % (destination))
+    wf.zipfile.extractall(destination)
+    wf.zipfile.close()
 if __name__ == "__main__":

File wheel/

 class BadWheelFile(ValueError):
 class WheelFile(object):
     """Parse wheel-specific attributes from a wheel (.whl) file"""