summaryrefslogtreecommitdiff
path: root/packaging/create_zipapp.py
diff options
context:
space:
mode:
authorjoshcangit <33022160+joshcangit@users.noreply.github.com>2022-05-10 17:17:35 +0800
committerEli Schwartz <eschwartz93@gmail.com>2022-05-16 12:17:24 -0400
commit3e26c0f1cae09a44f53250a5d66ae2b723cfaa93 (patch)
treecc4142950a8767d37efdc436cf4c66c3c4720006 /packaging/create_zipapp.py
parentb1abda2b4b9ea85551abe073b55092848285ccca (diff)
downloadmeson-3e26c0f1cae09a44f53250a5d66ae2b723cfaa93.tar.gz
Add optional compress
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
Diffstat (limited to 'packaging/create_zipapp.py')
-rwxr-xr-xpackaging/create_zipapp.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/packaging/create_zipapp.py b/packaging/create_zipapp.py
index 4e018bf51..9fd0f5b4e 100755
--- a/packaging/create_zipapp.py
+++ b/packaging/create_zipapp.py
@@ -11,6 +11,7 @@ parser = argparse.ArgumentParser()
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:])
@@ -19,4 +20,4 @@ source = Path(options.source).resolve()
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)