Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 278994 - dev-python/reportlab-2.2 and 2.3 ebuilds should build the documentation if doc USE flag is on
Summary: dev-python/reportlab-2.2 and 2.3 ebuilds should build the documentation if do...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal
Assignee: Python Gentoo Team
URL: http://www.reportlab.org/
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-24 23:13 UTC by Denilson Sá Maia
Modified: 2009-09-10 02:56 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Denilson Sá Maia 2009-07-24 23:13:01 UTC
The bug:
* PDF documentation is not build even if doc USE flag is enabled.

How to reproduce:
* Emerge reportlab with doc USE flag enabled, but test disabled.

(bonus bug: the tests fail if reportlab wasn't previously installed)


The reason and the solution:

From README.txt:
  Documentation
  =============
  Naturally, we generate our own manuals using the library.
  In a 'built' distribution, they may already be present in the
  docs/ directory.  If not, execute "python genAll.py" in
  that directory, and it will create the manuals.

Thus, when "doc" USE flag is enabled, the ebuild should run "python genAll.py" to build the PDF documentation. The solution is pretty simple, just add the following src_compile() function to reportlab-2.2.ebuild and reportlab-2.3.ebuild

src_compile() {
    distutils_src_compile

    # One of the tests already builds all documentation, so there is no need to
    # build it twice.
    if use doc && ! use test; then
        cd "${S}"/docs
        PYTHONPATH="${S}/src" ${python} genAll.py
        # But see comment below about PYTHONPATH
    fi
}

I've tested the above modification on my amd64 system. Here are the results:

* With dev-python/reportlab-2.2, it prints "Failed to import renderPM", but appears to generate all documents.
* With dev-python/reportlab-2.3, it fails to generate some documents, with "xml parser error".

This exact same result can be reproduced by running:
  emerge -C reportlab  # <- This is important!
  FEATURES=test emerge -av =dev-python/reportlab-2.3
Although portage won't abort the emerge process, the test does actually fail (take a look at the output). One of the tests tries to build the package's own documentation.

What happens while building the docs is that the scripts can't find one or a few modules, and thus the doc generation fails.

To make the docs build correctly on both 2.2 and 2.3, we could/should change:
        PYTHONPATH="${S}/src" ${python} genAll.py
to
        PYTHONPATH="${S}/build"/lib.* ${python} genAll.py

In other words, all tests (and doc-generation) work fine if PYTHONPATH=/var/tmp/portage/dev-python/reportlab-2.3/work/ReportLab_2_3/build/lib.linux-x86_64-2.5/, which is the exact directory where "setup.py compile" stores the compiled versions of modules and extensions.


I don't know exactly what is the best approach: set PYTHONPATH like I did above (which seems a quick hack), or edit the setup.py to automatically add this to PYTHONPATH (which might require more work).
Comment 1 Denilson Sá Maia 2009-07-24 23:27:31 UTC
Oops... I meant to replace:
        PYTHONPATH="${S}/src" ${python} genAll.py
by this:
        PYTHONPATH=`echo ${S}/build/lib.*` ${python} genAll.py

Hackish, I know, but it works.
Comment 2 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2009-09-10 02:56:21 UTC
Fixed.