aboutsummaryrefslogtreecommitdiffstats
path: root/linkify.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2015-12-31 10:51:55 -0500
committerJason R. Coombs <jaraco@jaraco.com>2015-12-31 10:51:55 -0500
commit29fa01621c3de0a5c78c4f49b5d051386d0d566f (patch)
treefce7387c8ba82178be987b004cbda1c22005a04f /linkify.py
parent928324bd76f35e9c8c526df828577b5640a95ed0 (diff)
parent6bdbe8957d8c8d293e3fea3fa4baf45eb7c3a3a4 (diff)
downloadexternal_python_setuptools-29fa01621c3de0a5c78c4f49b5d051386d0d566f.tar.gz
external_python_setuptools-29fa01621c3de0a5c78c4f49b5d051386d0d566f.tar.bz2
external_python_setuptools-29fa01621c3de0a5c78c4f49b5d051386d0d566f.zip
Merge with master. Ref #229.
--HG-- branch : feature/issue-229
Diffstat (limited to 'linkify.py')
-rw-r--r--linkify.py54
1 files changed, 0 insertions, 54 deletions
diff --git a/linkify.py b/linkify.py
deleted file mode 100644
index e7b3ca7b..00000000
--- a/linkify.py
+++ /dev/null
@@ -1,54 +0,0 @@
-"""
-Sphinx plugin to add links to the changelog.
-"""
-
-import re
-import os
-
-
-link_patterns = [
- r"(Issue )?#(?P<issue>\d+)",
- r"Pull Request ?#(?P<pull_request>\d+)",
- r"Distribute #(?P<distribute>\d+)",
- r"Buildout #(?P<buildout>\d+)",
- r"Old Setuptools #(?P<old_setuptools>\d+)",
- r"Jython #(?P<jython>\d+)",
- r"Python #(?P<python>\d+)",
- r"Interop #(?P<interop>\d+)",
-]
-
-issue_urls = dict(
- pull_request='https://bitbucket.org'
- '/pypa/setuptools/pull-request/{pull_request}',
- issue='https://bitbucket.org/pypa/setuptools/issue/{issue}',
- distribute='https://bitbucket.org/tarek/distribute/issue/{distribute}',
- buildout='https://github.com/buildout/buildout/issues/{buildout}',
- old_setuptools='http://bugs.python.org/setuptools/issue{old_setuptools}',
- jython='http://bugs.jython.org/issue{jython}',
- python='http://bugs.python.org/issue{python}',
- interop='https://github.com/pypa/interoperability-peps/issues/{interop}',
-)
-
-
-def _linkify(source, dest):
- pattern = '|'.join(link_patterns)
- with open(source) as source:
- out = re.sub(pattern, replacer, source.read())
- with open(dest, 'w') as dest:
- dest.write(out)
-
-
-def replacer(match):
- text = match.group(0)
- match_dict = match.groupdict()
- for key in match_dict:
- if match_dict[key]:
- url = issue_urls[key].format(**match_dict)
- return "`{text} <{url}>`_".format(text=text, url=url)
-
-def setup(app):
- _linkify('CHANGES.txt', 'CHANGES (links).txt')
- app.connect('build-finished', remove_file)
-
-def remove_file(app, exception):
- os.remove('CHANGES (links).txt')