-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[MLIR][Python] fix stubgen for downstream users #157589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-mlir Author: Maksim Levental (makslevental) ChangesFetchContent reports something like Full diff: https://github.com/llvm/llvm-project/pull/157589.diff 1 Files Affected:
diff --git a/mlir/cmake/modules/AddMLIRPython.cmake b/mlir/cmake/modules/AddMLIRPython.cmake
index 85c80276c1bcf..cd9c00df4c82c 100644
--- a/mlir/cmake/modules/AddMLIRPython.cmake
+++ b/mlir/cmake/modules/AddMLIRPython.cmake
@@ -116,10 +116,16 @@ function(generate_type_stubs MODULE_NAME DEPENDS_TARGET MLIR_DEPENDS_TARGET OUTP
""
"OUTPUTS"
${ARGN})
+ # for people doing pip install nanobind
if(EXISTS ${nanobind_DIR}/../src/stubgen.py)
set(NB_STUBGEN "${nanobind_DIR}/../src/stubgen.py")
elseif(EXISTS ${nanobind_DIR}/../stubgen.py)
set(NB_STUBGEN "${nanobind_DIR}/../stubgen.py")
+ # for people using FetchContent or ExternalProject
+ elseif(EXISTS ${nanobind_SOURCE_DIR}/src/stubgen.py)
+ set(NB_STUBGEN "${nanobind_SOURCE_DIR}/src/stubgen.py")
+ elseif(EXISTS ${nanobind_SOURCE_DIR}/stubgen.py)
+ set(NB_STUBGEN "${nanobind_SOURCE_DIR}/stubgen.py")
else()
message(FATAL_ERROR "generate_type_stubs(): could not locate 'stubgen.py'!")
endif()
|
423916e
to
346ef34
Compare
3dfc927
to
8f5523c
Compare
8f5523c
to
308c656
Compare
308c656
to
ae0eaf3
Compare
@joker-eph can you try this patch and see if it fixes this error that you mentioned:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't fully follow the cmake-fu, but I've tried this out and it does indeed fix the issues I hit downstream.
Right now it still fails:
|
ae0eaf3
to
ab5f242
Compare
can you paste your CMake configure |
I'm using the "getting started" basic command somehow:
|
71aa6b7
to
5f4f855
Compare
52a834b
to
86169c9
Compare
b2caa44
to
f147cb9
Compare
bfef1dc
to
6b6d435
Compare
b03c3a7
to
8da6462
Compare
Remove GENERATE from add_python_modules
Remove GENERATE from add_python_modules
Closed in favor of #157853 |
This PR fixes 4 things related to stubgen:
find_package(nanobind)
andFetchContent_Declare(nanobind)
;MLIR_PYTHON_PACKAGE_PREFIX
caused collisions for some users);declare_mlir_python_extension(StandalonePythonSources.NanobindExtension)
;DEPFILE
s for theadd_custom_command
to prevent regenerating each build.