Subject: Re: bug#35322: AM_PATH_PYTHON incompatible with Python frameworks on macOS

From: Karl Berry <[email-masked]>
Date: Sun, 14 Feb 2021 15:16:18 -0700

Hi - thanks for this report from almost two years ago (sorry).
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=35322

    On macOS, if CPython is configured with --enable-framework (default
    for MacPorts [1]), Python packages should be installed in ...

Ok.

    Here's a minimal example configure.ac:

Thanks for sending.

    The issue appears to be that AM_PATH_PYTHON overwrites the 'base'
    variable. If we remove this overwrite like [2], pythondir contains
    the correct path.

Unfortunately, simply removing the change to the `base' assignment as
you did in your change, for instance the first hunk,

-    sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'})
+    sitedir = sysconfig.get_path('purelib')

will affect any use of AM_PATH_PYTHON in an (it seems to me)
incompatible way. That does not seem viable. It's not even OS-dependent,
since other Mac users might not use --enable-framework.

Evidently the current default for am_py_prefix is analogous to how
Automake treats "lispdir" and others, to make for a coherent system. So
it's not desirable to change these variables' default values in a
system-dependent way.

I don't know enough about Python to know if there is some clever way to
handle this. In my naive way, it seems like you just have to override
the directory for your case. I think setting the shell variable
$am_cv_python_pythondir before running configure would do this, although
I confess I haven't tried it.

Sorry not to have a helpful reply. If you (or anyone) can think of a
patch that will fix your case while not breaking others, I'd like to see.

Anyway, I'll leave this open, marked as needing help to resolve. --best, karl.

[2] https://github.com/macports/macports-ports/blob/master/devel/automake/files/patch-issue57329.diff