Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 312155

Summary: dev-libs/boost: Verify and potentially improve Python-related code
Product: Gentoo Linux Reporter: Arfrever Frehtes Taifersar Arahesis (RETIRED) <arfrever>
Component: Current packagesAssignee: Tiziano Müller (RETIRED) <dev-zero>
Status: RESOLVED FIXED    
Severity: normal CC: aklhfex, cpp+disabled, hwoarang, pacho, SebastianLuther
Priority: High    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 308257, 382711    

Description Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2010-03-30 17:16:54 UTC
- If this package can be used as a library and installs Python modules
  (*.so or *.py) into site-packages directories, then consider supporting
  installation for multiple Python versions.
  Please read section "Types of packages" in documentation [1] to decide
  if this package can support installation for multiple Python versions.

- Ensure that the ebuilds do not use deprecated functions or variables.

- Please check if Python 3 is supported by this package. You can temporarily
  set Python 3 as main active version of Python to properly test if this
  package supports Python 3.

- If this package does not support Python 3:
  - Specify dependency on Python 2.
    You can use PYTHON_DEPEND helper variable, which should be set before
    inheriting of python eclass.
    Please read section "Specification of dependency on Python" in
    documentation [1].

  - If this package cannot support installation for multiple versions of
    Python, then set active version of Python using
    python_set_active_version().

  - Ensure that shebangs in installed scripts specify correct version of
    Python. If shebangs are too generic (e.g. '#!/usr/bin/python'), then you
    can use python_convert_shebangs() to convert shebangs.
    (Wrapper scripts generated by python_generate_wrapper_scripts() do not
    require any changes.)
    Please read section "Shebangs in installed scripts" in documentation [1].

  - To ensure that changes applied to the ebuilds are sufficient, please
    temporarily set Python 3 as main active version of Python and test if
    this package can be properly installed and if it works at run time.

Please see documentation [1] for more details.
[1] http://www.gentoo.org/proj/en/Python/developersguide.xml
Comment 1 Chris Mayo 2011-02-27 13:06:52 UTC
If boost-1.42.0-r2 is built with USE="python" when the default interpreter is Python3 it breaks modules.

e.g. with dev-python/tagpy-0.94.8:

>>> import tagpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/site-packages/tagpy/__init__.py", line 24, in <module>
    import _tagpy
ImportError: /usr/lib/libboost_python-mt-1_42.so.1.42.0: undefined symbol: PyBytes_Size


adding to boost ebuild:
 PYTHON_DEPEND="python? 2"
and to its pkg_setup():
	if use python ; then
		python_set_active_version 2
	fi

worked around it for me.
Comment 2 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2011-02-27 18:51:18 UTC
I suggest to introduce "python2" and "python3" USE flags.

- "python2" USE flag will be enabled by default in IUSE:
  IUSE="... python +python2 python3 ..."
- "python2" and "python3" USE flags will be mutually exclusive.
- USE="-python python2" or USE="-python python3" will disable support
  for Python in Boost.
- Packages, which only need Boost Python headers, will depend on
  dev-libs/boost[python].
- Packages, which need Boost Python libraries built with support for Python 2,
  will depend on dev-libs/boost[python,python2].
- Packages, which need Boost Python libraries built with support for Python 3,
  will depend on dev-libs/boost[python,python3].
Comment 3 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2011-02-27 19:07:18 UTC
A better, long-term solution would be to convince Boost upstream to include Python version in names of Boost Python libraries
(e.g. libboost_python-${Boost_version}-${Python_version}.so).
Comment 4 Ian Delaney (RETIRED) gentoo-dev 2011-11-18 15:04:34 UTC
See https://bugs.gentoo.org/attachment.cgi?id=292507
Comment 5 Rafał Mużyło 2011-11-28 09:23:48 UTC
(In reply to comment #4)
> See https://bugs.gentoo.org/attachment.cgi?id=292507

Minor thing: is the problem with python3 and mpi still valid in the recent boost versions ?

Cause if it's no longer is, such solution would be kinda broken.
Comment 6 Arfrever Frehtes Taifersar Arahesis 2012-01-19 23:07:35 UTC
Support for installation for multiple Python ABIs has been implemented in dev-libs/boost-1.48.0-r1 in Progress Overlay. I use --python-buildid option already supported by build system of Boost.
Example names of libraries (symlinks without final ".1.48.0"):
libboost_mpi_python-2.7-mt-1_48.so.1.48.0
libboost_mpi_python-3.2-mt-1_48.so.1.48.0
libboost_python-2.7-1_48.so.1.48.0
libboost_python-2.7-mt-1_48.so.1.48.0
libboost_python-3.2-1_48.so.1.48.0
libboost_python-3.2-mt-1_48.so.1.48.0

All Boost Python libraries are now linked against appropriate libpythonX.Y.so libraries.
Comment 7 Markos Chandras (RETIRED) gentoo-dev 2012-01-23 22:32:15 UTC
Fixed in 1.48 thanks to Arfrever
Comment 8 Simone 2012-03-19 15:46:00 UTC
This breaks anything that tries to link to libboost_python.so. A simple way to solve this is to have eselect-python add/update a symlink to the correct version-dependent name.
Comment 9 Markos Chandras (RETIRED) gentoo-dev 2012-03-19 20:58:59 UTC
This breaks nothing. all the reverse dependencies are fixed. If you are using third party ebuilds please refer to the overlay maintainers. However, if you found a package that fails and is in portage tree please open a separate bug.