[dpdk-dev] [PATCH v2 2/4] doc: Add Sphinx config to build pdf version of guides

Iremonger, Bernard bernard.iremonger at intel.com
Mon Feb 2 11:19:58 CET 2015



> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of John McNamara
> Sent: Friday, January 30, 2015 6:13 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH v2 2/4] doc: Add Sphinx config to build pdf version of guides
> 
> Add Python Sphinx config to allow conversion of guides to PDF format.
> 
> Signed-off-by: John McNamara <john.mcnamara at intel.com>
> ---
>  doc/guides/conf.py                |   51 ++++++++++++++++++++++++++++++++++---
>  doc/guides/freebsd_gsg/conf.py    |   41 +++++++++++++++++++++++++++++
>  doc/guides/linux_gsg/conf.py      |   41 +++++++++++++++++++++++++++++
>  doc/guides/prog_guide/conf.py     |   41 +++++++++++++++++++++++++++++
>  doc/guides/rel_notes/conf.py      |   41 +++++++++++++++++++++++++++++
>  doc/guides/sample_app_ug/conf.py  |   41 +++++++++++++++++++++++++++++
>  doc/guides/testpmd_app_ug/conf.py |   41 +++++++++++++++++++++++++++++
>  7 files changed, 293 insertions(+), 4 deletions(-)  create mode 100644
> doc/guides/freebsd_gsg/conf.py  create mode 100644 doc/guides/linux_gsg/conf.py  create mode
> 100644 doc/guides/prog_guide/conf.py  create mode 100644 doc/guides/rel_notes/conf.py  create
> mode 100644 doc/guides/sample_app_ug/conf.py  create mode 100644
> doc/guides/testpmd_app_ug/conf.py
> 
> diff --git a/doc/guides/conf.py b/doc/guides/conf.py index 385af03..71253c5 100644
> --- a/doc/guides/conf.py
> +++ b/doc/guides/conf.py
> @@ -28,12 +28,55 @@
>  #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
>  #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> 
> -import subprocess
> +from subprocess import check_output
> +from sphinx.highlighting import PygmentsBridge from
> +pygments.formatters.latex import LatexFormatter
> 
>  project = 'DPDK'
> -
>  copyright = '2014, Intel'

Copyright should be 2015 now.

> +master_doc = 'index'
> 
> -version = subprocess.check_output(["make","-sRrC","../../", "showversion"])
> 
> -master_doc = 'index'
> +# Configuration for latex/pdf files.
> +latex_preamble = r"""
> +\usepackage[utf8]{inputenc}
> +\usepackage{DejaVuSansMono}
> +\usepackage[T1]{fontenc}
> +\usepackage{helvet}
> +\renewcommand{\familydefault}{\sfdefault}
> +
> +\RecustomVerbatimEnvironment{Verbatim}{Verbatim}{xleftmargin=5mm}
> +"""
> +
> +latex_elements = {
> +    'papersize': 'a4paper',
> +    'pointsize': '11pt',
> +    'preamble': latex_preamble}
> +
> +latex_documents = [
> +    ('index',
> +     'dpdk_docs.tex',
> +     '',
> +     '',
> +     'manual')]
> +
> +texinfo_documents = [
> +    ('index',
> +     '',
> +     '',
> +     '',
> +     '',
> +     '',
> +     'Miscellaneous')]
> +
> +
> +# Override the dafault Latex formatter.
> +class CustomLatexFormatter(LatexFormatter):
> +
> +    def __init__(self, **options):
> +
> +        super(CustomLatexFormatter, self).__init__(**options)
> +
> +        self.verboptions = r"formatcom=\footnotesize"
> +
> +PygmentsBridge.latex_formatter = CustomLatexFormatter
> diff --git a/doc/guides/freebsd_gsg/conf.py b/doc/guides/freebsd_gsg/conf.py new file mode 100644
> index 0000000..fd97d69
> --- /dev/null
> +++ b/doc/guides/freebsd_gsg/conf.py
> @@ -0,0 +1,41 @@
> +#   BSD LICENSE
> +#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.

Copyright should be 2010-2015 now.

> +#   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.
> +#   * Neither the name of Intel Corporation nor the names of its
> +#   contributors may be used to endorse or promote products derived
> +#   from this software without specific prior written permission.
> +#
> +#   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
> +#   OWNER 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.
> +
> +execfile('../conf.py')
> +
> +release = check_output(['make', '-sRrC', '../../../', 'showversion'])
> +
> +# Overide the latex_documents to change the output name.
> +latex_documents = [
> +    ('index',
> +     'dpdk_freebsd_getting_started_guide.tex',
> +     '',
> +     '',
> +     'manual')]
> diff --git a/doc/guides/linux_gsg/conf.py b/doc/guides/linux_gsg/conf.py new file mode 100644 index
> 0000000..8086763
> --- /dev/null
> +++ b/doc/guides/linux_gsg/conf.py
> @@ -0,0 +1,41 @@
> +#   BSD LICENSE
> +#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.

