Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 311677 - app-office/lyx: Verify and potentially improve Python-related code
Summary: app-office/lyx: Verify and potentially improve Python-related code
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Alexis Ballier
Depends on:
Blocks: 308257
  Show dependency tree
Reported: 2010-03-27 22:23 UTC by Arfrever Frehtes Taifersar Arahesis (RETIRED)
Modified: 2010-08-08 18:07 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---

lyx- (lyx-,4.03 KB, text/plain)
2010-07-02 00:48 UTC, pavel sanda
lyx-1.6.7.ebuild (lyx-1.6.7.ebuild,4.07 KB, text/plain)
2010-07-18 01:23 UTC, pavel sanda
python2.patch (pa.patch,906 bytes, patch)
2010-07-18 01:35 UTC, pavel sanda
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2010-03-27 22:23:23 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

  - 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.
Comment 1 Alexis Ballier gentoo-dev 2010-06-12 16:58:46 UTC
I don't see a bug here but rather a documentation about how to improve python support, as I already told you on IRC months ago. People do not submit bugs for every single package written in C pointing at the K&R for improving their C code, I fail to see why python is so special. Reopen with real and confirmed issues, thanks.
Comment 2 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2010-06-12 20:18:57 UTC
This package fails to build when Python 3.* is set as main active version of Python.
Comment 3 pavel sanda 2010-07-01 23:29:49 UTC
lyx has some scripts intended for python 2 and this version is not going to be changed soon.

i've tried to go through the manual and set PYTHON_DEPEND, then
src_prepare() {
    python_convert_shebangs -r 2 .

pkg_setup() {
    python_set_active_version 2

but it seem not to do anything interesting. convert_shebangs probably expects different header, dunno which one. i currently see two types - either there is no shebang at all, or there is "#! /usr/bin/env python"

what should be done?
Comment 4 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2010-07-01 23:33:49 UTC
(In reply to comment #3)

Maybe modify files in "${D}":

src_install() {
	python_convert_shebangs -r 2 "${D}"
Comment 5 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2010-07-01 23:34:54 UTC
(In reply to comment #3)

You need EAPI >=2 for src_prepare().
Comment 6 pavel sanda 2010-07-02 00:48:20 UTC
(In reply to comment #5)
> You need EAPI >=2 for src_prepare().

yes that helps, thanks. shebangs are converted now.

emerge wont finish now either because of EAPI=2 - access violation in  font_src_install. should this function work Alexis? (attached example ebuild)
Comment 7 pavel sanda 2010-07-02 00:48:54 UTC
Created attachment 237189 [details]
Comment 8 pavel sanda 2010-07-18 01:23:27 UTC
Created attachment 239191 [details]

new ebuild which correctly emerges.

however lyx does not work anymore if i switch to python3 and the reason is the following: it calls some python routines directly via "python -tt" ... in C++ code so no shebangs will help.

i'm not sure what is the solution here. should we patch the sources so "python2 -tt" is always called?
Comment 9 pavel sanda 2010-07-18 01:35:59 UTC
Created attachment 239193 [details, diff]

it would be patch like this one.
Comment 10 Justin Lecher (RETIRED) gentoo-dev 2010-08-08 18:07:11 UTC
*lyx-1.6.7-r1 (08 Aug 2010)

  08 Aug 2010; Justin Lecher <> lyx-1.6.7.ebuild,
  Do not byte-compile scripts, 247683, Fix code for PYTHON ABI, 311677

Thanks for the contribution