Skip to content

Commit

Permalink
Add optional compress
Browse files Browse the repository at this point in the history
Compress files under source directory using Deflate method.
By default, files are not compressed in the archive.
Compression is active only when this option is defined.

https://docs.python.org/3/library/zipapp.html?highlight=zipapp#cmdoption-zipapp-c
  • Loading branch information
joshcangit authored and eli-schwartz committed May 16, 2022
1 parent b1abda2 commit 3e26c0f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packaging/create_zipapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
parser.add_argument('source', nargs='?', default='.', help='Source directory')
parser.add_argument('--outfile', default='meson.pyz', help='Output file for the zipapp')
parser.add_argument('--interpreter', default='/usr/bin/env python3', help='The name of the Python interpreter to use')
parser.add_argument('--compress', action='store_true', default=False, help='Compress files')

options = parser.parse_args(sys.argv[1:])

Expand All @@ -19,4 +20,4 @@
with tempfile.TemporaryDirectory() as d:
shutil.copy2(source / 'meson.py', Path(d, '__main__.py'))
shutil.copytree(source / 'mesonbuild', Path(d, 'mesonbuild'))
zipapp.create_archive(d, interpreter=options.interpreter, target=options.outfile)
zipapp.create_archive(d, interpreter=options.interpreter, target=options.outfile, compressed=options.compress)

0 comments on commit 3e26c0f

Please sign in to comment.