Skip to content

Commit 4de262d

Browse files
authored
Merge branch 'main' into dev-under-wasi
2 parents 11598fa + 8e605fe commit 4de262d

3 files changed

Lines changed: 34 additions & 2 deletions

File tree

‎Lib/test/test_urllib2.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,8 +1453,15 @@ def test_redirect_fragment(self):
14531453
fp = o.open('http://www.example.com')
14541454
self.assertEqual(fp.geturl(), redirected_url.strip())
14551455

1456+
def unset_proxy_env(self):
1457+
# Keep the test independent from proxy-related environment settings.
1458+
env = self.enterContext(os_helper.EnvironmentVarGuard())
1459+
env.unset("http_proxy", "https_proxy", "all_proxy", "no_proxy",
1460+
"HTTP_PROXY", "HTTPS_PROXY", "ALL_PROXY", "NO_PROXY")
1461+
14561462
def test_redirect_no_path(self):
14571463
# Issue 14132: Relative redirect strips original path
1464+
self.unset_proxy_env()
14581465

14591466
# clear _opener global variable
14601467
self.addCleanup(urllib.request.urlcleanup)
@@ -1488,6 +1495,7 @@ def http_open(self, req):
14881495
b'123'
14891496
)
14901497
return result
1498+
self.unset_proxy_env()
14911499
handler = Handler()
14921500
opener = urllib.request.build_opener(handler)
14931501
tests = (

‎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
@@ -73,6 +73,9 @@ def main():
7373
gather = subcommands.add_parser(
7474
"gather", help="Gather all the files for distribution"
7575
)
76+
release = subcommands.add_parser(
77+
"release", help="Build and package for a release"
78+
)
7679
path = subcommands.add_parser(
7780
"path", help="Print the path to a build or distribution directory"
7881
)
@@ -96,6 +99,7 @@ def main():
9699
make_host,
97100
pythoninfo_host,
98101
build_host,
102+
release,
99103
):
100104
subcommand.add_argument(
101105
"--quiet",
@@ -135,7 +139,7 @@ def main():
135139
subcommand.add_argument(
136140
"args", nargs="*", help="Extra arguments to pass to `configure`"
137141
)
138-
for subcommand in build, configure_host, build_host:
142+
for subcommand in build, configure_host, build_host, release:
139143
subcommand.add_argument(
140144
"--wasi-sdk",
141145
type=pathlib.Path,
@@ -162,6 +166,7 @@ def main():
162166
gather,
163167
package,
164168
path,
169+
release,
165170
):
166171
subcommand.add_argument(
167172
"--host-triple",
@@ -213,6 +218,15 @@ def main():
213218
case "package":
214219
_package.gather(context)
215220
_package.archive(context)
221+
case "release":
222+
context.args = ["--without-static-libpython"]
223+
_build.clean_contents(context)
224+
_build.configure_build_python(context)
225+
_build.make_build_python(context)
226+
_build.configure_wasi_python(context)
227+
_build.make_wasi_python(context)
228+
_package.gather(context)
229+
_package.archive(context)
216230
case "path":
217231
paths = {
218232
"build-python": "build_python_path",

0 commit comments

Comments
 (0)