Skip to content

Commit 8e605fe

Browse files
Add a release command to WASI CLI (#160790)
Co-authored-by: Savannah Ostrowski <savannah@python.org>
1 parent d854380 commit 8e605fe

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

‎Platforms/WASI/README.md‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ python3 Platforms/WASI build --quiet --logdir cross-build/logs
132132
```
133133

134134

135-
### Packaging
135+
### Releasing
136136

137137
The `package` command is used to gather all the files necessary to make a
138138
release and place them in an archive:
@@ -158,6 +158,16 @@ existing `dist/` directory before gathering files.
158158

159159
There is no command just to archive the gathered files.
160160

161+
To do a release build from `build` to `package`, you can use the `release`
162+
command:
163+
164+
```shell
165+
python3 Platforms/WASI release
166+
```
167+
168+
Any release-specific build flags will be set via `release`. It will also run
169+
`clean`.
170+
161171

162172
### Paths
163173

‎Platforms/WASI/__main__.py‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ def main():
7171
gather = subcommands.add_parser(
7272
"gather", help="Gather all the files for distribution"
7373
)
74+
release = subcommands.add_parser(
75+
"release", help="Build and package for a release"
76+
)
7477
path = subcommands.add_parser(
7578
"path", help="Print the path to a build or distribution directory"
7679
)
@@ -94,6 +97,7 @@ def main():
9497
make_host,
9598
pythoninfo_host,
9699
build_host,
100+
release,
97101
):
98102
subcommand.add_argument(
99103
"--quiet",
@@ -133,7 +137,7 @@ def main():
133137
subcommand.add_argument(
134138
"args", nargs="*", help="Extra arguments to pass to `configure`"
135139
)
136-
for subcommand in build, configure_host, build_host:
140+
for subcommand in build, configure_host, build_host, release:
137141
subcommand.add_argument(
138142
"--wasi-sdk",
139143
type=pathlib.Path,
@@ -160,6 +164,7 @@ def main():
160164
gather,
161165
package,
162166
path,
167+
release,
163168
):
164169
subcommand.add_argument(
165170
"--host-triple",
@@ -211,6 +216,15 @@ def main():
211216
case "package":
212217
_package.gather(context)
213218
_package.archive(context)
219+
case "release":
220+
context.args = ["--without-static-libpython"]
221+
_build.clean_contents(context)
222+
_build.configure_build_python(context)
223+
_build.make_build_python(context)
224+
_build.configure_wasi_python(context)
225+
_build.make_wasi_python(context)
226+
_package.gather(context)
227+
_package.archive(context)
214228
case "path":
215229
paths = {
216230
"build-python": "build_python_path",

0 commit comments

Comments
 (0)