Skip to content

Commit

Permalink
Applied review remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
dotzborro committed May 7, 2024
1 parent 77ae6c7 commit a6d0da5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
7 changes: 7 additions & 0 deletions python_appimage/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
__all__ = ['main']


def directory(path):
if not os.path.isdir(path):
raise argparse.ArgumentTypeError("Not a directory: {}".format(path))
return os.path.abspath(path)

def main():
'''Entry point for the CLI
'''
Expand Down Expand Up @@ -73,6 +78,8 @@ def main():
help='force pip in-tree-build',
action='store_true',
default=False)
build_app_parser.add_argument('-x', '--extra-files', type=directory,
help='path to directory containing extra files to be baked in')

list_parser = subparsers.add_parser('list',
description='List Python versions installed in a manylinux image')
Expand Down
12 changes: 5 additions & 7 deletions python_appimage/commands/build/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ def _unpack_args(args):
'''Unpack command line arguments
'''
return args.appdir, args.name, args.python_version, args.linux_tag, \
args.python_tag, args.base_image, args.in_tree_build
args.python_tag, args.base_image, args.in_tree_build, args.extra_files


_tag_pattern = re.compile('python([^-]+)[-]([^.]+)[.]AppImage')
_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):
python_tag=None, base_image=None, in_tree_build=False, extra_files=None):
'''Build a Python application using a base AppImage
'''

Expand Down Expand Up @@ -288,11 +288,9 @@ def execute(appdir, name=None, python_version=None, linux_tag=None,
exclude=(deprecation + git_warnings))

# Bundle auxilliary application files
aux_files_path = glob.glob(appdir + '/files')
if aux_files_path:
aux_files_path = aux_files_path[0]
log('BUNDLE', os.path.basename(aux_files_path))
copy_tree(aux_files_path, 'AppDir/')
if extra_files is not None:
log('BUNDLE', os.path.basename(extra_files))
copy_tree(extra_files, 'AppDir/')

# Bundle the entry point
entrypoint_path = glob.glob(appdir + '/entrypoint.*')
Expand Down

0 comments on commit a6d0da5

Please sign in to comment.