| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- import os
- from pathlib import Path
- import shutil
- from ...appimage import build_appimage
- from ...manylinux import ensure_image, PythonExtractor
- from ...utils.tmp import TemporaryDirectory
- __all__ = ['execute']
- def _unpack_args(args):
- '''Unpack command line arguments
- '''
- return args.tag, args.abi
- def execute(tag, abi):
- '''Build a Python AppImage using a Manylinux image
- '''
- image = ensure_image(tag)
- pwd = os.getcwd()
- with TemporaryDirectory() as tmpdir:
- python_extractor = PythonExtractor(
- arch = image.arch,
- prefix = image.path,
- tag = abi
- )
- appdir = Path(tmpdir) / 'AppDir'
- python_extractor.extract(appdir, appify=True)
- fullname = '-'.join((
- f'{python_extractor.impl}{python_extractor.version.long()}',
- abi,
- f'{image.tag}_{image.arch}'
- ))
- destination = f'{fullname}.AppImage'
- build_appimage(
- appdir = str(appdir),
- destination = destination
- )
- shutil.copy(
- Path(tmpdir) / destination,
- Path(pwd) / destination
- )
|