1
0

__init__.py 806 B

1234567891011121314151617181920212223242526272829
  1. from types import SimpleNamespace
  2. from .config import Arch, LinuxTag, PythonImpl, PythonVersion
  3. from .download import Downloader
  4. from .extract import ImageExtractor, PythonExtractor
  5. __all__ = ['Arch', 'Downloader', 'ensure_image', 'ImageExtractor', 'LinuxTag',
  6. 'PythonExtractor', 'PythonImpl', 'PythonVersion']
  7. def ensure_image(tag):
  8. '''Extract a manylinux image to the cache'''
  9. tag, arch = tag.split('_', 1)
  10. tag = LinuxTag.from_brief(tag)
  11. arch = Arch.from_str(arch)
  12. downloader = Downloader(tag=tag, arch=arch)
  13. downloader.download()
  14. image_extractor = ImageExtractor(downloader.default_destination())
  15. image_extractor.extract()
  16. return SimpleNamespace(
  17. arch = arch,
  18. tag = tag,
  19. path = image_extractor.default_destination(),
  20. )