From 2a2c246df2b73f759cfa5ae10421c04659fdc806 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Sun, 10 Oct 2021 07:20:17 -0400 Subject: [PATCH] Zipapp docs (#9356) * Revert "README: Don't recommend using as a standalone script" This reverts commit 9763bf65c6285176b578de71b0c3b8c14c72fdf2. zipapps work fine now that we have a single entry point. Time to recommend them again. * update zipapp documentation to recommend the current packaging script Also update the website documentation to mention this at all. --- README.md | 8 ++++++++ docs/markdown/Getting-meson.md | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/README.md b/README.md index c08c6ffb9..aac22b0e4 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,14 @@ python3 -m pip install ninja More on Installing Meson build can be found at the [getting meson page](https://mesonbuild.com/Getting-meson.html). +#### Creating a standalone script + +Meson can be run as a [Python zip +app](https://docs.python.org/3/library/zipapp.html). To generate the +executable run the following command: + + ./packaging/create_zipapp.py --outfile meson.pyz --interpreter '/usr/bin/env python3' + #### Running Meson requires that you have a source directory and a build directory diff --git a/docs/markdown/Getting-meson.md b/docs/markdown/Getting-meson.md index 23f11eeab..ec6f1c660 100644 --- a/docs/markdown/Getting-meson.md +++ b/docs/markdown/Getting-meson.md @@ -21,6 +21,17 @@ we strive to ensure that it will always be working and usable. All commits go through a pull-request process that runs CI and tests several platforms. +### Packing Meson into a zipapp + +After downloading the release, you can create a standalone single-file +executable for Meson by running the script: + +``` +./packaging/create_zipapp.py --outfile meson.pyz --interpreter '/usr/bin/env python3' +``` + +This uses python's native support for [zipapp]. + ## Installing Meson with pip Meson is available in the [Python Package Index] and can be installed @@ -92,6 +103,7 @@ provide Python 3. Use either `mingw32/mingw-w64-i686-python3` or are building for. [GitHub release page]: https://github.com/mesonbuild/meson/releases + [zipapp]: https://docs.python.org/3/library/zipapp.html [Python Package Index]: https://pypi.python.org/pypi/meson/ [Git]: https://github.com/mesonbuild/meson [Python's home page]: https://www.python.org/downloads/