cmake-python-distributions icon indicating copy to clipboard operation
cmake-python-distributions copied to clipboard

fix: work around pip bug

Open henryiii opened this issue 7 months ago • 2 comments

Fix:

  • https://github.com/scikit-build/cmake-python-distributions/issues/586
  • #324.

henryiii avatar Apr 28 '25 23:04 henryiii

Writing a script doesn't work on Windows. You have to create a shim there, pip doesn't seem to do it for you if you give it a Python script. So there are a few options:

  • Use dynamic-metadata to create script entrypoints on Windows, and Unix only gets the fix. Still might be a bit broken on Windows.
  • Write a shim (we have a compiler, after all)
  • Take a stab at moving the executable to the Scripts directory. This is the nicest solution, but I've avoided it since it needs to know where the modules files are. If I can put them into the bin folder in a subfolder, that's likely the most reliable, but I might also be able to refer up a certain number of directories then back down. Or write a shim.

henryiii avatar Apr 29 '25 03:04 henryiii

since popping the PYTHONPATH environment variable seemed to work, I tried to modify the shebang to use -E and in order to simplify the script a bit (not sure it would be safer yet, just trying it out). uv does not respect arguments to the shebang and creates broken scripts (https://github.com/astral-sh/uv/issues/14470).

mayeut avatar Jul 06 '25 10:07 mayeut