Copyright should be 2010-2015 now.

> +#   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.
> +#   * Neither the name of Intel Corporation nor the names of its
> +#   contributors may be used to endorse or promote products derived
> +#   from this software without specific prior written permission.
> +#
> +#   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
> +#   OWNER 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.
> +
> +execfile('../conf.py')
> +
> +release = check_output(['make', '-sRrC', '../../../', 'showversion'])
> +
> +# Overide the latex_documents to change the output name.
> +latex_documents = [
> +    ('index',
> +     'dpdk_linux_getting_started_guide.tex',
> +     '',
> +     '',
> +     'manual')]
> diff --git a/doc/guides/prog_guide/conf.py b/doc/guides/prog_guide/conf.py new file mode 100644
> index 0000000..6a9e74c
> --- /dev/null
> +++ b/doc/guides/prog_guide/conf.py
> @@ -0,0 +1,41 @@
> +#   BSD LICENSE
> +#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.

Copyright should be 2010-2015 now.

> +#   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.
> +#   * Neither the name of Intel Corporation nor the names of its
> +#   contributors may be used to endorse or promote products derived
> +#   from this software without specific prior written permission.
> +#
> +#   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
> +#   OWNER 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.
> +
> +execfile('../conf.py')
> +
> +release = check_output(['make', '-sRrC', '../../../', 'showversion'])
> +
> +# Overide the latex_documents to change the output name.
> +latex_documents = [
> +    ('index',
> +     'dpdk_programmers_guide.tex',
> +     '',
> +     '',
> +     'manual')]
> diff --git a/doc/guides/rel_notes/conf.py b/doc/guides/rel_notes/conf.py new file mode 100644
> index 0000000..9ddf4c2
> --- /dev/null
> +++ b/doc/guides/rel_notes/conf.py
> @@ -0,0 +1,41 @@
> +#   BSD LICENSE
> +#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.

Copyright should be 2010-2015 now.

> +#   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.
> +#   * Neither the name of Intel Corporation nor the names of its
> +#   contributors may be used to endorse or promote products derived
> +#   from this software without specific prior written permission.
> +#
> +#   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
> +#   OWNER 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.
> +
> +execfile('../conf.py')
> +
> +release = check_output(['make', '-sRrC', '../../../', 'showversion'])
> +
> +# Overide the latex_documents to change the output name.
> +latex_documents = [
> +    ('index',
> +     'dpdk_release_notes.tex',
> +     '',
> +     '',
> +     'manual')]
> diff --git a/doc/guides/sample_app_ug/conf.py b/doc/guides/sample_app_ug/conf.py
> new file mode 100644
> index 0000000..def3132
> --- /dev/null
> +++ b/doc/guides/sample_app_ug/conf.py
> @@ -0,0 +1,41 @@
> +#   BSD LICENSE
> +#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
> +#   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.
> +#   * Neither the name of Intel Corporation nor the names of its
> +#   contributors may be used to endorse or promote products derived
> +#   from this software without specific prior written permission.
> +#
> +#   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
> +#   OWNER 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.
> +
> +execfile('../conf.py')
> +
> +release = check_output(['make', '-sRrC', '../../../', 'showversion'])
> +
> +# Overide the latex_documents to change the output name.
> +latex_documents = [
> +    ('index',
> +     'dpdk_sample_applications.tex',
> +     '',
> +     '',
> +     'manual')]
> diff --git a/doc/guides/testpmd_app_ug/conf.py b/doc/guides/testpmd_app_ug/conf.py
> new file mode 100644
> index 0000000..66d5d80
> --- /dev/null
> +++ b/doc/guides/testpmd_app_ug/conf.py
> @@ -0,0 +1,41 @@
> +#   BSD LICENSE
> +#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.

Copyright should be 2010-2015 now.

> +#   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.
> +#   * Neither the name of Intel Corporation nor the names of its
> +#   contributors may be used to endorse or promote products derived
> +#   from this software without specific prior written permission.
> +#
> +#   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
> +#   OWNER 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.
> +
> +execfile('../conf.py')
> +
> +release = check_output(['make', '-sRrC', '../../../', 'showversion'])
> +
> +# Overide the latex_documents to change the output name.
> +latex_documents = [
> +    ('index',
> +     'dpdk_testpmd_guide.tex',
> +     '',
> +     '',
> +     'manual')]
> --
> 1.7.4.1



More information about the dev mailing list