[pytango] 58/98: Remove ipython/itango highlighting for documentation

Sandor Bodo-Merle sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:17:45 UTC 2017


This is an automated email from the git hooks/post-receive script.

sbodomerle-guest pushed a commit to tag v9.2.0
in repository pytango.

commit c8fb00a3f2bc50ed7c3a6522c32a44fae4f9da1c
Author: Vincent Michel <vincent.michel at maxlab.lu.se>
Date:   Wed Jun 29 16:53:44 2016 +0200

    Remove ipython/itango highlighting for documentation
---
 doc/conf.py                                   |   7 +-
 doc/sphinxext/ipython_console_highlighting.py | 125 -------------------------
 doc/sphinxext/tango_console_highlighting.py   | 127 --------------------------
 doc/start.rst                                 |  46 ++++------
 4 files changed, 22 insertions(+), 283 deletions(-)

diff --git a/doc/conf.py b/doc/conf.py
index 0080b18..8bccd14 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -20,7 +20,7 @@ print("Using PyTango from: {0}".format(os.path.dirname(PyTango.__file__)))
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
 # documentation root, use os.path.abspath to make it absolute, like shown here.
-sys.path.append(os.path.abspath('sphinxext'))
+#sys.path.append(os.path.abspath('sphinxext'))
 
 needs_sphinx = "1.0"
 
@@ -32,9 +32,7 @@ extensions = ['sphinx.ext.pngmath',
               'sphinx.ext.autodoc',
               'sphinx.ext.doctest',
               'sphinx.ext.intersphinx',
-              'sphinx.ext.todo',
-              'ipython_console_highlighting',
-              'tango_console_highlighting']
+              'sphinx.ext.todo']
 
 # disable until graphviz works in pyhon 3
 if sys.hexversion < 0x03000000:
@@ -111,7 +109,6 @@ exclude_trees = ['_build']
 
 # The name of the Pygments (syntax highlighting) style to use.
 pygments_style = 'sphinx'
-pygments_style = 'tango_console_highlighting.TangoStyle'
 
 # A list of ignored prefixes for module index sorting.
 #modindex_common_prefix = []
