sphinxcontrib-svg2pdfconverter-1.0.1/ 0002755 0072674 0072461 00000000000 13536716264 016127 5 ustar 0000000 0000000 sphinxcontrib-svg2pdfconverter-1.0.1/LICENSE.txt 0000644 0072674 0072461 00000002612 13536652420 017742 0 ustar 0000000 0000000 If not otherwise noted, the extensions in this package are licensed
under the following license.
Copyright (c) 2018-2019 by Missing Link Electronics, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
sphinxcontrib-svg2pdfconverter-1.0.1/MANIFEST.in 0000644 0072674 0072461 00000000047 13536701027 017653 0 ustar 0000000 0000000 include README.rst
include LICENSE.txt
sphinxcontrib-svg2pdfconverter-1.0.1/PKG-INFO 0000644 0072674 0072461 00000005352 13536716264 017227 0 ustar 0000000 0000000 Metadata-Version: 2.1
Name: sphinxcontrib-svg2pdfconverter
Version: 1.0.1
Summary: Sphinx SVG to PDF converter extension
Home-page: https://github.com/missinglinkelectronics/sphinxcontrib-svg2pdfconverter
Author: Stefan Wiehler
Author-email: stefan.wiehler@missinglinkelectronics.com
License: BSD
Download-URL: https://pypi.org/project/sphinxcontrib-svg2pdfconverter
Description: *************************************
Sphinx SVG to PDF Converter Extension
*************************************
This extension converts SVG images to PDF in case the builder does not support
SVG images natively (e.g. LaTeX).
Internally, either `Inkscape `_ or ``rsvg-convert`` from
`libRSVG `_ as a more lightweight
alternative is used to convert images.
Installation
============
Just install via ``pip``:
.. code-block:: console
$ pip install sphinxcontrib-svg2pdfconverter
You can choose between Inkscape and libRSVG by either adding
``sphinxcontrib.inkscapeconverter`` or ``sphinxcontrib.rsvgconverter`` to the
``extensions`` list in your ``conf.py``.
Make sure to have either ``inkscape`` or the ``rsvg-convert`` command available
in your systems ``PATH`` and, if necessary, adapt the
``inkscape_converter_bin`` or ``rsvg_converter_bin`` config value respectively.
Configuration
=============
Inkscape
--------
``inkscape_converter_bin``
Path to Inkscape binary. By default, this is ``inkscape``.
``inkscape_converter_args``
Additional command-line arguments for Inkscape, as a list. By
default, this is ``['--export-area-drawing']``.
RSVG
----
``rsvg_converter_bin``
Path to RSVG converter binary. By default, this is ``rsvg-convert``.
``rsvg_converter_args``
Additional command-line arguments for the RSVG converter, as a list. By
default, this is the emtpy list ``[]``.
Platform: any
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Framework :: Sphinx :: Extension
Classifier: Topic :: Documentation
Classifier: Topic :: Utilities
Requires-Python: ~=3.4
Description-Content-Type: text/x-rst
sphinxcontrib-svg2pdfconverter-1.0.1/README.rst 0000644 0072674 0072461 00000002720 13530702722 017601 0 ustar 0000000 0000000 *************************************
Sphinx SVG to PDF Converter Extension
*************************************
This extension converts SVG images to PDF in case the builder does not support
SVG images natively (e.g. LaTeX).
Internally, either `Inkscape `_ or ``rsvg-convert`` from
`libRSVG `_ as a more lightweight
alternative is used to convert images.
Installation
============
Just install via ``pip``:
.. code-block:: console
$ pip install sphinxcontrib-svg2pdfconverter
You can choose between Inkscape and libRSVG by either adding
``sphinxcontrib.inkscapeconverter`` or ``sphinxcontrib.rsvgconverter`` to the
``extensions`` list in your ``conf.py``.
Make sure to have either ``inkscape`` or the ``rsvg-convert`` command available
in your systems ``PATH`` and, if necessary, adapt the
``inkscape_converter_bin`` or ``rsvg_converter_bin`` config value respectively.
Configuration
=============
Inkscape
--------
``inkscape_converter_bin``
Path to Inkscape binary. By default, this is ``inkscape``.
``inkscape_converter_args``
Additional command-line arguments for Inkscape, as a list. By
default, this is ``['--export-area-drawing']``.
RSVG
----
``rsvg_converter_bin``
Path to RSVG converter binary. By default, this is ``rsvg-convert``.
``rsvg_converter_args``
Additional command-line arguments for the RSVG converter, as a list. By
default, this is the emtpy list ``[]``.
sphinxcontrib-svg2pdfconverter-1.0.1/setup.cfg 0000644 0072674 0072461 00000000115 13536716264 017743 0 ustar 0000000 0000000 [metadata]
license_file = LICENSE.txt
[egg_info]
tag_build =
tag_date = 0
sphinxcontrib-svg2pdfconverter-1.0.1/setup.py 0000644 0072674 0072461 00000002654 13536716171 017643 0 ustar 0000000 0000000 # -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
requires = ['Sphinx>=1.6.3']
setup(
name='sphinxcontrib-svg2pdfconverter',
version='1.0.1',
url='https://github.com/missinglinkelectronics/sphinxcontrib-svg2pdfconverter',
download_url='https://pypi.org/project/sphinxcontrib-svg2pdfconverter',
license='BSD',
author='Stefan Wiehler',
author_email='stefan.wiehler@missinglinkelectronics.com',
description='Sphinx SVG to PDF converter extension',
long_description=long_description,
long_description_content_type='text/x-rst',
zip_safe=False,
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Framework :: Sphinx :: Extension',
'Topic :: Documentation',
'Topic :: Utilities',
],
platforms='any',
packages=find_packages(),
include_package_data=True,
install_requires=requires,
python_requires='~=3.4',
namespace_packages=['sphinxcontrib'],
)
sphinxcontrib-svg2pdfconverter-1.0.1/sphinxcontrib/ 0002755 0072674 0072461 00000000000 13536716264 021021 5 ustar 0000000 0000000 sphinxcontrib-svg2pdfconverter-1.0.1/sphinxcontrib/__init__.py 0000644 0072674 0072461 00000000562 13536652420 023124 0 ustar 0000000 0000000 # -*- coding: utf-8 -*-
"""
sphinxcontrib
~~~~~~~~~~~~~
This package is a namespace package that contains all extensions
distributed in the ``sphinx-contrib`` distribution.
:copyright: Copyright 2007-2009 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE.txt for details.
"""
__import__('pkg_resources').declare_namespace(__name__)
sphinxcontrib-svg2pdfconverter-1.0.1/sphinxcontrib/inkscapeconverter.py 0000644 0072674 0072461 00000006364 13536652420 025120 0 ustar 0000000 0000000 # -*- coding: utf-8 -*-
"""
sphinxcontrib.inkscapeconverter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Converts SVG images to PDF using Inkscape in case the builder does not
support SVG images natively (e.g. LaTeX).
:copyright: Copyright 2018-2019 by Stefan Wiehler
.
:license: BSD, see LICENSE.txt for details.
"""
import subprocess
from sphinx.errors import ExtensionError
from sphinx.locale import __
from sphinx.transforms.post_transforms.images import ImageConverter
from sphinx.util import logging
from sphinx.util.osutil import ENOENT, EPIPE, EINVAL
if False:
# For type annotation
from typing import Any, Dict # NOQA
from sphinx.application import Sphinx # NOQA
logger = logging.getLogger(__name__)
class InkscapeConverter(ImageConverter):
conversion_rules = [
('image/svg+xml', 'application/pdf'),
]
def is_available(self):
# type: () -> bool
"""Confirms if Inkscape is available or not."""
try:
args = [self.config.inkscape_converter_bin, '--version']
logger.debug('Invoking %r ...', args)
ret = subprocess.call(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
if ret == 0:
return True
else:
return False
except (OSError, IOError):
logger.warning(__('Inkscape command %r cannot be run. '
'Check the inkscape_converter_bin setting'),
self.config.inkscape_converter_bin)
return False
def convert(self, _from, _to):
# type: (unicode, unicode) -> bool
"""Converts the image from SVG to PDF via Inkscape."""
try:
args = ([self.config.inkscape_converter_bin] +
self.config.inkscape_converter_args +
['--export-pdf=' + _to, _from])
logger.debug('Invoking %r ...', args)
p = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
except OSError as err:
if err.errno != ENOENT: # No such file or directory
raise
logger.warning(__('Inkscape command %r cannot be run. '
'Check the inkscape_converter_bin setting'),
self.config.inkscape_converter_bin)
return False
try:
stdout, stderr = p.communicate()
except (OSError, IOError) as err:
if err.errno not in (EPIPE, EINVAL):
raise
stdout, stderr = p.stdout.read(), p.stderr.read()
p.wait()
if p.returncode != 0:
raise ExtensionError(__('Inkscape exited with error:\n'
'[stderr]\n%s\n[stdout]\n%s') %
(stderr, stdout))
return True
def setup(app):
# type: (Sphinx) -> Dict[unicode, Any]
app.add_post_transform(InkscapeConverter)
app.add_config_value('inkscape_converter_bin', 'inkscape', 'env')
app.add_config_value('inkscape_converter_args',
['--export-area-drawing'], 'env')
return {
'version': 'builtin',
'parallel_read_safe': True,
'parallel_write_safe': True,
}
sphinxcontrib-svg2pdfconverter-1.0.1/sphinxcontrib/rsvgconverter.py 0000644 0072674 0072461 00000006303 13536652420 024275 0 ustar 0000000 0000000 # -*- coding: utf-8 -*-
"""
sphinxcontrib.rsvgconverter
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Converts SVG images to PDF using libRSVG in case the builder does not
support SVG images natively (e.g. LaTeX).
:copyright: Copyright 2018-2019 by Stefan Wiehler
.
:license: BSD, see LICENSE.txt for details.
"""
import subprocess
from sphinx.errors import ExtensionError
from sphinx.locale import __
from sphinx.transforms.post_transforms.images import ImageConverter
from sphinx.util import logging
from sphinx.util.osutil import ENOENT, EPIPE, EINVAL
if False:
# For type annotation
from typing import Any, Dict # NOQA
from sphinx.application import Sphinx # NOQA
logger = logging.getLogger(__name__)
class RSVGConverter(ImageConverter):
conversion_rules = [
('image/svg+xml', 'application/pdf'),
]
def is_available(self):
# type: () -> bool
"""Confirms if RSVG converter is available or not."""
try:
args = [self.config.rsvg_converter_bin, '--version']
logger.debug('Invoking %r ...', args)
ret = subprocess.call(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
if ret == 0:
return True
else:
return False
except (OSError, IOError):
logger.warning(__('RSVG converter command %r cannot be run. '
'Check the rsvg_converter_bin setting'),
self.config.rsvg_converter_bin)
return False
def convert(self, _from, _to):
# type: (unicode, unicode) -> bool
"""Converts the image from SVG to PDF via libRSVG."""
try:
args = ([self.config.rsvg_converter_bin] +
self.config.rsvg_converter_args +
['--format=pdf', '--output=' + _to, _from])
logger.debug('Invoking %r ...', args)
p = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
except OSError as err:
if err.errno != ENOENT: # No such file or directory
raise
logger.warning(__('RSVG converter command %r cannot be run. '
'Check the rsvg_converter_bin setting'),
self.config.rsvg_converter_bin)
return False
try:
stdout, stderr = p.communicate()
except (OSError, IOError) as err:
if err.errno not in (EPIPE, EINVAL):
raise
stdout, stderr = p.stdout.read(), p.stderr.read()
p.wait()
if p.returncode != 0:
raise ExtensionError(__('RSVG converter exited with error:\n'
'[stderr]\n%s\n[stdout]\n%s') %
(stderr, stdout))
return True
def setup(app):
# type: (Sphinx) -> Dict[unicode, Any]
app.add_post_transform(RSVGConverter)
app.add_config_value('rsvg_converter_bin', 'rsvg-convert', 'env')
app.add_config_value('rsvg_converter_args', [], 'env')
return {
'version': 'builtin',
'parallel_read_safe': True,
'parallel_write_safe': True,
}
sphinxcontrib-svg2pdfconverter-1.0.1/sphinxcontrib_svg2pdfconverter.egg-info/ 0002755 0072674 0072461 00000000000 13536716264 026076 5 ustar 0000000 0000000 sphinxcontrib-svg2pdfconverter-1.0.1/sphinxcontrib_svg2pdfconverter.egg-info/PKG-INFO 0000644 0072674 0072461 00000005352 13536716263 027175 0 ustar 0000000 0000000 Metadata-Version: 2.1
Name: sphinxcontrib-svg2pdfconverter
Version: 1.0.1
Summary: Sphinx SVG to PDF converter extension
Home-page: https://github.com/missinglinkelectronics/sphinxcontrib-svg2pdfconverter
Author: Stefan Wiehler
Author-email: stefan.wiehler@missinglinkelectronics.com
License: BSD
Download-URL: https://pypi.org/project/sphinxcontrib-svg2pdfconverter
Description: *************************************
Sphinx SVG to PDF Converter Extension
*************************************
This extension converts SVG images to PDF in case the builder does not support
SVG images natively (e.g. LaTeX).
Internally, either `Inkscape `_ or ``rsvg-convert`` from
`libRSVG `_ as a more lightweight
alternative is used to convert images.
Installation
============
Just install via ``pip``:
.. code-block:: console
$ pip install sphinxcontrib-svg2pdfconverter
You can choose between Inkscape and libRSVG by either adding
``sphinxcontrib.inkscapeconverter`` or ``sphinxcontrib.rsvgconverter`` to the
``extensions`` list in your ``conf.py``.
Make sure to have either ``inkscape`` or the ``rsvg-convert`` command available
in your systems ``PATH`` and, if necessary, adapt the
``inkscape_converter_bin`` or ``rsvg_converter_bin`` config value respectively.
Configuration
=============
Inkscape
--------
``inkscape_converter_bin``
Path to Inkscape binary. By default, this is ``inkscape``.
``inkscape_converter_args``
Additional command-line arguments for Inkscape, as a list. By
default, this is ``['--export-area-drawing']``.
RSVG
----
``rsvg_converter_bin``
Path to RSVG converter binary. By default, this is ``rsvg-convert``.
``rsvg_converter_args``
Additional command-line arguments for the RSVG converter, as a list. By
default, this is the emtpy list ``[]``.
Platform: any
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Framework :: Sphinx :: Extension
Classifier: Topic :: Documentation
Classifier: Topic :: Utilities
Requires-Python: ~=3.4
Description-Content-Type: text/x-rst
sphinxcontrib-svg2pdfconverter-1.0.1/sphinxcontrib_svg2pdfconverter.egg-info/SOURCES.txt 0000644 0072674 0072461 00000001022 13536716264 027753 0 ustar 0000000 0000000 LICENSE.txt
MANIFEST.in
README.rst
setup.cfg
setup.py
sphinxcontrib/__init__.py
sphinxcontrib/inkscapeconverter.py
sphinxcontrib/rsvgconverter.py
sphinxcontrib_svg2pdfconverter.egg-info/PKG-INFO
sphinxcontrib_svg2pdfconverter.egg-info/SOURCES.txt
sphinxcontrib_svg2pdfconverter.egg-info/dependency_links.txt
sphinxcontrib_svg2pdfconverter.egg-info/namespace_packages.txt
sphinxcontrib_svg2pdfconverter.egg-info/not-zip-safe
sphinxcontrib_svg2pdfconverter.egg-info/requires.txt
sphinxcontrib_svg2pdfconverter.egg-info/top_level.txt sphinxcontrib-svg2pdfconverter-1.0.1/sphinxcontrib_svg2pdfconverter.egg-info/dependency_links.txt 0000644 0072674 0072461 00000000001 13536716263 032141 0 ustar 0000000 0000000
sphinxcontrib-svg2pdfconverter-1.0.1/sphinxcontrib_svg2pdfconverter.egg-info/namespace_packages.txt 0000644 0072674 0072461 00000000016 13536716263 032423 0 ustar 0000000 0000000 sphinxcontrib
sphinxcontrib-svg2pdfconverter-1.0.1/sphinxcontrib_svg2pdfconverter.egg-info/not-zip-safe 0000644 0072674 0072461 00000000001 13530702724 030310 0 ustar 0000000 0000000
sphinxcontrib-svg2pdfconverter-1.0.1/sphinxcontrib_svg2pdfconverter.egg-info/requires.txt 0000644 0072674 0072461 00000000016 13536716263 030470 0 ustar 0000000 0000000 Sphinx>=1.6.3
sphinxcontrib-svg2pdfconverter-1.0.1/sphinxcontrib_svg2pdfconverter.egg-info/top_level.txt 0000644 0072674 0072461 00000000016 13536716263 030622 0 ustar 0000000 0000000 sphinxcontrib