Repository navigation
Step 1 of creating multi-python bindings. - #2576
Conversation
* Adds the cmake machinery to configure the build to produce native modules for all specified python versions (should also work for python cross compile). * The default is as it has been (to use the identified default python config). * I had hoped to make a common library for this that I could share with LLVM, but IREE's use of CMake is too quirky and it would be easier to just adapt vs share. * This marks the end of the road for bazel_to_cmake support for python. I see no maintainable way to have a single sot that spans cmake, bazel and Google's bazel: they are all just too weird when it comes to shenanigans needed to built python extensions effectively. * I'm going to transition all of the python packages to more of a CMake-normal syntax (versus this weird dep naming and other stuff we do to make it look like Bazel): Python will be divergent forever and I don't care if it is a bit different from the rest (and more consistent with upstream, which I am also working on). * Also fixed some default device enumeration issues in tests that were keeping me from making progress (no GPU on this container). * I intend to remove/simplify the current machinery for this stuff but have left it in place for now (to simplify rollbacks and diffs).
| if os.path.isfile(skip_file_path) or not os.path.isfile(build_file_path): | ||
| # No Bazel BUILD file in this directory or explicit skip. |
There was a problem hiding this comment.
This was already merged when I spotted this (sorry for the delay), but we've already got a pattern EDIT_BLOCKING_PATTERN you can put in the CMakeLists.txt file which will make the script fall back to printing what it would edit to stdout. Should we consolidate these two skipping methods? The idea behind falling back to stdout was that for something that wasn't fully automated, you might still want to see what the script would generate. It seems like here you want to always skip entirely.
Some options:
- Drop
EDIT_BLOCKING_PATTERNand just use this - Drop this and just use
EDIT_BLOCKING_PATTERN - (2), but also make
EDIT_BLOCKING_PATTERNnot do the stdout thing. Just skip the file - (2), but also make
EDIT_BLOCKING_PATTERNonly apply in strict mode and otherwise write the file anyway (basicallyEDIT_BLOCKING_PATTERNbecomes a manual way to tell bazel_to_cmake that it can't write this file cleanly. - (2), but add an additional pattern to tell bazel_to_cmake to skip a file and not print to stdout.
Personally, I like option (4) I think it would make the behavior more consistent and still allows someone to see what bazel_to_cmake would do for any given file without spamming the logs by default.
There was a problem hiding this comment.
I don't think I have much of an opinion as long as we have an obvious way to tell it that a directory is opted out (which, if I read properly, can be a comment in the CMakeLists file itself. Can you point exactly at what would need to change (or feel free to edit -- I'm not married to how I did this)?
There was a problem hiding this comment.
You just put some comment in the CMakeLists.txt file like bazel_to_cmake: do not edit
The actual regex is
EDIT_BLOCKING_PATTERN = re.compile(
r"bazel[\s_]*to[\s_]*cmake[\s_]*:?[\s_]*do[\s_]*not[\s_]*edit",
flags=re.IGNORECASE)
Uh oh!
There was an error while loading. Please reload this page.