pombreda / rst2pdf

Automatically exported from code.google.com/p/rst2pdf
Other
0 stars 0 forks source link

pdfbuilder doesn't work withon jython #458

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Run Sphinx (1.1.3) on Jython (2.5.2) with extension rst2pdf.pdfbuilder 
enabled
2. When using builder 'pdf', Sphinx prints this error:

Extension error:
Could not import extension rst2pdf.pdfbuilder (exception: No module named 
parser)

The reason seems to be that pdfbuilder.py tries to import module 'parser' which 
is not defined in Jython. Fwiw, Sphinx itself is aware of the issue and does 
this (in highlighting.py):

try:
    import parser
except ImportError:
    # parser is not available on Jython
    parser = None

Please answer the following questions, they are *very* important:

* Version of Jython?

2.5.2

* Version of rst2pdf?

rst2pdf-0.92-py2.5 (pure Python mode)

* Are you using rst2pdf with Sphinx, and if true, what version?

Sphinx-1.1.3-py2.5

Please provide any additional information below.

Original issue reported on code.google.com by to...@clearstorydata.com on 15 Jul 2012 at 5:08

GoogleCodeExporter commented 9 years ago
Interestingly, pdfbuilder.py uses parser for exactly the same reason as Sphinx' 
highlighting.py, so Sphinx' approach would work just fine for pdfbuilder.py:

    if parser is None:
        return True

    try:
        parser.suite(src)
    except SyntaxError, UnicodeEncodeError:
        return False
    else:
        return True

Original comment by to...@clearstorydata.com on 15 Jul 2012 at 5:12

GoogleCodeExporter commented 9 years ago
fixed (hopefully, untested) in r2515

Original comment by roberto.alsina on 15 Jul 2012 at 9:44

GoogleCodeExporter commented 9 years ago

Original comment by roberto.alsina on 6 Aug 2012 at 1:21