On 21-08-25 10:00, Karl Berry wrote:
  |     yf> Would keeping PYTHON_PREFIX but changing its default to the
  |     "classical" value be a working solution for this ?
  | 
  | Yes, I think we should. And I think I should have been smart enough to
  | realize that changing the default behavior was too risky in the first
  | place. Apologies for that.
  | 
  | My thought now is to add yet one more option, like
  | --python-prefix-from-python, to get the new 1.16.4 behavior of using the
  | "computed" sys.* values. Else go back to the previous $prefix-based 
behavior.
  | 
  | Does that sound sensible? A better name for the option?
  | 
  | Joshua (or anyone), would you be willing to work on something like by
  | any chance? Would be greatly, greatly, appreciated. I am way
  | overcommitted right now (like all of us, I know ...).
  | 
  |     please keep the --with-python_prefix
  | 
  | Definitely. --thanks, karl.


Currently overriding the python module path to install in the default
python module path in a manner that works for DESTDIR and distcheck
is a bit tricky, especially when using a different prefix.

I think we need an easy way to set a default for this behaviour
from within configure.ac, similar to AC_PREFIX_DEFAULT(), so that
the end-user doesn't have to pass a bunch of options to configure
just to get the build to work sensibly.

The current workaround I use is described below. If there was a
cleaner/more standardized mechanism built into automake / autoconf,
I'd use that.


Change the default prefix in configure.ac:

        AC_PREFIX_DEFAULT([/opt/something])


Set defaults for make variables in configure.ac:

        AC_SUBST([PY_OVERRIDE_BASE],
          [$($PYTHON -c 'from distutils import sysconfig; 
print(sysconfig.PREFIX)')])
        dnl Note: Makefile sets PY_OVERRIDE_PREFIX from $(prefix) or 
$(PY_OVERRIDE_BASE)
        AC_SUBST([PY_OVERRIDE_EXTDIR],
          [$($PYTHON -c 'from distutils import sysconfig; 
print(sysconfig.get_python_lib(plat_specific=1,prefix="${PY_OVERRIDE_PREFIX}"))')])


Use a (non-portable) GNU make snippet in Makefile.am:

        # Install python module to $(prefix) if it's not /opt/something,
        # otherwise the default python prefix in $(PY_OVERRIDE_BASE).
        #
        PY_OVERRIDE_PREFIX := $(patsubst 
/opt/something,$(PY_OVERRIDE_BASE),$(prefix))
        pkgpyexecdir = $(PY_OVERRIDE_EXTDIR)/mymodule


This latter requires in configure.ac:

        AM_INIT_AUTOMAKE([-Wno-portability])



Luke.

Attachment: signature.asc
Description: PGP signature

Reply via email to