-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Make Python detection optional and more portable #8731
Conversation
This should fix #8809. |
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.
Thank you tackling this portability issue. The approach taken is nice, I did run in to a few minor issues which need to be sorted out (see comments). When updating this PR if you can rebase it on master with the proposed tweaks it should pass the CI cleanly.
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.
Thanks for refreshing this. I happened to run in to one other minor issue when testing this locally, see the USING_PYTHON
comment.
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.
This LGTM. I'll leave it to @freqlabs to determine if the test + which thing should be replaced by just which.
@behlendorf If it's alright, I'd like to push a revision inspired by @eli-schwartz's suggestion. |
@freqlabs absolutely, please go ahead update the PR. |
Previously, --without-python would cause ./configure to fail. Now it is able to proceed, and the Python scripts will not be built. Use portable parameter expansion matching instead of nonstandard substring matching to detect the Python version. This test is duplicated in several places, so define a function for it. Don't assume the full path to binaries, since different platforms do install things in different places. Use AC_CHECK_PROGS instead. When building without Python, also build without pyzfs. Sponsored by: iXsystems, Inc. Signed-off-by: Ryan Moeller <ryan@freqlabs.com>
Codecov Report
@@ Coverage Diff @@
## master #8731 +/- ##
==========================================
+ Coverage 78.67% 78.67% +<.01%
==========================================
Files 382 382
Lines 117771 117780 +9
==========================================
+ Hits 92651 92659 +8
- Misses 25120 25121 +1
Continue to review full report at Codecov.
|
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.
This turned out nicely. Unless, anyone has additional changes to suggest this is ready to merge.
AC_MSG_ERROR([Cannot find $PYTHON in your system path]) | ||
AS_IF([test $PYTHON != :], [ | ||
AS_IF([$PYTHON --version >/dev/null 2>&1], | ||
[AM_PATH_PYTHON([2.6], [], [:])], |
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.
This check is actually redundant, since AM_PATH_PYTHON will already try to run $PYTHON -c some-inline-python-script-which-consults-sys.hexversion.
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.
Okay, a bit late, hehe.
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.
Indeed, well to remove the redundancy let's open a new PR.
Previously, --without-python would cause ./configure to fail. Now it is able to proceed, and the Python scripts will not be built. Use portable parameter expansion matching instead of nonstandard substring matching to detect the Python version. This test is duplicated in several places, so define a function for it. Don't assume the full path to binaries, since different platforms do install things in different places. Use AC_CHECK_PROGS instead. When building without Python, also build without pyzfs. Sponsored by: iXsystems, Inc. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Richard Laager <rlaager@wiktel.com> Reviewed-by: Eli Schwartz <eschwartz93@gmail.com> Signed-off-by: Ryan Moeller <ryan@freqlabs.com> Closes #8809 Closes #8731
Summary
When detecting the Python version, don't assume the path to binaries.
Make sure --without-python works.
Motivation and Context
These changes make it easier to build the zfsonlinux code on platforms like FreeBSD, where
true
is/usr/bin/true
andpython3
is/usr/local/bin/python3
or might not exist at all (i.e. in the base system).Description
Previously, --without-python would cause ./configure to fail. Now it is able to proceed, and the Python scripts will not be built.
Use portable regular expression matching instead of nonstandard substring expansion to detect the Python version. This test is duplicated in several places, so define a function for it.
Don't hard-code paths to binaries such as
true
andpython3
.The
cmd/
subdirs have been split up to only build the Python subdirs when configured to use Python. Coincidentally, Linux-specific subdirs are also split out from the same line, reducing the diff from ZoF.How Has This Been Tested?
These changes are based on work in progress in porting zol to FreeBSD. I have built ZFS on FreeBSD with these changes.
Types of changes
Checklist:
Signed-off-by
.