Skip to content

Commit 03bab9b

Browse files
committed
Multiple extra data
1 parent a6d0da5 commit 03bab9b

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

python_appimage/__main__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
__all__ = ['main']
88

99

10-
def directory(path):
11-
if not os.path.isdir(path):
12-
raise argparse.ArgumentTypeError("Not a directory: {}".format(path))
10+
def exists(path):
11+
if not os.path.exists(path):
12+
raise argparse.ArgumentTypeError("could not find: {}".format(path))
1313
return os.path.abspath(path)
1414

1515
def main():
@@ -78,8 +78,8 @@ def main():
7878
help='force pip in-tree-build',
7979
action='store_true',
8080
default=False)
81-
build_app_parser.add_argument('-x', '--extra-files', type=directory,
82-
help='path to directory containing extra files to be baked in')
81+
build_app_parser.add_argument('-x', '--extra-data', type=exists,
82+
help='extra application data (bundled under $APPDIR/)', nargs='+')
8383

8484
list_parser = subparsers.add_parser('list',
8585
description='List Python versions installed in a manylinux image')

python_appimage/commands/build/app.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,16 @@ def _unpack_args(args):
2626
'''Unpack command line arguments
2727
'''
2828
return args.appdir, args.name, args.python_version, args.linux_tag, \
29-
args.python_tag, args.base_image, args.in_tree_build, args.extra_files
29+
args.python_tag, args.base_image, args.in_tree_build, \
30+
args.extra_data
3031

3132

3233
_tag_pattern = re.compile('python([^-]+)[-]([^.]+)[.]AppImage')
3334
_linux_pattern = re.compile('manylinux([0-9]+)_' + platform.machine())
3435

3536
def execute(appdir, name=None, python_version=None, linux_tag=None,
36-
python_tag=None, base_image=None, in_tree_build=False, extra_files=None):
37+
python_tag=None, base_image=None, in_tree_build=False,
38+
extra_data=None):
3739
'''Build a Python application using a base AppImage
3840
'''
3941

@@ -287,10 +289,15 @@ def execute(appdir, name=None, python_version=None, linux_tag=None,
287289
'--no-warn-script-location', requirement),
288290
exclude=(deprecation + git_warnings))
289291

290-
# Bundle auxilliary application files
291-
if extra_files is not None:
292-
log('BUNDLE', os.path.basename(extra_files))
293-
copy_tree(extra_files, 'AppDir/')
292+
# Bundle auxilliary application data
293+
if extra_data is not None:
294+
for path in extra_data:
295+
basename = os.path.basename(path)
296+
log('BUNDLE', basename)
297+
if os.path.isdir(path):
298+
copy_tree(path, 'AppDir/' + basename)
299+
else:
300+
copy_file(path, 'AppDir/')
294301

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

0 commit comments

Comments
 (0)