-
Notifications
You must be signed in to change notification settings - Fork 56
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
feat: auto cmake version #804
Conversation
5ac758c
to
e47052f
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #804 +/- ##
==========================================
+ Coverage 82.90% 82.98% +0.08%
==========================================
Files 69 73 +4
Lines 3926 4074 +148
==========================================
+ Hits 3255 3381 +126
- Misses 671 693 +22 ☔ View full report in Codecov by Sentry. |
I think I'll try this as default for 0.10+. I think the only way to break the parsing is to have something like something([=[
cmake_minimum_required(VERSION 3.99)
]=]
)
cmake_minimum_required(VERSION 3.15) Which is really weird, and would have to be above the first min required one to break it anyway. I'd have to write a tokenizer to fix this. But if someone does have something really weird, they can just set |
Wait, what about comments and comment blocks? E.g. in a #[=[ TODO:
Support newer version of CMake, blocked by ...
cmake_minimum_required(VERSION 3.99)
]=]
cmake_minimum_required(VERSION 3.15) |
That should be handled, |
Ahh, forgot about block comments. That would confuse it, yes. |
And if statements could confuse it, including |
833a61d
to
c146250
Compare
I've added a simple streaming tokenizer and AST for CMake, this allows block comments as well as blocks (like if, foreach, macro) to be ignored. The first top-level statement is taken if found. |
73313dd
to
204a646
Compare
Oh, Fedora CI caught this that needs to be migrated
Incidentally, probably this section needs a scikit-build-core/docs/examples/test.sh Line 19 in 9d49270
Was wondering why the nox tests were not picking it up, don't they lack Line 197 in 9d49270
|
"BRACKET_QUOTE": r"\[(?P<bq1>=*)\[(?s:.)*?\](?P=bq1)\]", | ||
"OPEN_PAREN": r"\(", | ||
"CLOSE_PAREN": r"\)", | ||
"LEGACY": r'\b\w+=[^\s"()$\\]*(?:"[^"\\]*"[^\s"()$\\]*)*|"(?:[^"\\]*(?:\\.[^"\\]*)*)*"', |
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.
Didn't know about this legacy part. Couldn't find the documentation of it and its depreciation/removal. Is it compatible with the minimum CMake that scikit-build-core requires?
Just for navigability, can the bracket section (and maybe other parts) be extracted out of the dict and introduced in as raw f-strings?
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.
https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#unquoted-argument
I think it's in the "not really recommended for new code" stage.
I've downloaded every CMakeLists.txt from PyPI, so I have 35,000 test cases. I haven't quite finished, but it's passing about 10,000 before it hits its first failure currently. I sometimes have to skip a file because it's not valid. (One literally was a C++ file named CMakeLists.txt, for example).
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.
Found one more small issue, now passes 32,000+ files (parsing the whole thing without crashing). Had to skip 20 files, mostly templates, or other clearly broken files. https://github.com/henryiii/pystats/blob/main/cmakelists-proc.py
Note that this a streaming tokenizer and AST generator, so if cmake_minimum_required
is found, the rest of the file is not processed.
9bf8240
to
8a1aced
Compare
Those don't have warnings as errors, and also yes, I think it just grabs a pre-built version. I'm trying to fix that in #810. |
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
26faa75
to
43d135e
Compare
Close #777.
This is on by default for 0.10+. Setting "CMakeLists.txt" explicitly though will force it to be found, while the default will fallback on 3.15+.