bug-automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#17811: RFE: build against multiple python stacks


From: Pavel Raiskup
Subject: bug#17811: RFE: build against multiple python stacks
Date: Thu, 19 Jun 2014 14:37:52 +0200
User-agent: KMail/4.12.5 (Linux/3.14.5-200.fc20.x86_64; KDE/4.12.5; x86_64; ; )

Hello,

I have been playing a little with Python dual-stack build (as a PoC for
long-term filed issue against RH Bugzilla [1]).

Non-tl;dr version of task regarding this RFE:

  There is need to build python plugins against both python2 & python3
  with autotools easily.

Current status:

  Automake supports python_PYTHON/pkgpython_PYTHON variable definition
  which uses variables PYTHON/pythondir/pkgpythondir, etc.  It caches the
  results among multiple AM_PYTHON_PATH calls, etc.  Works as expected in
  usual cases.

  To workaround problems with ${task}, e.g. abrt package handles this its
  own way, see [2].

Proposed solution:

  Make the _PYTHON primary support namespaces.  PoC patch attached.  This
  allows us to work with python like:

  configure.ac:
    AM_PATH_PYTHON([2.7])
    AM_PATH_PYTHON([3.3],,,3)

  Makefile.am:
    both_versions = main.py
    python_PYTHON = $(both_versions)
    python3_PYTHON = $(both_versions) python3_stuff.py

  ./configure | grep PYTHON
    PYTHON      the Python interpreter
    PYTHON3     the Python3 interpreter

  The fourth parameter of AM_PATH_PYTHON is not arbitrarily limited to
  numbers or something like that (so we may use more than two python
  stacks).  The result of this macro is:

  $ cat src/Makefile | grep -i ^python
  PYTHON = /usr/bin/python
  PYTHON3 = /usr/bin/python3
  PYTHON3_EXEC_PREFIX = ${exec_prefix}
  PYTHON3_PLATFORM = linux
  PYTHON3_PREFIX = ${prefix}
  ...
  python_PYTHON = main.py
  python3_PYTHON = main2.py

What do you think about that?  Could this be way to go?  AM_PATH_PYTHON
would stay backward compatible, current testsuite is OK (log attached).

If that was OK, I would prepare more clean patch (not so much $4s in
python.m4 probably) with testsuite & documenation fixes.

[1] https://bugzilla.redhat.com/533920
[2] https://github.com/abrt/abrt/blob/master/configure.ac#L59

Pavel

Attachment: multi-python.patch
Description: Text Data

Attachment: test-suite.log.xz
Description: application/xz


reply via email to

[Prev in Thread] Current Thread [Next in Thread]