diff options
author | Marien Zwart <marienz@gentoo.org> | 2006-02-16 23:05:51 +0000 |
---|---|---|
committer | Marien Zwart <marienz@gentoo.org> | 2006-02-16 23:05:51 +0000 |
commit | 32aa9a1a0fa3e6c3ab97f2fecc977868862005c9 (patch) | |
tree | 29e5b0c370b155143083c4fcd4559c671d2d68a3 /dev-python | |
parent | Remove block of package that is no longer in the tree and is only in one vers... (diff) | |
download | gentoo-2-32aa9a1a0fa3e6c3ab97f2fecc977868862005c9.tar.gz gentoo-2-32aa9a1a0fa3e6c3ab97f2fecc977868862005c9.tar.bz2 gentoo-2-32aa9a1a0fa3e6c3ab97f2fecc977868862005c9.zip |
Remove old versions.
(Portage version: 2660-svn)
Diffstat (limited to 'dev-python')
21 files changed, 13 insertions, 1722 deletions
diff --git a/dev-python/docutils/ChangeLog b/dev-python/docutils/ChangeLog index bb716d212c7f..71aa53402a1c 100644 --- a/dev-python/docutils/ChangeLog +++ b/dev-python/docutils/ChangeLog @@ -1,6 +1,18 @@ # ChangeLog for dev-python/docutils # Copyright 2000-2006 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-python/docutils/ChangeLog,v 1.41 2006/02/14 16:44:36 marienz Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-python/docutils/ChangeLog,v 1.42 2006/02/16 23:05:51 marienz Exp $ + + 16 Feb 2006; Marien Zwart <marienz@gentoo.org> -files/glep-0.3-r1/glep.py, + -files/glep-0.3-r1/glep_htmlwrite.py, + -files/docutils-0.3.3-extramodules.patch, + -files/glep-0.3.3/glep_htmlwrite.py, + -files/docutils-0.3-extramodules.patch, -files/glep-0.3-r1/glepread.py, + -files/glep-0.3.3/glepread.py, -files/glep-0.3-r1/glepstrans.py, + -files/glep-0.3.3/glep.py, -files/glep-0.3.3/glepstrans.py, + -files/glep.py, -files/glep_htmlwrite.py, -files/glepread.py, + -files/glepstrans.py, -docutils-0.3_pre20030530-r3.ebuild, + -docutils-0.3-r1.ebuild, -docutils-0.3.3-r1.ebuild: + Remove old versions. 14 Feb 2006; Marien Zwart <marienz@gentoo.org> docutils-0.4.ebuild: Fix bug breaking src_compile if docutils is not installed already. Thanks to diff --git a/dev-python/docutils/docutils-0.3-r1.ebuild b/dev-python/docutils/docutils-0.3-r1.ebuild deleted file mode 100644 index de74fbb2d8f4..000000000000 --- a/dev-python/docutils/docutils-0.3-r1.ebuild +++ /dev/null @@ -1,69 +0,0 @@ -# Copyright 1999-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-python/docutils/docutils-0.3-r1.ebuild,v 1.10 2005/03/14 19:38:08 pythonhead Exp $ - -inherit distutils eutils - -DESCRIPTION="Set of python tools for processing plaintext docs into HTML, XML, etc." -HOMEPAGE="http://docutils.sourceforge.net/" -SRC_URI="mirror://sourceforge/docutils/${P}.tar.gz" - -LICENSE="public-domain PYTHON BSD" -SLOT="0" -KEYWORDS="x86 ppc" -IUSE="" - -DEPEND="<dev-lang/python-2.4" - -# GLEP version -GLEP_SRC=${FILESDIR}/glep-${PVR} - -src_unpack() { - unpack ${A} - # simplified algorithm to select installing optparse and textwrap - epatch ${FILESDIR}/${P}-extramodules.patch -} - -src_compile() { - distutils_src_compile - - # Generate html docs from reStructured text sources - PYTHONPATH=${S}/build/lib ${python} \ - tools/buildhtml.py --config=tools/docutils.conf -} - - -install_txt_doc() { - local doc=${1} - local dir="txt/$(dirname ${doc})" - docinto ${dir} - dodoc ${doc} -} - -src_install() { - mydoc="MANIFEST.in *.txt" - distutils_src_install - # Tools - cd ${S}/tools - for tool in *.py - do - newbin ${tool} docutils-${tool} - done - # Docs - cd ${S} - dohtml -r docs spec tools - for doc in $(find docs spec tools -name '*.txt') - do - install_txt_doc $doc - done - - # installing Gentoo GLEP tools. Uses versioned GLEP distribution - distutils_python_version - newbin ${GLEP_SRC}/glep.py docutils-glep.py - insinto /usr/lib/python${PYVER}/site-packages/docutils/readers - newins ${GLEP_SRC}/glepread.py glep.py - insinto /usr/lib/python${PYVER}/site-packages/docutils/transforms - newins ${GLEP_SRC}/glepstrans.py gleps.py - insinto /usr/lib/python${PYVER}/site-packages/docutils/writers - newins ${GLEP_SRC}/glep_htmlwrite.py glep_html.py -} diff --git a/dev-python/docutils/docutils-0.3.3-r1.ebuild b/dev-python/docutils/docutils-0.3.3-r1.ebuild deleted file mode 100644 index f4a9a8d3498c..000000000000 --- a/dev-python/docutils/docutils-0.3.3-r1.ebuild +++ /dev/null @@ -1,69 +0,0 @@ -# Copyright 1999-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-python/docutils/docutils-0.3.3-r1.ebuild,v 1.9 2005/04/24 09:15:55 blubb Exp $ - -inherit distutils eutils - -DESCRIPTION="Set of python tools for processing plaintext docs into HTML, XML, etc." -HOMEPAGE="http://docutils.sourceforge.net/" -SRC_URI="mirror://sourceforge/docutils/${P}-alpha.tar.gz" - -LICENSE="public-domain PYTHON BSD" -SLOT="0" -KEYWORDS="x86 ppc ~alpha amd64 ~sparc" -IUSE="" - -DEPEND="<dev-lang/python-2.4" - -# GLEP version -GLEP_SRC=${FILESDIR}/glep-${PV} - -src_unpack() { - unpack ${A} - # simplified algorithm to select installing optparse and textwrap - epatch ${FILESDIR}/${P}-extramodules.patch -} - -src_compile() { - distutils_src_compile - - # Generate html docs from reStructured text sources - PYTHONPATH=${S}/build/lib ${python} \ - tools/buildhtml.py --config=tools/docutils.conf -} - - -install_txt_doc() { - local doc=${1} - local dir="txt/$(dirname ${doc})" - docinto ${dir} - dodoc ${doc} -} - -src_install() { - mydoc="MANIFEST.in *.txt" - distutils_src_install - # Tools - cd ${S}/tools - for tool in *.py - do - newbin ${tool} docutils-${tool} - done - # Docs - cd ${S} - dohtml -r docs spec tools - for doc in $(find docs spec tools -name '*.txt') - do - install_txt_doc $doc - done - - # installing Gentoo GLEP tools. Uses versioned GLEP distribution - distutils_python_version - newbin ${GLEP_SRC}/glep.py docutils-glep.py || die "newbin failed" - insinto /usr/lib/python${PYVER}/site-packages/docutils/readers - newins ${GLEP_SRC}/glepread.py glep.py || die "newins reader failed" - insinto /usr/lib/python${PYVER}/site-packages/docutils/transforms - newins ${GLEP_SRC}/glepstrans.py gleps.py || "newins transform failed" - insinto /usr/lib/python${PYVER}/site-packages/docutils/writers - newins ${GLEP_SRC}/glep_htmlwrite.py glep_html.py || die "newins writer failed" -} diff --git a/dev-python/docutils/docutils-0.3_pre20030530-r3.ebuild b/dev-python/docutils/docutils-0.3_pre20030530-r3.ebuild deleted file mode 100644 index 1ffd651b63fe..000000000000 --- a/dev-python/docutils/docutils-0.3_pre20030530-r3.ebuild +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright 1999-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-python/docutils/docutils-0.3_pre20030530-r3.ebuild,v 1.9 2005/03/14 19:38:08 pythonhead Exp $ - -DESCRIPTION="Set of python tools for processing plaintext docs into HTML, XML, etc." -HOMEPAGE="http://docutils.sourceforge.net/" -SRC_URI="mirror://gentoo/${P}.tgz" - -LICENSE="public-domain PYTHON BSD" -SLOT="0" -KEYWORDS="x86 ~ppc" -IUSE="" - -inherit distutils - -DEPEND="<dev-lang/python-2.4" -S=${WORKDIR}/${PN} - -src_compile() { - distutils_src_compile - - # Generate html docs from reStructured text sources - PYTHONPATH=${S}/build/lib ${python} \ - tools/buildhtml.py --config=tools/docutils.conf -} - - -install_txt_doc() { - local doc=${1} - local dir="txt/$(dirname ${doc})" - docinto ${dir} - dodoc ${doc} -} - -src_install() { - mydoc="MANIFEST.in *.txt" - distutils_src_install - # Tools - cd ${S}/tools - for tool in *.py - do - newbin ${tool} docutils-${tool} - done - # Docs - cd ${S} - dohtml -r docs spec tools - for doc in $(find docs spec tools -name '*.txt') - do - install_txt_doc $doc - done - # Gentoo GLEP tools - newbin ${FILESDIR}/glep.py docutils-glep.py - distutils_python_version - insinto /usr/lib/python${PYVER}/site-packages/docutils/readers - newins ${FILESDIR}/glepread.py glep.py - insinto /usr/lib/python${PYVER}/site-packages/docutils/transforms - newins ${FILESDIR}/glepstrans.py gleps.py - insinto /usr/lib/python${PYVER}/site-packages/docutils/writers - newins ${FILESDIR}/glep_htmlwrite.py glep_html.py -} - diff --git a/dev-python/docutils/files/digest-docutils-0.3-r1 b/dev-python/docutils/files/digest-docutils-0.3-r1 deleted file mode 100644 index bdb677fa30f3..000000000000 --- a/dev-python/docutils/files/digest-docutils-0.3-r1 +++ /dev/null @@ -1 +0,0 @@ -MD5 d8c78dd09610055431ac8df30312bdb9 docutils-0.3.tar.gz 485575 diff --git a/dev-python/docutils/files/digest-docutils-0.3.3-r1 b/dev-python/docutils/files/digest-docutils-0.3.3-r1 deleted file mode 100644 index 6fd639a7f34c..000000000000 --- a/dev-python/docutils/files/digest-docutils-0.3.3-r1 +++ /dev/null @@ -1 +0,0 @@ -MD5 e2ee36b7e878cb53fcee564aaba1f067 docutils-0.3.3-alpha.tar.gz 539340 diff --git a/dev-python/docutils/files/digest-docutils-0.3_pre20030530-r3 b/dev-python/docutils/files/digest-docutils-0.3_pre20030530-r3 deleted file mode 100644 index 82fdd4ba805e..000000000000 --- a/dev-python/docutils/files/digest-docutils-0.3_pre20030530-r3 +++ /dev/null @@ -1 +0,0 @@ -MD5 fe067d12639ff29d2e307d36a52fcfe0 docutils-0.3_pre20030530.tgz 460854 diff --git a/dev-python/docutils/files/docutils-0.3-extramodules.patch b/dev-python/docutils/files/docutils-0.3-extramodules.patch deleted file mode 100644 index a7e34def3165..000000000000 --- a/dev-python/docutils/files/docutils-0.3-extramodules.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- docutils-0.3/setup.py 2003-06-25 02:47:04.000000000 +0100 -+++ docutils-0.3/setup.py.new 2003-07-08 00:21:59.000000000 +0100 -@@ -78,20 +78,15 @@ - List of (module name, minimum __version__ string, [attribute names]).""" - - def get_extras(): -- extras = [] -- for module_name, version, attributes in extra_modules: -- try: -- module = __import__(module_name) -- if version and module.__version__ < version: -- raise ValueError -- for attribute in attributes or []: -- getattr(module, attribute) -- print ('"%s" module already present; ignoring extras/%s.py.' -- % (module_name, module_name)) -- except (ImportError, AttributeError, ValueError): -- extras.append(module_name) -- return extras -- -+ # old method does not work for upgrading/downgrading docutils. -+ # so we use a simple rule, 'optparse' and 'textwrap' are not installed -+ # for >=python-2.3 -+ -+ pyver = sys.version_info -+ if pyver[0] == 2 and pyver[1] > 2: -+ return ["roman"] -+ else: -+ return ["optparse","textwrap","roman"] - - class dual_build_py(build_py): - diff --git a/dev-python/docutils/files/docutils-0.3.3-extramodules.patch b/dev-python/docutils/files/docutils-0.3.3-extramodules.patch deleted file mode 100644 index 49d49df3dc29..000000000000 --- a/dev-python/docutils/files/docutils-0.3.3-extramodules.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- docutils-0.3.3/setup.py 2003-06-25 02:47:04.000000000 +0100 -+++ docutils-0.3.3/setup.py.new 2003-07-08 00:21:59.000000000 +0100 -@@ -78,20 +78,15 @@ - List of (module name, minimum __version__ string, [attribute names]).""" - - def get_extras(): -- extras = [] -- for module_name, version, attributes in extra_modules: -- try: -- module = __import__(module_name) -- if version and module.__version__ < version: -- raise ValueError -- for attribute in attributes or []: -- getattr(module, attribute) -- print ('"%s" module already present; ignoring extras/%s.py.' -- % (module_name, module_name)) -- except (ImportError, AttributeError, ValueError): -- extras.append(module_name) -- return extras -- -+ # old method does not work for upgrading/downgrading docutils. -+ # so we use a simple rule, 'optparse' and 'textwrap' are not installed -+ # for >=python-2.3 -+ -+ pyver = sys.version_info -+ if pyver[0] == 2 and pyver[1] > 2: -+ return ["roman"] -+ else: -+ return ["optparse","textwrap","roman"] - - class dual_build_py(build_py): - diff --git a/dev-python/docutils/files/glep-0.3-r1/glep.py b/dev-python/docutils/files/glep-0.3-r1/glep.py deleted file mode 100644 index f023008f2bf7..000000000000 --- a/dev-python/docutils/files/glep-0.3-r1/glep.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python - -# Author: David Goodger -# Contact: goodger@users.sourceforge.net -# Revision: $Revision: 1.1 $ -# Date: $Date: 2003/07/07 23:39:10 $ -# Copyright: This module has been placed in the public domain. - -""" -A minimal front end to the Docutils Publisher, producing HTML from PEP -(Python Enhancement Proposal) documents. -""" - -import locale -try: - locale.setlocale(locale.LC_ALL, '') -except: - pass - -from docutils.core import publish_cmdline, default_description - - -description = ('Generates (X)HTML from reStructuredText-format PEP files. ' - + default_description) - -publish_cmdline(reader_name='glep', writer_name='glep_html', - description=description) diff --git a/dev-python/docutils/files/glep-0.3-r1/glep_htmlwrite.py b/dev-python/docutils/files/glep-0.3-r1/glep_htmlwrite.py deleted file mode 100644 index 7d4b7f9bdf99..000000000000 --- a/dev-python/docutils/files/glep-0.3-r1/glep_htmlwrite.py +++ /dev/null @@ -1,112 +0,0 @@ -# Author: David Goodger -# Contact: goodger@users.sourceforge.net -# Revision: $Revision: 1.1 $ -# Date: $Date: 2003/07/07 23:39:10 $ -# Copyright: This module has been placed in the public domain. - -""" -PEP HTML Writer. -""" - -__docformat__ = 'reStructuredText' - - -import sys -import docutils -from docutils import nodes, frontend, utils -from docutils.writers import html4css1 - -class Writer(html4css1.Writer): - - settings_spec = html4css1.Writer.settings_spec + ( - 'PEP/HTML-Specific Options', - 'The HTML --footnote-references option is set to "brackets" by ' - 'default.', - (('Specify a PEP stylesheet URL, used verbatim. Default is ' - '--stylesheet\'s value. If given, --pep-stylesheet overrides ' - '--stylesheet.', - ['--pep-stylesheet'], - {'metavar': '<URL>'}), - ('Specify a PEP stylesheet file, relative to the current working ' - 'directory. The path is adjusted relative to the output HTML ' - 'file. Overrides --pep-stylesheet and --stylesheet-path.', - ['--pep-stylesheet-path'], - {'metavar': '<path>'}), - ('Specify a template file. Default is "pep-html-template".', - ['--pep-template'], - {'default': 'pep-html-template', 'metavar': '<file>'}), - ('Python\'s home URL. Default is ".." (parent directory).', - ['--python-home'], - {'default': '..', 'metavar': '<URL>'}), - ('Home URL prefix for PEPs. Default is "." (current directory).', - ['--pep-home'], - {'default': '.', 'metavar': '<URL>'}), - # Workaround for SourceForge's broken Python - # (``import random`` causes a segfault). - (frontend.SUPPRESS_HELP, - ['--no-random'], {'action': 'store_true'}),)) - - settings_default_overrides = {'footnote_references': 'brackets'} - - relative_path_settings = ('pep_stylesheet_path', 'pep_template') - - def __init__(self): - html4css1.Writer.__init__(self) - self.translator_class = HTMLTranslator - - def translate(self): - html4css1.Writer.translate(self) - settings = self.document.settings - template = open(settings.pep_template).read() - # Substitutions dict for template: - subs = {} - subs['encoding'] = settings.output_encoding - subs['version'] = docutils.__version__ - subs['stylesheet'] = ''.join(self.stylesheet) - pyhome = settings.python_home - subs['pyhome'] = pyhome - subs['pephome'] = settings.pep_home - if pyhome == '..': - subs['pepindex'] = '.' - else: - subs['pepindex'] = 'http://www.gentoo.org/proj/en/glep' - index = self.document.first_child_matching_class(nodes.field_list) - header = self.document[index] - pepnum = header[0][1].astext() - subs['pep'] = pepnum - if settings.no_random: - subs['banner'] = 0 - else: - import random - subs['banner'] = random.randrange(64) - try: - subs['pepnum'] = '%04i' % int(pepnum) - except: - subs['pepnum'] = pepnum - subs['title'] = header[1][1].astext() - subs['body'] = ''.join( - self.body_pre_docinfo + self.docinfo + self.body) - subs['body_suffix'] = ''.join(self.body_suffix) - self.output = template % subs - - -class HTMLTranslator(html4css1.HTMLTranslator): - - def get_stylesheet_reference(self, relative_to=None): - settings = self.settings - if relative_to == None: - relative_to = settings._destination - if settings.pep_stylesheet_path: - return utils.relative_path(relative_to, - settings.pep_stylesheet_path) - elif settings.pep_stylesheet: - return settings.pep_stylesheet - elif settings._stylesheet_path: - return utils.relative_path(relative_to, settings.stylesheet_path) - else: - return settings.stylesheet - - def depart_field_list(self, node): - html4css1.HTMLTranslator.depart_field_list(self, node) - if node.get('class') == 'rfc2822': - self.body.append('<hr />\n') diff --git a/dev-python/docutils/files/glep-0.3-r1/glepread.py b/dev-python/docutils/files/glep-0.3-r1/glepread.py deleted file mode 100644 index ec3b4cb23592..000000000000 --- a/dev-python/docutils/files/glep-0.3-r1/glepread.py +++ /dev/null @@ -1,53 +0,0 @@ -# Author: David Goodger -# Contact: goodger@users.sourceforge.net -# Revision: $Revision: 1.1 $ -# Date: $Date: 2003/07/07 23:39:10 $ -# Copyright: This module has been placed in the public domain. - -""" -Gentoo Linux Enhancement Proposal (GLEP) Reader. -""" - -__docformat__ = 'reStructuredText' - - -import sys -import os -import re -from docutils import nodes -from docutils.readers import standalone -from docutils.transforms import gleps, references -from docutils.parsers import rst - - -class Reader(standalone.Reader): - - supported = ('glep',) - """Contexts this reader supports.""" - - settings_spec = ( - 'PEP Reader Option Defaults', - 'The --pep-references and --rfc-references options (for the ' - 'reStructuredText parser) are on by default.', - ()) - - default_transforms = (references.Substitutions, - gleps.Headers, - gleps.Contents, - references.ChainedTargets, - references.AnonymousHyperlinks, - references.IndirectHyperlinks, - gleps.TargetNotes, - references.Footnotes, - references.ExternalTargets, - references.InternalTargets,) - - settings_default_overrides = {'pep_references': 1, 'rfc_references': 1} - - inliner_class = rst.states.Inliner - - def __init__(self, parser=None, parser_name=None): - """`parser` should be ``None``.""" - if parser is None: - parser = rst.Parser(rfc2822=1, inliner=self.inliner_class()) - standalone.Reader.__init__(self, parser, '') diff --git a/dev-python/docutils/files/glep-0.3-r1/glepstrans.py b/dev-python/docutils/files/glep-0.3-r1/glepstrans.py deleted file mode 100644 index 5d59c9687604..000000000000 --- a/dev-python/docutils/files/glep-0.3-r1/glepstrans.py +++ /dev/null @@ -1,293 +0,0 @@ -# Author: David Goodger -# Contact: goodger@users.sourceforge.net -# Revision: $Revision: 1.2 $ -# Date: $Date: 2003/07/29 00:15:37 $ -# Copyright: This module has been placed in the public domain. - -""" -Transforms for GLEP processing. - -- `Headers`: Used to transform a PEP's initial RFC-2822 header. It remains a - field list, but some entries get processed. -- `Contents`: Auto-inserts a table of contents. -""" - -__docformat__ = 'reStructuredText' - -import sys -import os -import re -import time -from docutils import nodes, utils -from docutils import ApplicationError, DataError -from docutils.transforms import Transform, TransformError -from docutils.transforms import parts, references, misc - - -class Headers(Transform): - - """ - Process fields in a GLEP's initial RFC-2822 header. - """ - - default_priority = 360 - - pep_url = 'glep-%04d.html' - pep_cvs_url = ('http://www.gentoo.org/cgi-bin/viewcvs.cgi/' - 'xml/htdocs/proj/en/glep/glep-%04d.txt?cvsroot=gentoo') - rcs_keyword_substitutions = ( - (re.compile(r'\$' r'RCSfile: (.+),v \$$', re.IGNORECASE), r'\1'), - (re.compile(r'\$[a-zA-Z]+: (.+) \$$'), r'\1'),) - - def apply(self): - if not len(self.document): - # @@@ replace these DataErrors with proper system messages - raise DataError('Document tree is empty.') - header = self.document[0] - if not isinstance(header, nodes.field_list) or \ - header.get('class') != 'rfc2822': - raise DataError('Document does not begin with an RFC-2822 ' - 'header; it is not a PEP.') - pep = None - for field in header: - if field[0].astext().lower() == 'glep': # should be the first field - value = field[1].astext() - try: - pep = int(value) - cvs_url = self.pep_cvs_url % pep - except ValueError: - pep = value - cvs_url = None - msg = self.document.reporter.warning( - '"GLEP" header must contain an integer; "%s" is an ' - 'invalid value.' % pep, base_node=field) - msgid = self.document.set_id(msg) - prb = nodes.problematic(value, value or '(none)', - refid=msgid) - prbid = self.document.set_id(prb) - msg.add_backref(prbid) - if len(field[1]): - field[1][0][:] = [prb] - else: - field[1] += nodes.paragraph('', '', prb) - break - if pep is None: - raise DataError('Document does not contain an RFC-2822 "GLEP" ' - 'header.') - if pep == 0: - # Special processing for PEP 0. - pending = nodes.pending(PEPZero) - self.document.insert(1, pending) - self.document.note_pending(pending) - if len(header) < 2 or header[1][0].astext().lower() != 'title': - raise DataError('No title!') - for field in header: - name = field[0].astext().lower() - body = field[1] - if len(body) > 1: - raise DataError('GLEP header field body contains multiple ' - 'elements:\n%s' % field.pformat(level=1)) - elif len(body) == 1: - if not isinstance(body[0], nodes.paragraph): - raise DataError('GLEP header field body may only contain ' - 'a single paragraph:\n%s' - % field.pformat(level=1)) - elif name == 'last-modified': - date = time.strftime( - '%d-%b-%Y', - time.localtime(os.stat(self.document['source'])[8])) - if cvs_url: - body += nodes.paragraph( - '', '', nodes.reference('', date, refuri=cvs_url)) - else: - # empty - continue - para = body[0] - if name == 'author': - for node in para: - if isinstance(node, nodes.reference): - node.parent.replace(node, mask_email(node)) - elif name == 'discussions-to': - for node in para: - if isinstance(node, nodes.reference): - node.parent.replace(node, mask_email(node, pep)) - elif name in ('replaces', 'replaced-by', 'requires'): - newbody = [] - space = nodes.Text(' ') - for refpep in re.split(',?\s+', body.astext()): - pepno = int(refpep) - newbody.append(nodes.reference( - refpep, refpep, refuri=self.pep_url % pepno)) - newbody.append(space) - para[:] = newbody[:-1] # drop trailing space - elif name == 'last-modified': - utils.clean_rcs_keywords(para, self.rcs_keyword_substitutions) - if cvs_url: - date = para.astext() - para[:] = [nodes.reference('', date, refuri=cvs_url)] - elif name == 'content-type': - pep_type = para.astext() - uri = self.pep_url % 2 - para[:] = [nodes.reference('', pep_type, refuri=uri)] - elif name == 'version' and len(body): - utils.clean_rcs_keywords(para, self.rcs_keyword_substitutions) - - -class Contents(Transform): - - """ - Insert a table of contents transform placeholder into the document after - the RFC 2822 header. - """ - - default_priority = 380 - - def apply(self): - pending = nodes.pending(parts.Contents, {'title': None}) - self.document.insert(1, pending) - self.document.note_pending(pending) - - -class TargetNotes(Transform): - - """ - Locate the "References" section, insert a placeholder for an external - target footnote insertion transform at the end, and schedule the - transform to run immediately. - """ - - default_priority = 520 - - def apply(self): - doc = self.document - i = len(doc) - 1 - refsect = copyright = None - while i >= 0 and isinstance(doc[i], nodes.section): - title_words = doc[i][0].astext().lower().split() - if 'references' in title_words: - refsect = doc[i] - break - elif 'copyright' in title_words: - copyright = i - i -= 1 - if not refsect: - refsect = nodes.section() - refsect += nodes.title('', 'References') - doc.set_id(refsect) - if copyright: - # Put the new "References" section before "Copyright": - doc.insert(copyright, refsect) - else: - # Put the new "References" section at end of doc: - doc.append(refsect) - pending = nodes.pending(references.TargetNotes) - refsect.append(pending) - self.document.note_pending(pending, 0) - pending = nodes.pending(misc.CallBack, - details={'callback': self.cleanup_callback}) - refsect.append(pending) - self.document.note_pending(pending, 1) - - def cleanup_callback(self, pending): - """ - Remove an empty "References" section. - - Called after the `references.TargetNotes` transform is complete. - """ - if len(pending.parent) == 2: # <title> and <pending> - pending.parent.parent.remove(pending.parent) - - -class PEPZero(Transform): - - """ - Special processing for PEP 0. - """ - - default_priority =760 - - def apply(self): - visitor = PEPZeroSpecial(self.document) - self.document.walk(visitor) - self.startnode.parent.remove(self.startnode) - - -class PEPZeroSpecial(nodes.SparseNodeVisitor): - - """ - Perform the special processing needed by PEP 0: - - - Mask email addresses. - - - Link PEP numbers in the second column of 4-column tables to the PEPs - themselves. - """ - - pep_url = Headers.pep_url - - def unknown_visit(self, node): - pass - - def visit_reference(self, node): - node.parent.replace(node, mask_email(node)) - - def visit_field_list(self, node): - if node.hasattr('class') and node['class'] == 'rfc2822': - raise nodes.SkipNode - - def visit_tgroup(self, node): - self.pep_table = node['cols'] == 4 - self.entry = 0 - - def visit_colspec(self, node): - self.entry += 1 - if self.pep_table and self.entry == 2: - node['class'] = 'num' - - def visit_row(self, node): - self.entry = 0 - - def visit_entry(self, node): - self.entry += 1 - if self.pep_table and self.entry == 2 and len(node) == 1: - node['class'] = 'num' - p = node[0] - if isinstance(p, nodes.paragraph) and len(p) == 1: - text = p.astext() - try: - pep = int(text) - ref = self.pep_url % pep - p[0] = nodes.reference(text, text, refuri=ref) - except ValueError: - pass - - -non_masked_addresses = ('peps@python.org', - 'python-list@python.org', - 'python-dev@python.org') - -def mask_email(ref, pepno=None): - """ - Mask the email address in `ref` and return a replacement node. - - `ref` is returned unchanged if it contains no email address. - - For email addresses such as "user@host", mask the address as "user at - host" (text) to thwart simple email address harvesters (except for those - listed in `non_masked_addresses`). If a PEP number (`pepno`) is given, - return a reference including a default email subject. - """ - if ref.hasattr('refuri') and ref['refuri'].startswith('mailto:'): - if ref['refuri'][8:] in non_masked_addresses: - replacement = ref[0] - else: - replacement_text = ref.astext().replace('@', ' at ') - replacement = nodes.raw('', replacement_text, format='html') - if pepno is None: - return replacement - else: - ref['refuri'] += '?subject=PEP%%20%s' % pepno - ref[:] = [replacement] - return ref - else: - return ref diff --git a/dev-python/docutils/files/glep-0.3.3/glep.py b/dev-python/docutils/files/glep-0.3.3/glep.py deleted file mode 100644 index e3fb18848833..000000000000 --- a/dev-python/docutils/files/glep-0.3.3/glep.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python - -# Author: David Goodger -# Contact: goodger@users.sourceforge.net -# Revision: $Revision: 1.1 $ -# Date: $Date: 2004/07/20 18:23:59 $ -# Copyright: This module has been placed in the public domain. - -""" -A minimal front end to the Docutils Publisher, producing HTML from PEP -(Python Enhancement Proposal) documents. -""" - -import locale -try: - locale.setlocale(locale.LC_ALL, '') -except: - pass - -from docutils.core import publish_cmdline, default_description - - -description = ('Generates (X)HTML from reStructuredText-format PEP files. ' - + default_description) - -publish_cmdline(reader_name='glep', writer_name='glep_html', - description=description) diff --git a/dev-python/docutils/files/glep-0.3.3/glep_htmlwrite.py b/dev-python/docutils/files/glep-0.3.3/glep_htmlwrite.py deleted file mode 100644 index 710c9d2264fa..000000000000 --- a/dev-python/docutils/files/glep-0.3.3/glep_htmlwrite.py +++ /dev/null @@ -1,94 +0,0 @@ -# Author: David Goodger -# Contact: goodger@users.sourceforge.net -# Revision: $Revision: 1.1 $ -# Date: $Date: 2004/07/20 18:23:59 $ -# Copyright: This module has been placed in the public domain. - -""" -PEP HTML Writer. -""" - -__docformat__ = 'reStructuredText' - - -import sys -import docutils -from docutils import frontend, nodes, utils -from docutils.writers import html4css1 - - -class Writer(html4css1.Writer): - - settings_spec = html4css1.Writer.settings_spec + ( - 'PEP/HTML-Specific Options', - """The HTML --footnote-references option's default is set to """ - '"brackets".', - (('Specify a template file. Default is "pep-html-template".', - ['--template'], - {'default': 'pep-html-template', 'metavar': '<file>'}), - ('Python\'s home URL. Default is ".." (parent directory).', - ['--python-home'], - {'default': '..', 'metavar': '<URL>'}), - ('Home URL prefix for PEPs. Default is "." (current directory).', - ['--pep-home'], - {'default': '.', 'metavar': '<URL>'}), - # Workaround for SourceForge's broken Python - # (``import random`` causes a segfault). - (frontend.SUPPRESS_HELP, - ['--no-random'], - {'action': 'store_true', 'validator': frontend.validate_boolean}),)) - - settings_default_overrides = {'footnote_references': 'brackets'} - - relative_path_settings = (html4css1.Writer.relative_path_settings - + ('template',)) - - config_section = 'pep_html writer' - config_section_dependencies = ('writers', 'html4css1 writer') - - def __init__(self): - html4css1.Writer.__init__(self) - self.translator_class = HTMLTranslator - - def translate(self): - html4css1.Writer.translate(self) - settings = self.document.settings - template = open(settings.template).read() - # Substitutions dict for template: - subs = {} - subs['encoding'] = settings.output_encoding - subs['version'] = docutils.__version__ - subs['stylesheet'] = ''.join(self.stylesheet) - pyhome = settings.python_home - subs['pyhome'] = pyhome - subs['pephome'] = settings.pep_home - if pyhome == '..': - subs['pepindex'] = '.' - else: - subs['pepindex'] = 'http://www.gentoo.org/proj/en/glep' - index = self.document.first_child_matching_class(nodes.field_list) - header = self.document[index] - pepnum = header[0][1].astext() - subs['pep'] = pepnum - if settings.no_random: - subs['banner'] = 0 - else: - import random - subs['banner'] = random.randrange(64) - try: - subs['pepnum'] = '%04i' % int(pepnum) - except: - subs['pepnum'] = pepnum - subs['title'] = header[1][1].astext() - subs['body'] = ''.join( - self.body_pre_docinfo + self.docinfo + self.body) - subs['body_suffix'] = ''.join(self.body_suffix) - self.output = template % subs - - -class HTMLTranslator(html4css1.HTMLTranslator): - - def depart_field_list(self, node): - html4css1.HTMLTranslator.depart_field_list(self, node) - if node.get('class') == 'rfc2822': - self.body.append('<hr />\n') diff --git a/dev-python/docutils/files/glep-0.3.3/glepread.py b/dev-python/docutils/files/glep-0.3.3/glepread.py deleted file mode 100644 index 807c13161839..000000000000 --- a/dev-python/docutils/files/glep-0.3.3/glepread.py +++ /dev/null @@ -1,61 +0,0 @@ -# Author: David Goodger -# Contact: goodger@users.sourceforge.net -# Revision: $Revision: 1.1 $ -# Date: $Date: 2004/07/20 18:23:59 $ -# Copyright: This module has been placed in the public domain. - -""" -Gentoo Linux Enhancement Proposal (GLEP) Reader. -""" - -__docformat__ = 'reStructuredText' - - -from docutils.readers import standalone -from docutils.transforms import gleps, references -from docutils.parsers import rst - - -class Inliner(rst.states.Inliner): - - """ - Extend `rst.Inliner` for local PEP references. - """ - - pep_url = rst.states.Inliner.pep_url_local - - -class Reader(standalone.Reader): - - supported = ('glep',) - """Contexts this reader supports.""" - - settings_spec = ( - 'PEP Reader Option Defaults', - 'The --pep-references and --rfc-references options (for the ' - 'reStructuredText parser) are on by default.', - ()) - - config_section = 'pep reader' - config_section_dependencies = ('readers', 'standalone reader') - - default_transforms = (references.Substitutions, - gleps.Headers, - gleps.Contents, - references.ChainedTargets, - references.AnonymousHyperlinks, - references.IndirectHyperlinks, - gleps.TargetNotes, - references.Footnotes, - references.ExternalTargets, - references.InternalTargets,) - - settings_default_overrides = {'pep_references': 1, 'rfc_references': 1} - - inliner_class = Inliner - - def __init__(self, parser=None, parser_name=None): - """`parser` should be ``None``.""" - if parser is None: - parser = rst.Parser(rfc2822=1, inliner=self.inliner_class()) - standalone.Reader.__init__(self, parser, '') diff --git a/dev-python/docutils/files/glep-0.3.3/glepstrans.py b/dev-python/docutils/files/glep-0.3.3/glepstrans.py deleted file mode 100644 index 64dafd174b03..000000000000 --- a/dev-python/docutils/files/glep-0.3.3/glepstrans.py +++ /dev/null @@ -1,303 +0,0 @@ -# Author: David Goodger -# Contact: goodger@users.sourceforge.net -# Revision: $Revision: 1.1 $ -# Date: $Date: 2004/07/20 18:23:59 $ -# Copyright: This module has been placed in the public domain. - -""" -Transforms for PEP processing. - -- `Headers`: Used to transform a PEP's initial RFC-2822 header. It remains a - field list, but some entries get processed. -- `Contents`: Auto-inserts a table of contents. -- `PEPZero`: Special processing for PEP 0. -""" - -__docformat__ = 'reStructuredText' - -import sys -import os -import re -import time -from docutils import nodes, utils, languages -from docutils import ApplicationError, DataError -from docutils.transforms import Transform, TransformError -from docutils.transforms import parts, references, misc - - -class Headers(Transform): - - """ - Process fields in a GLEP's initial RFC-2822 header. - """ - - default_priority = 360 - - pep_url = 'glep-%04d.html' - pep_cvs_url = ('http://www.gentoo.org/cgi-bin/viewcvs/' - 'xml/htdocs/proj/en/glep/glep-%04d.txt?cvsroot=gentoo') - rcs_keyword_substitutions = ( - (re.compile(r'\$' r'RCSfile: (.+),v \$$', re.IGNORECASE), r'\1'), - (re.compile(r'\$[a-zA-Z]+: (.+) \$$'), r'\1'),) - - def apply(self): - if not len(self.document): - # @@@ replace these DataErrors with proper system messages - raise DataError('Document tree is empty.') - header = self.document[0] - if not isinstance(header, nodes.field_list) or \ - header.get('class') != 'rfc2822': - raise DataError('Document does not begin with an RFC-2822 ' - 'header; it is not a GLEP.') - pep = None - for field in header: - if field[0].astext().lower() == 'glep': # should be the first field - value = field[1].astext() - try: - pep = int(value) - cvs_url = self.pep_cvs_url % pep - except ValueError: - pep = value - cvs_url = None - msg = self.document.reporter.warning( - '"GLEP" header must contain an integer; "%s" is an ' - 'invalid value.' % pep, base_node=field) - msgid = self.document.set_id(msg) - prb = nodes.problematic(value, value or '(none)', - refid=msgid) - prbid = self.document.set_id(prb) - msg.add_backref(prbid) - if len(field[1]): - field[1][0][:] = [prb] - else: - field[1] += nodes.paragraph('', '', prb) - break - if pep is None: - raise DataError('Document does not contain an RFC-2822 "GLEP" ' - 'header.') - if pep == 0: - # Special processing for PEP 0. - pending = nodes.pending(PEPZero) - self.document.insert(1, pending) - self.document.note_pending(pending) - if len(header) < 2 or header[1][0].astext().lower() != 'title': - raise DataError('No title!') - for field in header: - name = field[0].astext().lower() - body = field[1] - if len(body) > 1: - raise DataError('GLEP header field body contains multiple ' - 'elements:\n%s' % field.pformat(level=1)) - elif len(body) == 1: - if not isinstance(body[0], nodes.paragraph): - raise DataError('GLEP header field body may only contain ' - 'a single paragraph:\n%s' - % field.pformat(level=1)) - elif name == 'last-modified': - date = time.strftime( - '%d-%b-%Y', - time.localtime(os.stat(self.document['source'])[8])) - if cvs_url: - body += nodes.paragraph( - '', '', nodes.reference('', date, refuri=cvs_url)) - else: - # empty - continue - para = body[0] - if name == 'author': - for node in para: - if isinstance(node, nodes.reference): - node.parent.replace(node, mask_email(node)) - elif name == 'discussions-to': - for node in para: - if isinstance(node, nodes.reference): - node.parent.replace(node, mask_email(node, pep)) - elif name in ('replaces', 'replaced-by', 'requires'): - newbody = [] - space = nodes.Text(' ') - for refpep in re.split(',?\s+', body.astext()): - pepno = int(refpep) - newbody.append(nodes.reference( - refpep, refpep, refuri=self.pep_url % pepno)) - newbody.append(space) - para[:] = newbody[:-1] # drop trailing space - elif name == 'last-modified': - utils.clean_rcs_keywords(para, self.rcs_keyword_substitutions) - if cvs_url: - date = para.astext() - para[:] = [nodes.reference('', date, refuri=cvs_url)] - elif name == 'content-type': - pep_type = para.astext() - uri = self.pep_url % 12 - para[:] = [nodes.reference('', pep_type, refuri=uri)] - elif name == 'version' and len(body): - utils.clean_rcs_keywords(para, self.rcs_keyword_substitutions) - - -class Contents(Transform): - - """ - Insert an empty table of contents topic and a transform placeholder into - the document after the RFC 2822 header. - """ - - default_priority = 380 - - def apply(self): - language = languages.get_language(self.document.settings.language_code) - name = language.labels['contents'] - title = nodes.title('', name) - topic = nodes.topic('', title, CLASS='contents') - name = nodes.fully_normalize_name(name) - if not self.document.has_name(name): - topic['name'] = name - self.document.note_implicit_target(topic) - pending = nodes.pending(parts.Contents) - topic += pending - self.document.insert(1, topic) - self.document.note_pending(pending) - - -class TargetNotes(Transform): - - """ - Locate the "References" section, insert a placeholder for an external - target footnote insertion transform at the end, and schedule the - transform to run immediately. - """ - - default_priority = 520 - - def apply(self): - doc = self.document - i = len(doc) - 1 - refsect = copyright = None - while i >= 0 and isinstance(doc[i], nodes.section): - title_words = doc[i][0].astext().lower().split() - if 'references' in title_words: - refsect = doc[i] - break - elif 'copyright' in title_words: - copyright = i - i -= 1 - if not refsect: - refsect = nodes.section() - refsect += nodes.title('', 'References') - doc.set_id(refsect) - if copyright: - # Put the new "References" section before "Copyright": - doc.insert(copyright, refsect) - else: - # Put the new "References" section at end of doc: - doc.append(refsect) - pending = nodes.pending(references.TargetNotes) - refsect.append(pending) - self.document.note_pending(pending, 0) - pending = nodes.pending(misc.CallBack, - details={'callback': self.cleanup_callback}) - refsect.append(pending) - self.document.note_pending(pending, 1) - - def cleanup_callback(self, pending): - """ - Remove an empty "References" section. - - Called after the `references.TargetNotes` transform is complete. - """ - if len(pending.parent) == 2: # <title> and <pending> - pending.parent.parent.remove(pending.parent) - - -class PEPZero(Transform): - - """ - Special processing for PEP 0. - """ - - default_priority =760 - - def apply(self): - visitor = PEPZeroSpecial(self.document) - self.document.walk(visitor) - self.startnode.parent.remove(self.startnode) - - -class PEPZeroSpecial(nodes.SparseNodeVisitor): - - """ - Perform the special processing needed by PEP 0: - - - Mask email addresses. - - - Link PEP numbers in the second column of 4-column tables to the PEPs - themselves. - """ - - pep_url = Headers.pep_url - - def unknown_visit(self, node): - pass - - def visit_reference(self, node): - node.parent.replace(node, mask_email(node)) - - def visit_field_list(self, node): - if node.hasattr('class') and node['class'] == 'rfc2822': - raise nodes.SkipNode - - def visit_tgroup(self, node): - self.pep_table = node['cols'] == 4 - self.entry = 0 - - def visit_colspec(self, node): - self.entry += 1 - if self.pep_table and self.entry == 2: - node['class'] = 'num' - - def visit_row(self, node): - self.entry = 0 - - def visit_entry(self, node): - self.entry += 1 - if self.pep_table and self.entry == 2 and len(node) == 1: - node['class'] = 'num' - p = node[0] - if isinstance(p, nodes.paragraph) and len(p) == 1: - text = p.astext() - try: - pep = int(text) - ref = self.pep_url % pep - p[0] = nodes.reference(text, text, refuri=ref) - except ValueError: - pass - - -non_masked_addresses = ('peps@python.org', - 'python-list@python.org', - 'python-dev@python.org') - -def mask_email(ref, pepno=None): - """ - Mask the email address in `ref` and return a replacement node. - - `ref` is returned unchanged if it contains no email address. - - For email addresses such as "user@host", mask the address as "user at - host" (text) to thwart simple email address harvesters (except for those - listed in `non_masked_addresses`). If a PEP number (`pepno`) is given, - return a reference including a default email subject. - """ - if ref.hasattr('refuri') and ref['refuri'].startswith('mailto:'): - if ref['refuri'][8:] in non_masked_addresses: - replacement = ref[0] - else: - replacement_text = ref.astext().replace('@', ' at ') - replacement = nodes.raw('', replacement_text, format='html') - if pepno is None: - return replacement - else: - ref['refuri'] += '?subject=PEP%%20%s' % pepno - ref[:] = [replacement] - return ref - else: - return ref diff --git a/dev-python/docutils/files/glep.py b/dev-python/docutils/files/glep.py deleted file mode 100644 index b4a6c8517c8a..000000000000 --- a/dev-python/docutils/files/glep.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python - -# Author: David Goodger -# Contact: goodger@users.sourceforge.net -# Revision: $Revision: 1.1 $ -# Date: $Date: 2003/06/01 03:57:44 $ -# Copyright: This module has been placed in the public domain. - -""" -A minimal front end to the Docutils Publisher, producing HTML from PEP -(Python Enhancement Proposal) documents. -""" - -import locale -try: - locale.setlocale(locale.LC_ALL, '') -except: - pass - -from docutils.core import publish_cmdline, default_description - - -description = ('Generates (X)HTML from reStructuredText-format PEP files. ' - + default_description) - -publish_cmdline(reader_name='glep', writer_name='glep_html', - description=description) diff --git a/dev-python/docutils/files/glep_htmlwrite.py b/dev-python/docutils/files/glep_htmlwrite.py deleted file mode 100644 index 2ac959de04bc..000000000000 --- a/dev-python/docutils/files/glep_htmlwrite.py +++ /dev/null @@ -1,112 +0,0 @@ -# Author: David Goodger -# Contact: goodger@users.sourceforge.net -# Revision: $Revision: 1.3 $ -# Date: $Date: 2003/06/04 19:39:20 $ -# Copyright: This module has been placed in the public domain. - -""" -PEP HTML Writer. -""" - -__docformat__ = 'reStructuredText' - - -import sys -import docutils -from docutils import nodes, optik, utils -from docutils.writers import html4css1 - -class Writer(html4css1.Writer): - - settings_spec = html4css1.Writer.settings_spec + ( - 'PEP/HTML-Specific Options', - 'The HTML --footnote-references option is set to "brackets" by ' - 'default.', - (('Specify a PEP stylesheet URL, used verbatim. Default is ' - '--stylesheet\'s value. If given, --pep-stylesheet overrides ' - '--stylesheet.', - ['--pep-stylesheet'], - {'metavar': '<URL>'}), - ('Specify a PEP stylesheet file, relative to the current working ' - 'directory. The path is adjusted relative to the output HTML ' - 'file. Overrides --pep-stylesheet and --stylesheet-path.', - ['--pep-stylesheet-path'], - {'metavar': '<path>'}), - ('Specify a template file. Default is "pep-html-template".', - ['--pep-template'], - {'default': 'pep-html-template', 'metavar': '<file>'}), - ('Python\'s home URL. Default is ".." (parent directory).', - ['--python-home'], - {'default': '..', 'metavar': '<URL>'}), - ('Home URL prefix for PEPs. Default is "." (current directory).', - ['--pep-home'], - {'default': '.', 'metavar': '<URL>'}), - # Workaround for SourceForge's broken Python - # (``import random`` causes a segfault). - (optik.SUPPRESS_HELP, - ['--no-random'], {'action': 'store_true'}),)) - - settings_default_overrides = {'footnote_references': 'brackets'} - - relative_path_settings = ('pep_stylesheet_path', 'pep_template') - - def __init__(self): - html4css1.Writer.__init__(self) - self.translator_class = HTMLTranslator - - def translate(self): - html4css1.Writer.translate(self) - settings = self.document.settings - template = open(settings.pep_template).read() - # Substitutions dict for template: - subs = {} - subs['encoding'] = settings.output_encoding - subs['version'] = docutils.__version__ - subs['stylesheet'] = ''.join(self.stylesheet) - pyhome = settings.python_home - subs['pyhome'] = pyhome - subs['pephome'] = settings.pep_home - if pyhome == '..': - subs['pepindex'] = '.' - else: - subs['pepindex'] = 'http://www.gentoo.org/proj/en/glep' - index = self.document.first_child_matching_class(nodes.field_list) - header = self.document[index] - pepnum = header[0][1].astext() - subs['pep'] = pepnum - if settings.no_random: - subs['banner'] = 0 - else: - import random - subs['banner'] = random.randrange(64) - try: - subs['pepnum'] = '%04i' % int(pepnum) - except: - subs['pepnum'] = pepnum - subs['title'] = header[1][1].astext() - subs['body'] = ''.join( - self.body_pre_docinfo + self.docinfo + self.body) - subs['body_suffix'] = ''.join(self.body_suffix) - self.output = template % subs - - -class HTMLTranslator(html4css1.HTMLTranslator): - - def get_stylesheet_reference(self, relative_to=None): - settings = self.settings - if relative_to == None: - relative_to = settings._destination - if settings.pep_stylesheet_path: - return utils.relative_path(relative_to, - settings.pep_stylesheet_path) - elif settings.pep_stylesheet: - return settings.pep_stylesheet - elif settings._stylesheet_path: - return utils.relative_path(relative_to, settings.stylesheet_path) - else: - return settings.stylesheet - - def depart_field_list(self, node): - html4css1.HTMLTranslator.depart_field_list(self, node) - if node.get('class') == 'rfc2822': - self.body.append('<hr />\n') diff --git a/dev-python/docutils/files/glepread.py b/dev-python/docutils/files/glepread.py deleted file mode 100644 index ad1d6333c802..000000000000 --- a/dev-python/docutils/files/glepread.py +++ /dev/null @@ -1,53 +0,0 @@ -# Author: David Goodger -# Contact: goodger@users.sourceforge.net -# Revision: $Revision: 1.1 $ -# Date: $Date: 2003/06/01 03:57:44 $ -# Copyright: This module has been placed in the public domain. - -""" -Gentoo Linux Enhancement Proposal (GLEP) Reader. -""" - -__docformat__ = 'reStructuredText' - - -import sys -import os -import re -from docutils import nodes -from docutils.readers import standalone -from docutils.transforms import gleps, references -from docutils.parsers import rst - - -class Reader(standalone.Reader): - - supported = ('glep',) - """Contexts this reader supports.""" - - settings_spec = ( - 'PEP Reader Option Defaults', - 'The --pep-references and --rfc-references options (for the ' - 'reStructuredText parser) are on by default.', - ()) - - default_transforms = (references.Substitutions, - gleps.Headers, - gleps.Contents, - references.ChainedTargets, - references.AnonymousHyperlinks, - references.IndirectHyperlinks, - gleps.TargetNotes, - references.Footnotes, - references.ExternalTargets, - references.InternalTargets,) - - settings_default_overrides = {'pep_references': 1, 'rfc_references': 1} - - inliner_class = rst.states.Inliner - - def __init__(self, parser=None, parser_name=None): - """`parser` should be ``None``.""" - if parser is None: - parser = rst.Parser(rfc2822=1, inliner=self.inliner_class()) - standalone.Reader.__init__(self, parser, '') diff --git a/dev-python/docutils/files/glepstrans.py b/dev-python/docutils/files/glepstrans.py deleted file mode 100644 index 1c2f5e0f562b..000000000000 --- a/dev-python/docutils/files/glepstrans.py +++ /dev/null @@ -1,293 +0,0 @@ -# Author: David Goodger -# Contact: goodger@users.sourceforge.net -# Revision: $Revision: 1.2 $ -# Date: $Date: 2003/06/04 19:39:20 $ -# Copyright: This module has been placed in the public domain. - -""" -Transforms for GLEP processing. - -- `Headers`: Used to transform a PEP's initial RFC-2822 header. It remains a - field list, but some entries get processed. -- `Contents`: Auto-inserts a table of contents. -""" - -__docformat__ = 'reStructuredText' - -import sys -import os -import re -import time -from docutils import nodes, utils -from docutils import ApplicationError, DataError -from docutils.transforms import Transform, TransformError -from docutils.transforms import parts, references, misc - - -class Headers(Transform): - - """ - Process fields in a GLEP's initial RFC-2822 header. - """ - - default_priority = 360 - - pep_url = 'glep-%04d.html' - pep_cvs_url = ('http://cvs.gentoo.org/cgi-bin/viewcvs.cgi/gentoo/' - 'xml/htdocs/proj/en/glep/glep-%04d.txt') - rcs_keyword_substitutions = ( - (re.compile(r'\$' r'RCSfile: (.+),v \$$', re.IGNORECASE), r'\1'), - (re.compile(r'\$[a-zA-Z]+: (.+) \$$'), r'\1'),) - - def apply(self): - if not len(self.document): - # @@@ replace these DataErrors with proper system messages - raise DataError('Document tree is empty.') - header = self.document[0] - if not isinstance(header, nodes.field_list) or \ - header.get('class') != 'rfc2822': - raise DataError('Document does not begin with an RFC-2822 ' - 'header; it is not a PEP.') - pep = None - for field in header: - if field[0].astext().lower() == 'glep': # should be the first field - value = field[1].astext() - try: - pep = int(value) - cvs_url = self.pep_cvs_url % pep - except ValueError: - pep = value - cvs_url = None - msg = self.document.reporter.warning( - '"GLEP" header must contain an integer; "%s" is an ' - 'invalid value.' % pep, base_node=field) - msgid = self.document.set_id(msg) - prb = nodes.problematic(value, value or '(none)', - refid=msgid) - prbid = self.document.set_id(prb) - msg.add_backref(prbid) - if len(field[1]): - field[1][0][:] = [prb] - else: - field[1] += nodes.paragraph('', '', prb) - break - if pep is None: - raise DataError('Document does not contain an RFC-2822 "GLEP" ' - 'header.') - if pep == 0: - # Special processing for PEP 0. - pending = nodes.pending(PEPZero) - self.document.insert(1, pending) - self.document.note_pending(pending) - if len(header) < 2 or header[1][0].astext().lower() != 'title': - raise DataError('No title!') - for field in header: - name = field[0].astext().lower() - body = field[1] - if len(body) > 1: - raise DataError('GLEP header field body contains multiple ' - 'elements:\n%s' % field.pformat(level=1)) - elif len(body) == 1: - if not isinstance(body[0], nodes.paragraph): - raise DataError('GLEP header field body may only contain ' - 'a single paragraph:\n%s' - % field.pformat(level=1)) - elif name == 'last-modified': - date = time.strftime( - '%d-%b-%Y', - time.localtime(os.stat(self.document['source'])[8])) - if cvs_url: - body += nodes.paragraph( - '', '', nodes.reference('', date, refuri=cvs_url)) - else: - # empty - continue - para = body[0] - if name == 'author': - for node in para: - if isinstance(node, nodes.reference): - node.parent.replace(node, mask_email(node)) - elif name == 'discussions-to': - for node in para: - if isinstance(node, nodes.reference): - node.parent.replace(node, mask_email(node, pep)) - elif name in ('replaces', 'replaced-by', 'requires'): - newbody = [] - space = nodes.Text(' ') - for refpep in re.split(',?\s+', body.astext()): - pepno = int(refpep) - newbody.append(nodes.reference( - refpep, refpep, refuri=self.pep_url % pepno)) - newbody.append(space) - para[:] = newbody[:-1] # drop trailing space - elif name == 'last-modified': - utils.clean_rcs_keywords(para, self.rcs_keyword_substitutions) - if cvs_url: - date = para.astext() - para[:] = [nodes.reference('', date, refuri=cvs_url)] - elif name == 'content-type': - pep_type = para.astext() - uri = self.pep_url % 2 - para[:] = [nodes.reference('', pep_type, refuri=uri)] - elif name == 'version' and len(body): - utils.clean_rcs_keywords(para, self.rcs_keyword_substitutions) - - -class Contents(Transform): - - """ - Insert a table of contents transform placeholder into the document after - the RFC 2822 header. - """ - - default_priority = 380 - - def apply(self): - pending = nodes.pending(parts.Contents, {'title': None}) - self.document.insert(1, pending) - self.document.note_pending(pending) - - -class TargetNotes(Transform): - - """ - Locate the "References" section, insert a placeholder for an external - target footnote insertion transform at the end, and schedule the - transform to run immediately. - """ - - default_priority = 520 - - def apply(self): - doc = self.document - i = len(doc) - 1 - refsect = copyright = None - while i >= 0 and isinstance(doc[i], nodes.section): - title_words = doc[i][0].astext().lower().split() - if 'references' in title_words: - refsect = doc[i] - break - elif 'copyright' in title_words: - copyright = i - i -= 1 - if not refsect: - refsect = nodes.section() - refsect += nodes.title('', 'References') - doc.set_id(refsect) - if copyright: - # Put the new "References" section before "Copyright": - doc.insert(copyright, refsect) - else: - # Put the new "References" section at end of doc: - doc.append(refsect) - pending = nodes.pending(references.TargetNotes) - refsect.append(pending) - self.document.note_pending(pending, 0) - pending = nodes.pending(misc.CallBack, - details={'callback': self.cleanup_callback}) - refsect.append(pending) - self.document.note_pending(pending, 1) - - def cleanup_callback(self, pending): - """ - Remove an empty "References" section. - - Called after the `references.TargetNotes` transform is complete. - """ - if len(pending.parent) == 2: # <title> and <pending> - pending.parent.parent.remove(pending.parent) - - -class PEPZero(Transform): - - """ - Special processing for PEP 0. - """ - - default_priority =760 - - def apply(self): - visitor = PEPZeroSpecial(self.document) - self.document.walk(visitor) - self.startnode.parent.remove(self.startnode) - - -class PEPZeroSpecial(nodes.SparseNodeVisitor): - - """ - Perform the special processing needed by PEP 0: - - - Mask email addresses. - - - Link PEP numbers in the second column of 4-column tables to the PEPs - themselves. - """ - - pep_url = Headers.pep_url - - def unknown_visit(self, node): - pass - - def visit_reference(self, node): - node.parent.replace(node, mask_email(node)) - - def visit_field_list(self, node): - if node.hasattr('class') and node['class'] == 'rfc2822': - raise nodes.SkipNode - - def visit_tgroup(self, node): - self.pep_table = node['cols'] == 4 - self.entry = 0 - - def visit_colspec(self, node): - self.entry += 1 - if self.pep_table and self.entry == 2: - node['class'] = 'num' - - def visit_row(self, node): - self.entry = 0 - - def visit_entry(self, node): - self.entry += 1 - if self.pep_table and self.entry == 2 and len(node) == 1: - node['class'] = 'num' - p = node[0] - if isinstance(p, nodes.paragraph) and len(p) == 1: - text = p.astext() - try: - pep = int(text) - ref = self.pep_url % pep - p[0] = nodes.reference(text, text, refuri=ref) - except ValueError: - pass - - -non_masked_addresses = ('peps@python.org', - 'python-list@python.org', - 'python-dev@python.org') - -def mask_email(ref, pepno=None): - """ - Mask the email address in `ref` and return a replacement node. - - `ref` is returned unchanged if it contains no email address. - - For email addresses such as "user@host", mask the address as "user at - host" (text) to thwart simple email address harvesters (except for those - listed in `non_masked_addresses`). If a PEP number (`pepno`) is given, - return a reference including a default email subject. - """ - if ref.hasattr('refuri') and ref['refuri'].startswith('mailto:'): - if ref['refuri'][8:] in non_masked_addresses: - replacement = ref[0] - else: - replacement_text = ref.astext().replace('@', ' at ') - replacement = nodes.raw('', replacement_text, format='html') - if pepno is None: - return replacement - else: - ref['refuri'] += '?subject=PEP%%20%s' % pepno - ref[:] = [replacement] - return ref - else: - return ref |