Skip to content

Rewriting POSIX prefixes in JSON files on Windows? #1788

@bollwyvl

Description

@bollwyvl

As always, thanks for rattler-build!

I'm trying to update ipykernel-feedstock to use rattler-build.

On Windows, I'm seeing a bad path coming from a build-time JSON file, deployed into $PREFIX/share, which also references $PREFIX, but fully resolved. To be encoded in JSON, the windows-style slashes get escaped.

Our old technique of replacing the peril-fraught \ (or, worse, \\) with / to avoid JSON issues is not working.

Without digging into the code, this looks like perhaps either or both of:

  • the POSIX-style $PREFIX (with /) is not sought
  • the Redmond-style %PREFIX% (with \\) is not sought

Relevant log

 │ │ Rewriting kernelspec at:
 │ │ 	%PREFIX%\share\jupyter\kernels\python3\kernel.json
 │ │ {
 │ │  "argv": [
 │ │   "D:\\bld\\bld\\rattler-build_ipykernel_1753108933\\h_env\\python.exe",
 │ │   "-m",
 │ │   "ipykernel_launcher",
 │ │   "-f",
 │ │   "{connection_file}"
 │ │  ],
 │ │  "display_name": "Python 3 (ipykernel)",
 │ │  "language": "python",
 │ │  "metadata": {
 │ │   "debugger": true
 │ │  }
 │ │ }
 │ │ Kernel python was:
 │ │ 	%PREFIX%\python.exe
 │ │ ... rewriting kernel python with:
 │ │ 	%PREFIX%/python.exe
 │ │ {
 │ │   "argv": [
 │ │     "%PREFIX%/python.exe",
 │ │     "-m",
 │ │     "ipykernel_launcher",
 │ │     "-f",
 │ │     "{connection_file}"
 │ │   ],
 │ │   "display_name": "Python 3 (ipykernel)",
 │ │   "language": "python",
 │ │   "metadata": {
 │ │     "debugger": true
 │ │   }
 │ │ }

# later...

 │ Checking Kernelspec at:     %PREFIX%\share\jupyter\kernels\python3\kernel.json...
 │ {
 │   "argv": [
 │     "D:/bld/bld/rattler-build_ipykernel_1753108933/h_env/python.exe",
 │     "-m",
 │     "ipykernel_launcher",
 │     "-f",
 │     "{connection_file}"
 │   ],
 │   "display_name": "Python 3 (ipykernel)",
 │   "language": "python",
 │   "metadata": {
 │     "debugger": true
 │   }
 │ }

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions