mirror of
https://github.com/niess/python-appimage.git
synced 2026-03-13 20:00:19 +01:00
No packaging option
This commit is contained in:
@@ -78,10 +78,13 @@ def main():
|
||||
help='manylinux image tag (e.g. 2010_x86_64)')
|
||||
build_manylinux_parser.add_argument('abi',
|
||||
help='python ABI (e.g. cp37-cp37m)')
|
||||
build_manylinux_parser.add_argument('-b', '--bare',
|
||||
help='produce a bare image without the AppImage layer',
|
||||
action='store_true')
|
||||
build_manylinux_parser.add_argument('-c', '--clean',
|
||||
help='clean the cache after extraction', action='store_true')
|
||||
build_manylinux_parser.add_argument('-t', '--tarball',
|
||||
help='build a bare tarball instead of an AppImage', action='store_true')
|
||||
build_manylinux_parser.add_argument('-n', '--no-packaging',
|
||||
help='do not package (compress) the image', action='store_true')
|
||||
|
||||
build_app_parser = build_subparsers.add_parser('app',
|
||||
description='Build a Python application using a base AppImage')
|
||||
@@ -93,6 +96,8 @@ def main():
|
||||
help='linux compatibility tag (e.g. manylinux1_x86_64)')
|
||||
build_app_parser.add_argument('-n', '--name',
|
||||
help='application name')
|
||||
build_app_parser.add_argument('--no-packaging',
|
||||
help='do not package the app', action='store_true')
|
||||
build_app_parser.add_argument('--python-tag',
|
||||
help='python compatibility tag (e.g. cp37-cp37m)')
|
||||
build_app_parser.add_argument('-p', '--python-version',
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import json
|
||||
import glob
|
||||
import os
|
||||
from pathlib import Path
|
||||
import platform
|
||||
import re
|
||||
import shutil
|
||||
import stat
|
||||
import struct
|
||||
|
||||
@@ -27,7 +27,7 @@ def _unpack_args(args):
|
||||
'''
|
||||
return args.appdir, args.name, args.python_version, args.linux_tag, \
|
||||
args.python_tag, args.base_image, args.in_tree_build, \
|
||||
args.extra_data
|
||||
args.extra_data, args.no_packaging
|
||||
|
||||
|
||||
_tag_pattern = re.compile('python([^-]+)[-]([^.]+)[.]AppImage')
|
||||
@@ -36,7 +36,7 @@ _linux_pattern = re.compile('manylinux([0-9]+)_' + platform.machine())
|
||||
|
||||
def execute(appdir, name=None, python_version=None, linux_tag=None,
|
||||
python_tag=None, base_image=None, in_tree_build=False,
|
||||
extra_data=None):
|
||||
extra_data=None, no_packaging=None):
|
||||
'''Build a Python application using a base AppImage
|
||||
'''
|
||||
|
||||
@@ -321,7 +321,10 @@ def execute(appdir, name=None, python_version=None, linux_tag=None,
|
||||
|
||||
|
||||
# Build the new AppImage
|
||||
destination = '{:}-{:}.AppImage'.format(application_name,
|
||||
platform.machine())
|
||||
build_appimage(destination=destination)
|
||||
shutil.move(destination, os.path.join(pwd, destination))
|
||||
fullname = '{:}-{:}'.format(application_name, platform.machine())
|
||||
if no_packaging:
|
||||
copy_tree('AppDir', Path(pwd) / fullname)
|
||||
else:
|
||||
destination = f'{fullname}.AppImage'
|
||||
build_appimage(destination=destination)
|
||||
copy_file(destination, os.path.join(pwd, destination))
|
||||
|
||||
@@ -12,7 +12,7 @@ __all__ = ['execute']
|
||||
def _unpack_args(args):
|
||||
'''Unpack command line arguments
|
||||
'''
|
||||
return args.python, args.destination
|
||||
return args.python, args.destination, args.no_packaging
|
||||
|
||||
|
||||
def execute(python=None, destination=None):
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
import tarfile
|
||||
import shutil
|
||||
|
||||
from ...appimage import build_appimage
|
||||
from ...manylinux import ensure_image, PythonExtractor
|
||||
from ...utils.fs import copy_file, copy_tree
|
||||
from ...utils.log import log
|
||||
from ...utils.tmp import TemporaryDirectory
|
||||
|
||||
@@ -15,10 +15,10 @@ __all__ = ['execute']
|
||||
def _unpack_args(args):
|
||||
'''Unpack command line arguments
|
||||
'''
|
||||
return args.tag, args.abi, args.clean, args.tarball
|
||||
return args.tag, args.abi, args.bare, args.clean, args.no_packaging
|
||||
|
||||
|
||||
def execute(tag, abi, clean, tarball):
|
||||
def execute(tag, abi, bare, clean, no_packaging):
|
||||
'''Build a Python AppImage using a Manylinux image
|
||||
'''
|
||||
|
||||
@@ -32,7 +32,7 @@ def execute(tag, abi, clean, tarball):
|
||||
tag = abi
|
||||
)
|
||||
appdir = Path(tmpdir) / 'AppDir'
|
||||
appify = not tarball
|
||||
appify = not bare
|
||||
python_extractor.extract(appdir, appify=appify)
|
||||
|
||||
fullname = '-'.join((
|
||||
@@ -41,13 +41,18 @@ def execute(tag, abi, clean, tarball):
|
||||
f'{image.tag}_{image.arch}'
|
||||
))
|
||||
|
||||
if tarball:
|
||||
if no_packaging:
|
||||
copy_tree(
|
||||
Path(tmpdir) / 'AppDir',
|
||||
Path(pwd) / fullname
|
||||
)
|
||||
elif bare:
|
||||
log('COMPRESS', fullname)
|
||||
destination = f'{fullname}.tgz'
|
||||
tar_path = Path(tmpdir) / destination
|
||||
with tarfile.open(tar_path, "w:gz") as tar:
|
||||
tar.add(appdir, arcname=fullname)
|
||||
shutil.copy(
|
||||
copy_file(
|
||||
tar_path,
|
||||
Path(pwd) / destination
|
||||
)
|
||||
@@ -58,7 +63,7 @@ def execute(tag, abi, clean, tarball):
|
||||
arch = str(image.arch),
|
||||
destination = destination
|
||||
)
|
||||
shutil.copy(
|
||||
copy_file(
|
||||
Path(tmpdir) / destination,
|
||||
Path(pwd) / destination
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user