Improve CMake FindPython#922
Merged
Merged
Conversation
These versions will be used by CMake 3.11 and older.
CMake 3.12 introduced the FindPython2 and FindPython3 modules which supercede the old and buggy FindPythonLibs and FindPythonInterp modules. It finds consistent versions of the interpreter, development artifacts and NumPy include directories in one go, and does it separately for Python 2 and 3. I've kept the original CMake variable names since I'm not sure where they are used, but some of them may probably be removed or refactored. This has been tested on a Homebrew setup (but not on Linux), where it fixes detection errors using the previous commit. By copying the appropriate modules from CMake, this functionality could also be made to work on the older CMake 3.7 (although this might not be old enough for all installations of casacore).
Use the newer CMakeLists if CMake version >= 3.12. It would have been nice to use the CMAKE_VERSION variable instead, but that only appeared in CMake 2.6.3 (and we have a minimum version of 2.6.0). An alternative solution is to check for the presence of the FindPython2 and FindPython3 modules, using a CheckHasModule function like the one in https://stackoverflow.com/questions/15706318.
Prefer EQUAL/GREATER to STREQUAL/STRGREATER, otherwise Boost 1.100 (Heaven forbid!) would be less than 1.67. Fix whitespace and reduce the line count.
Contributor
Author
|
BTW, the tests passed - the first one timed out after 50 minutes though, hence the red cross... |
Contributor
Author
|
I've rerun the tests on Travis and now they pass (maybe we should increase the timeout to 60 minutes per test?). |
ludwigschwardt
added a commit
to ska-sa/homebrew-tap
that referenced
this pull request
May 28, 2019
The HEAD no longer needs a patch (although it is currently running off a feature branch to be merged as casacore/casacore#922). Now use a single patch that turns v3.1.0 into HEAD (at least as far as the Python build scripts are concerned).
Contributor
Author
|
Can we try this out for 3.1.1 too? It will really help my Homebrew formula along (and maybe even your Travis build). |
gijzelaerr
approved these changes
Jun 5, 2019
Member
|
@tammojan @gervandiepen what do you guys think? Include in 3.1.1? Looks good to me. |
Contributor
|
Looks ok to me
…On Wed, Jun 5, 2019 at 3:01 PM Gijs Molenaar ***@***.***> wrote:
@tammojan <https://github.com/tammojan> @gervandiepen
<https://github.com/gervandiepen> what do you guys think? Include in
3.1.1? Looks good to me.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#922?email_source=notifications&email_token=AB34QPA5YBA3XGUHW4746P3PY62K5A5CNFSM4HPQ5OB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODW7UAOQ#issuecomment-499073082>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AB34QPD4BXXDMMHV4JT4PQDPY62K5ANCNFSM4HPQ5OBQ>
.
|
gijzelaerr
added a commit
that referenced
this pull request
Jun 5, 2019
gijzelaerr
added a commit
that referenced
this pull request
Jun 5, 2019
* prepare for 3.1.1 * feedback * Improve CMake FindPython #922
Contributor
Author
|
I tried to maintain the original script for older CMakes and at least Travis is happy, so this should hopefully be fine 🤞 |
Contributor
|
My build with Python2.7 was happy as well.
…On Wed, Jun 5, 2019 at 3:33 PM Ludwig Schwardt ***@***.***> wrote:
I tried to maintain the original script for older CMakes and at least
Travis is happy, so this should hopefully be fine 🤞
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#922?email_source=notifications&email_token=AB34QPGEZMC6YL5GL72AX7DPY66CPA5CNFSM4HPQ5OB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODW7W25I#issuecomment-499084661>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AB34QPA7BLOLKGXXIKVOWJTPY66CPANCNFSM4HPQ5OBQ>
.
|
ludwigschwardt
added a commit
to ska-sa/homebrew-tap
that referenced
this pull request
Jun 5, 2019
Thanks to casacore/casacore#922 we can also drop all the patches.
ludwigschwardt
added a commit
to ludwigschwardt/casacore-test-tap
that referenced
this pull request
Jun 11, 2024
The HEAD no longer needs a patch (although it is currently running off a feature branch to be merged as casacore/casacore#922). Now use a single patch that turns v3.1.0 into HEAD (at least as far as the Python build scripts are concerned).
ludwigschwardt
added a commit
to ludwigschwardt/casacore-test-tap
that referenced
this pull request
Jun 11, 2024
Thanks to casacore/casacore#922 we can also drop all the patches.
ludwigschwardt
added a commit
to casacore/homebrew-tap
that referenced
this pull request
Jun 11, 2024
The HEAD no longer needs a patch (although it is currently running off a feature branch to be merged as casacore/casacore#922). Now use a single patch that turns v3.1.0 into HEAD (at least as far as the Python build scripts are concerned).
ludwigschwardt
added a commit
to casacore/homebrew-tap
that referenced
this pull request
Jun 11, 2024
Thanks to casacore/casacore#922 we can also drop all the patches.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CMake 3.12 introduced the
FindPython2andFindPython3modules which supercede the old and buggyFindPythonLibsandFindPythonInterpmodules. It finds consistent versions of the interpreter, development artifacts and NumPy include directories in one go, and does it separately forPython 2 and 3.
I've kept the original CMake variable names since I'm not sure where they are used, but some of them may probably be removed or refactored. This has been tested on a Homebrew setup (but not on Linux), where it fixes detection errors using the previous commit.
By copying the appropriate modules from CMake, this functionality could also be made to work on the older CMake 3.7 (although this might not be old enough for all installations of casacore).
I've also kept the original versions of the CMakeLists.txt files and switch to them if CMake is older than 3.12, so this should be backwards compatible (although having four copies of everything is suboptimal...).