Skip to content

Commit

Permalink
Merge branch 'tbpassin/inkscape_r2p'
Browse files Browse the repository at this point in the history
Closes #826
  • Loading branch information
akrabat committed Mar 28, 2020
2 parents 0c929ad + c3a7c5c commit 50f2e49
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
11 changes: 6 additions & 5 deletions rst2pdf/createpdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#
#####################################################################################


__docformat__ = 'reStructuredText'
from importlib import import_module
import six
Expand Down Expand Up @@ -1577,11 +1576,13 @@ def __init__(self):
sys.path.insert(0, prefix)
log.info('Importing extension module %s', repr(modname))
firstname = path_given and modname or (modname + '_r2p')
_names = [firstname, modname]
try:
try:
module = import_module(firstname)
except ImportError as e:
module = import_module(modname)
for _name in _names:
try:
module = import_module(_name, 'rst2pdf')
except ImportError:
continue
except ImportError as e:
if str(e).split()[-1].replace("'", '') not in [firstname, modname]:
raise
Expand Down
7 changes: 5 additions & 2 deletions rst2pdf/extensions/inkscape_r2p.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
import sys, os, tempfile, subprocess
from weakref import WeakKeyDictionary
from rst2pdf.log import log

from vectorpdf_r2p import VectorPdf
try:
from vectorpdf_r2p import VectorPdf
except:
from .vectorpdf_r2p import VectorPdf

import rst2pdf.image


Expand Down

0 comments on commit 50f2e49

Please sign in to comment.