Skip to content

Commit

Permalink
FIX platform.system should be "Emscripten" not "emscripten" (#4812)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoodmane committed Jun 7, 2024
1 parent 23b6813 commit f8f97cc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions docs/project/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ myst:
`InvalidStateError`.
{pr}`4837`

- {{ Fix }} In the Pyodide virtual environment, pip sees `platform.system()` as
"Emscripten" and not as "emscripten".
{pr}`4812`

### Packages

- New Packages: `pytest-asyncio` {pr}`4819`
Expand Down
7 changes: 4 additions & 3 deletions pyodide-build/pyodide_build/out_of_tree/venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def get_pip_monkeypatch(venv_bin: Path) -> str:
print([
os.name,
sys.platform,
platform.system(),
sys.implementation._multiarch,
sysconfig.get_platform()
])
Expand Down Expand Up @@ -129,20 +130,20 @@ def _emscripten_platforms():
yield from tags._generic_platforms()
def platform_tags():
if platform.system() == "emscripten":
if platform.system() == "Emscripten":
yield from _emscripten_platforms()
return
return orig_platform_tags()
tags.platform_tags = platform_tags
"""
f"""
os_name, sys_platform, multiarch, host_platform = {platform_data}
os_name, sys_platform, platform_system, multiarch, host_platform = {platform_data}
os.name = os_name
orig_platform = sys.platform
sys.platform = sys_platform
sys.implementation._multiarch = multiarch
platform.system = lambda: sys_platform
platform.system = lambda: platform_system
platform.machine = lambda: "wasm32"
os.environ["_PYTHON_HOST_PLATFORM"] = host_platform
os.environ["_PYTHON_SYSCONFIGDATA_NAME"] = f'_sysconfigdata_{{sys.abiflags}}_{{sys.platform}}_{{sys.implementation._multiarch}}'
Expand Down

0 comments on commit f8f97cc

Please sign in to comment.