diff --git a/doc/sphinxext/ipython_console_highlighting.py b/doc/sphinxext/ipython_console_highlighting.py
deleted file mode 100644
index 1a9bf2e..0000000
--- a/doc/sphinxext/ipython_console_highlighting.py
+++ /dev/null
@@ -1,125 +0,0 @@
-# ------------------------------------------------------------------------------
-# This file is part of PyTango (http://www.tinyurl.com/PyTango)
-#
-# Copyright 2006-2012 CELLS / ALBA Synchrotron, Bellaterra, Spain
-# Copyright 2013-2014 European Synchrotron Radiation Facility, Grenoble, France
-#
-# Distributed under the terms of the GNU Lesser General Public License,
-# either version 3 of the License, or (at your option) any later version.
-# See LICENSE.txt for more info.
-# ------------------------------------------------------------------------------
-
-"""reST directive for syntax-highlighting ipython interactive sessions.
-
-XXX - See what improvements can be made based on the new (as of Sept 2009)
-'pycon' lexer for the python console.  At the very least it will give better
-highlighted tracebacks.
-"""
-
-#-----------------------------------------------------------------------------
-# Needed modules
-
-# Standard library
-import re
-
-# Third party
-from pygments.lexer import Lexer, do_insertions
-from pygments.lexers.agile import (PythonConsoleLexer, PythonLexer, 
-                                   PythonTracebackLexer)
-from pygments.token import Comment, Generic
-
-from sphinx import highlighting
-
-#-----------------------------------------------------------------------------
-# Global constants
-line_re = re.compile('.*?\n')
-
-#-----------------------------------------------------------------------------
-# Code begins - classes and functions
-
-class IPythonConsoleLexer(Lexer):
-    """
-    For IPython console output or doctests, such as:
-
-    .. sourcecode:: ipython
-
-      In [1]: a = 'foo'
-
-      In [2]: a
-      Out[2]: 'foo'
-
-      In [3]: print a
-      foo
-
-      In [4]: 1 / 0
-
-    Notes:
-
-      - Tracebacks are not currently supported.
-
-      - It assumes the default IPython prompts, not customized ones.
-    """
-    
-    name = 'IPython console session'
-    aliases = ['ipython']
-    mimetypes = ['text/x-ipython-console']
-    input_prompt = re.compile("(In \[(?P<N>[0-9]+)\]: )|(   \.\.\.+:)")
-    output_prompt = re.compile("(Out\[(?P<N>[0-9]+)\]: )|(   \.\.\.+:)")
-    continue_prompt = re.compile("   \.\.\.+:")
-    tb_start = re.compile("\-+")
-
-    def get_tokens_unprocessed(self, text):
-        pylexer = PythonLexer(**self.options)
-        tblexer = PythonTracebackLexer(**self.options)
-
-        curcode = ''
-        insertions = []
-        for match in line_re.finditer(text):
-            line = match.group()
-            input_prompt = self.input_prompt.match(line)
-            continue_prompt = self.continue_prompt.match(line.rstrip())
-            output_prompt = self.output_prompt.match(line)
-            if line.startswith("#"):
-                insertions.append((len(curcode),
-                                   [(0, Comment, line)]))
-            elif input_prompt is not None:
-                insertions.append((len(curcode),
-                                   [(0, Generic.Prompt, input_prompt.group())]))
-                curcode += line[input_prompt.end():]
-            elif continue_prompt is not None:
-                insertions.append((len(curcode),
-                                   [(0, Generic.Prompt, continue_prompt.group())]))
-                curcode += line[continue_prompt.end():]
-            elif output_prompt is not None:
-                # Use the 'error' token for output.  We should probably make
-                # our own token, but error is typicaly in a bright color like
-                # red, so it works fine for our output prompts.
-                insertions.append((len(curcode),
-                                   [(0, Generic.Error, output_prompt.group())]))
-                curcode += line[output_prompt.end():]
-            else:
-                if curcode:
-                    for item in do_insertions(insertions,
-                                              pylexer.get_tokens_unprocessed(curcode)):
-                        yield item
-                        curcode = ''
-                        insertions = []
-                yield match.start(), Generic.Output, line
-        if curcode:
-            for item in do_insertions(insertions,
-                                      pylexer.get_tokens_unprocessed(curcode)):
-                yield item
-
-
-def setup(app):
-    """Setup as a sphinx extension."""
-
-    # This is only a lexer, so adding it below to pygments appears sufficient.
-    # But if somebody knows that the right API usage should be to do that via
-    # sphinx, by all means fix it here.  At least having this setup.py
-    # suppresses the sphinx warning we'd get without it.
-    pass
-
-#-----------------------------------------------------------------------------
-# Register the extension as a valid pygments lexer
-highlighting.lexers['ipython'] = IPythonConsoleLexer()
diff --git a/doc/sphinxext/tango_console_highlighting.py b/doc/sphinxext/tango_console_highlighting.py
deleted file mode 100644
index 1e6bdff..0000000
--- a/doc/sphinxext/tango_console_highlighting.py
+++ /dev/null
@@ -1,127 +0,0 @@
-# ------------------------------------------------------------------------------
-# This file is part of PyTango (http://www.tinyurl.com/PyTango)
-#
-# Copyright 2006-2012 CELLS / ALBA Synchrotron, Bellaterra, Spain
-# Copyright 2013-2014 European Synchrotron Radiation Facility, Grenoble, France
-#
-# Distributed under the terms of the GNU Lesser General Public License,
-# either version 3 of the License, or (at your option) any later version.
-# See LICENSE.txt for more info.
-# ------------------------------------------------------------------------------
-
-"""reST directive for syntax-highlighting itango interactive sessions.
-"""
-
-#-----------------------------------------------------------------------------
-# Needed modules
-
-# Standard library
-import re
-import copy
-
-# Third party
-from pygments.lexer import Lexer, do_insertions
-from pygments.lexers.agile import (PythonConsoleLexer, PythonLexer, 
-                                   PythonTracebackLexer)
-from pygments.token import Comment, Generic
-from pygments.style import Style
-import pygments.styles
-from sphinx import highlighting
-
-#-----------------------------------------------------------------------------
-# Global constants
-line_re = re.compile('.*?\n')
-
-DftStyle = pygments.styles.get_style_by_name("default")
-
-class TangoStyle(DftStyle):
-    
-    styles = copy.copy(DftStyle.styles)
-    styles[Generic.Prompt] = 'bold #00AA00'
-
-class TangoConsoleLexer(Lexer):
-    """
-    For itango console output or doctests, such as:
-
-    .. sourcecode:: itango
-
-      ITango [1]: a = 'foo'
-
-      ITango [2]: a
-                   Result [2]: 'foo'
-
-      ITango [3]: print a
-      foo
-
-      ITango [4]: 1 / 0
-
-    Notes:
-
-      - Tracebacks are not currently supported.
-
-      - It assumes the default itango prompts, not customized ones.
-    """
-    
-    name = 'ITango console session'
-    aliases = ['itango']
-    mimetypes = ['text/x-itango-console']
-    input_prompt = re.compile("(ITango \[(?P<N>[0-9]+)\]: )|(   \.\.\.+:)")
-    output_prompt = re.compile("(\s*Result \[(?P<N>[0-9]+)\]: )|(   \.\.\.+:)")
-    continue_prompt = re.compile("   \.\.\.+:")
-    tb_start = re.compile("\-+")
-
-    def get_tokens_unprocessed(self, text):
-        pylexer = PythonLexer(**self.options)
-        tblexer = PythonTracebackLexer(**self.options)
-
-        curcode = ''
-        insertions = []
-        for match in line_re.finditer(text):
-            line = match.group()
-            input_prompt = self.input_prompt.match(line)
-            continue_prompt = self.continue_prompt.match(line.rstrip())
-            output_prompt = self.output_prompt.match(line)
-            if line.startswith("#"):
-                insertions.append((len(curcode),
-                                   [(0, Comment, line)]))
-            elif input_prompt is not None:
-                insertions.append((len(curcode),
-                                   [(0, Generic.Prompt, input_prompt.group())]))
-                curcode += line[input_prompt.end():]
-            elif continue_prompt is not None:
-                insertions.append((len(curcode),
-                                   [(0, Generic.Prompt, continue_prompt.group())]))
-                curcode += line[continue_prompt.end():]
-            elif output_prompt is not None:
-                # Use the 'error' token for output.  We should probably make
-                # our own token, but error is typicaly in a bright color like
-                # red, so it works fine for our output prompts.
-                insertions.append((len(curcode),
-                                   [(0, Generic.Error, output_prompt.group())]))
-                curcode += line[output_prompt.end():]
-            else:
-                if curcode:
-                    for item in do_insertions(insertions,
-                                              pylexer.get_tokens_unprocessed(curcode)):
-                        yield item
-                        curcode = ''
-                        insertions = []
-                yield match.start(), Generic.Output, line
-        if curcode:
-            for item in do_insertions(insertions,
-                                      pylexer.get_tokens_unprocessed(curcode)):
-                yield item
-
-
-def setup(app):
-    """Setup as a sphinx extension."""
-
-    # This is only a lexer, so adding it below to pygments appears sufficient.
-    # But if somebody knows that the right API usage should be to do that via
-    # sphinx, by all means fix it here.  At least having this setup.py
-    # suppresses the sphinx warning we'd get without it.
-    pass
-
-#-----------------------------------------------------------------------------
-# Register the extension as a valid pygments lexer
-highlighting.lexers['itango'] = TangoConsoleLexer()
diff --git a/doc/start.rst b/doc/start.rst
index 48d6df9..835334c 100644
--- a/doc/start.rst
+++ b/doc/start.rst
@@ -12,7 +12,9 @@ Installing
 Linux
 ~~~~~
 
