You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
673 B

4 years ago
  1. from __future__ import print_function
  2. import os.path
  3. import sys
  4. from ..wheelfile import WheelFile
  5. def unpack(path, dest='.'):
  6. """Unpack a wheel.
  7. Wheel content will be unpacked to {dest}/{name}-{ver}, where {name}
  8. is the package name and {ver} its version.
  9. :param path: The path to the wheel.
  10. :param dest: Destination directory (default to current directory).
  11. """
  12. with WheelFile(path) as wf:
  13. namever = wf.parsed_filename.group('namever')
  14. destination = os.path.join(dest, namever)
  15. print("Unpacking to: {}...".format(destination), end='')
  16. sys.stdout.flush()
  17. wf.extractall(destination)
  18. print('OK')