Skip to content
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

Fix python mod autoconf #1606

Merged
merged 8 commits into from
Jul 7, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 12 additions & 24 deletions src/mod/python.mod/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,14 @@ python_avail="false"

if test "x$egg_enable_python" != "xno"; then
if test "x$egg_with_python_config" = "x"; then
AC_PATH_PROGS([python_config_bin], [python3-config python-config python3.12-config python3.11-config python3.10-config python3.9-config python3.8-config])
Copy link
Member

@vanosg vanosg Jul 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a good thought to make future updates easier, but two things I see here- first, I think python3-config is usually a symlink to the current version, so searching for that first should prevent the scrolling of multiple failed searches

checking for python3.12-config... no
checking for python3.11-config... no
checking for python3.10-config... no
checking for python3.9-config... /usr/local/bin/python3.9-config

and also future-proof us for python3.13-config, etc.

And second, I think by adding the extra specific versions it may just keep going down the line until it finds an older version? I think I would be in favor of not making this (and the similar following) change at all.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i was merily suggesting, to stick with upstream, but if you see more value in adopting it more to our liking, i can do those changes.

regarding "I think python3-config is usually a symlink". thats not the case with freebsd, which was the motivation for this PR.

for freebsd it is like:

$ ls -la /usr/local/bin/python*
-r-xr-xr-x  1 root wheel 4680 Apr  9 03:11 /usr/local/bin/python3.9
-r-xr-xr-x  1 root wheel 3153 Apr  9 03:11 /usr/local/bin/python3.9-config

So, shifting python3-config detection to the top would result in:

checking for python3-config... no
checking for python3.12-config... no
checking for python3.11-config... no
checking for python3.10-config... no
checking for python3.9-config... /usr/local/bin/python3.9-config

for the test system, a vanilla FreeBSD 14.1-RELEASE-p2.

would you still like me to change it and shift detection of python3-config to the top of the test queue?

AC_PATH_PROGS([python_config_bin], [python3.12-config python3.11-config python3.10-config python3.9-config python3.8-config python3.7-config python3.6-config python3.5-config python3.4-config python3.3-config python3.2-config python3.1-config python3.0-config python3-config python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python-config])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why add all these versions we aren't compatible with?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idea is, to have a smaller diff to upstream ax autoconf macro, so that futrue updates to upstream are easy.

else
if test -d "$egg_with_python_config"; then
AC_MSG_NOTICE([Checking for python-config binaries in $egg_with_python_config])
AC_PATH_PROGS([python_config_bin], [python3-config python-config], [], [$egg_with_python_config])
AC_PATH_PROGS([python_config_bin], [python3.12-config python3.11-config python3.10-config python3.9-config python3.8-config python3.7-config python3.6-config python3.5-config python3.4-config python3.3-config python3.2-config python3.1-config python3.0-config python3-config python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python-config], [], [$egg_with_python_config])
else
if test -x "$egg_with_python_config"; then
python_config_bin="$egg_with_python_config"
else
AC_MSG_WARN([Specified --with-python-config=$egg_with_python_config does not exist.])
fi
fi
fi
Expand Down Expand Up @@ -66,28 +64,18 @@ version to use, for example '2.3'. This string
will be appended to the Python interpreter
canonical name.])

AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]])
if test -z "$PYTHON"; then
AC_MSG_WARN([Cannot find python$PYTHON_VERSION in your system path])
if ! $ax_python_devel_optional; then
AC_MSG_ERROR([Giving up, python development not available])
fi
ax_python_devel_found=no
PYTHON_VERSION=""
fi
PYTHON_VERSION=`echo $PYTHON_LDFLAGS | sed 's/.*-lpython\(.*[[0-9]]\).*/\1/'`

# Check for python version
python_ver=`$PYTHON -c "import sys; \
print(sys.version.split ()[[0]])"`
AX_COMPARE_VERSION([$python_ver],[ge],[3.8.0], [ax_check_ver="yes"], [ax_check_ver="no"])
AC_MSG_CHECKING([$PYTHON version is >= 3.8.0])
if test "x$ax_check_ver" = x"no"; then
python_avail="false"
AC_MSG_RESULT([no ($python_ver)])
AC_MSG_WARN([Eggdrop requires python version 3.8.0 or higher])
else
AC_MSG_RESULT([yes ($python_ver)])
fi
AX_COMPARE_VERSION([$PYTHON_VERSION],[ge],[3.8.0], [ax_check_ver="yes"], [ax_check_ver="no"])
AC_MSG_CHECKING([python version is >= 3.8.0])
if test "x$ax_check_ver" = x"no"; then
python_avail="false"
AC_MSG_RESULT([no ($PYTHON_VERSION)])
AC_MSG_WARN([Eggdrop requires python version 3.8.0 or higher])
else
AC_MSG_RESULT([yes ($PYTHON_VERSION)])
fi

# Disable the module
if test "x$python_avail" = "xfalse"; then
Expand Down
Loading