-PyTango is available on linux as an official debian/ubuntu package::
+PyTango is available on linux as an official debian/ubuntu package:
+
+.. sourcecode:: console
 
     $ sudo apt-get install python-pytango
 
@@ -38,11 +40,15 @@ are available from the major official distribution repositories):
 * `numpy`_ 
 * `IPython`_ (optional, highly recommended)
 
-Then install PyTango either from pip::
+Then install PyTango either from pip:
+
+.. sourcecode:: console
 
     $ pip install PyTango
 
-or easy_install::
+or easy_install:
+
+.. sourcecode:: console
 
     $ easy_install -U PyTango
 
@@ -71,7 +77,9 @@ Besides the binaries for the three dependencies mentioned above, you also need
 the development files for the respective libraries.
 
 You can get the latest ``.tar.gz`` from `PyPI`_ or directly
-the latest SVN checkout::
+the latest SVN checkout:
+
+.. sourcecode:: console
 
     $ svn co http://svn.code.sf.net/p/tango-cs/code/bindings/PyTango/trunk PyTango
     $ cd PyTango
@@ -81,9 +89,11 @@ the latest SVN checkout::
 This will install PyTango in the system python installation directory and, since
 version 8.0.0, it will also install :ref:`itango` as an IPython_ extension.
 
-If whish to install in a different directory, replace the last line with::
+If you whish to install in a different directory, replace the last line with:
+
+.. sourcecode:: console
     
-    $ # private installation to your user (usually ~/.local/lib/python<X>.<Y>/site-packages
+    $ # private installation to your user (usually ~/.local/lib/python<X>.<Y>/site-packages)
     $ python setup.py install --user
 
     $ # or specific installation directory
@@ -100,27 +110,11 @@ source package under :file:`doc/windows_notes.txt`.
 Testing
 -------
 
-If you have IPython_ installed, the best way to test your PyTango installation
-is by starting the new PyTango CLI called :ref:`itango` by typing on the command
-line::
-
-    $ itango
-
-then, in ITango type:
-
-.. sourcecode:: itango
-
-    ITango [1]: PyTango.Release.version
-    Result [1]: '8.0.2'
-
-(if you are wondering, :ref:`itango` automaticaly does ``import PyTango`` 
-for you!)
+To test the installation, import ``PyTango`` and check ``PyTango.Release.version``:
 
-If you don't have IPython_ installed, to test the installation start a
-python console and type:
+.. sourcecode:: console
 
-    >>> import PyTango
-    >>> PyTango.Release.version
-    '8.0.2'
+    $ python -c "import PyTango; print(PyTango.Release.version)"
+    9.2.0
 
 Next steps: Check out the :ref:`pytango-quick-tour`.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pytango.git



More information about the debian-science-commits mailing list