scikit-build / scikit-build

Improved build system generator for CPython C, C++, Cython and Fortran extensions
https://scikit-build.readthedocs.io
Other
491 stars 122 forks source link

Allow scikit-build's platform detection to be disabled #681

Open kratsg opened 2 years ago

kratsg commented 2 years ago

I have a workflow in which I use scikit-build to drive a CMake-based project, but not build any python-bindings (as in this case, I am shipping a DLL with a pure-python project). It would be great to disable the platform checking in this case. Otherwise, I get an error like this which is somewhat hard to overcome (I am using msys2.)

RuntimeError: Unsupported platform: mingw64_nt-10.0-20348. Please contact the scikit-build team.

daveloyall commented 2 years ago

Hi.

Please note that I don't know anything about scikit-build, python, nor pip.

I'm just trying to run pip install opencv-python so I can perform edge detection on an image, once... :)

I encountered the same error that @kratsg saw. Well, similar:

RuntimeError: Unsupported platform: msys_nt-10.0-19044. Please contact the scikit-build team.

(We're both using msys2, but I'm running in my MSYS shell and they are running in an MING64 shell.)

...Ok, here is the problem: https://github.com/scikit-build/scikit-build/blob/17757ee615824cdfea08481616f2e0bb3e88b124/skbuild/platform_specifics/platform_factory.py

You have an allow list for platforms instead of a ban list.

...there is probably some way to tell pip to install from a local directory. If I do that, then I can try modifying the file linked above so that it works on my system.

I think my system is most similar to "cygwin" and @kratsg's is most similar to "cygwin" or maybe even "windows". 55% sure.. :) (I think mingw64 uses paths like C:/some-file.txt or C:\some-file.txt and msys uses paths like /c/some-file.txt...)

I'll happily perform actions you suggest and report back about the results.

kratsg commented 2 years ago

You can use python -m pip install -e . in a directory to do editable installs and make changes and test things (I assume you're referring to editing scikit-build and trying that out). In my case, I have a much smaller package that I've been trying to get windows support for (for wheels) but with lots of difficulty called pylibmagic. So I'm curious to see how you get along here. I do know that @henryiii (one of the core devs) was planning on refactoring out parts of this into a scikit-build-core and maybe some of what you find here for Windows will aid him in that development too!

daveloyall commented 2 years ago

That sounds like what I need, thanks!! Yes, I think making a local change to scikit-build might be what I need.

Don't get your hopes up about learning much about MS Windows support from me. :) Because, doesn't msys2 hide MS Windows from the user whenever possible?

henryiii commented 2 years ago

If I can setup a CI run, I can make sure scikit-build-core works with it and also (a little slower) add it here too. Any pointers on how I might set that up in ci?

henryiii commented 2 years ago

Here’s what I have for Cygwin: https://github.com/scikit-build/scikit-build-core/blob/5c1c666c78298e93d878f0f213ed6b7d1d9d8c88/.github/workflows/ci.yml#L73

daveloyall commented 2 years ago

I added some command line arguments because I don't know what I'm doing.

python -m pip install --force-reinstall --ignore-installed --no-binary :all: -e .