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

Conversation

michaelortmann
Copy link
Member

@michaelortmann michaelortmann commented Jun 8, 2024

Found by: michaelortmann
Patch by: michaelortmann
Fixes: #1605

One-line summary:
Fix python mod autoconf

Additional description (if needed):
Several bugs are fixed by this PR. Now python.mod is also working for FreeBSD.
Please run misc/runautotools after merge

Test cases demonstrating functionality (if applicable):
Before:

$ uname -a
FreeBSD freebsd14 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64
$ 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
$ git rev-parse HEAD
25683aba274a6a9d983302755266ec834cca9430
$ ./configure
[...]
$ make config
[...]
Configuring module 'python'.
configure: loading cache ../../../config.cache
checking for grep that handles long lines and -e... /usr/bin/grep
checking for fgrep... /usr/bin/grep -F
checking for python3-config... no
checking for python-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
checking whether python-config supports --embed... yes
checking for python C flags... -I/usr/local/include/python3.9 -I/usr/local/include/python3.9  -Wno-unused-result -Wsign-compare -Wunreachable-code -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing  -DNDEBUG 
checking for python LD flags...  -L/usr/local/lib -lpython3.9 -lcrypt -lintl -ldl -L/usr/local/lib -lintl -lutil -lm -lm 
checking for python... no
configure: WARNING: Cannot find python in your system path
.././python.mod/configure: -c: not found
checking for gawk... no
checking for mawk... no
checking for nawk... nawk
checking  version is >= 3.8.0... no ()
configure: WARNING: Eggdrop requires python version 3.8.0 or higher

  There was an issue with your python installation.
  Please read python.mod/config.log for more details.
  The python module will be disabled.

After:

[...]
$ make config
[...]
Configuring module 'python'.
configure: loading cache ../../../config.cache
checking for grep that handles long lines and -e... /usr/bin/grep
checking for fgrep... /usr/bin/grep -F
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
checking whether python-config supports --embed... yes
checking for python C flags... -I/usr/local/include/python3.9 -I/usr/local/include/python3.9  -Wno-unused-result -Wsign-compare -Wunreachable-code -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing  -DNDEBUG 
checking for python LD flags...  -L/usr/local/lib -lpython3.9 -lcrypt -lintl -ldl -L/usr/local/lib -lintl -lutil -lm -lm 
checking for gawk... no
checking for mawk... no
checking for nawk... nawk
checking python version is >= 3.8.0... yes (3.9)

@michaelortmann michaelortmann changed the title Enhance python mod autoconf (WIP) Enhance python mod autoconf Jun 8, 2024
@michaelortmann michaelortmann changed the title (WIP) Enhance python mod autoconf (WIP) Fix python mod autoconf Jun 11, 2024
@michaelortmann michaelortmann changed the title (WIP) Fix python mod autoconf Fix python mod autoconf Jun 20, 2024
@@ -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])
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.

@@ -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?

@michaelortmann
Copy link
Member Author

Changed as discussed in IRC (python-config should be first imho, and non-supported versions shouldn't be in there at all)

Ready for review again.

@vanosg vanosg merged commit c329e86 into eggheads:develop Jul 7, 2024
22 of 23 checks passed
@michaelortmann michaelortmann deleted the python.conf branch July 7, 2024 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

configure fails for python under freebsd
3 participants