Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
caea578c
Commit
caea578c
authored
Dec 30, 2014
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved linkify logic to documentation builder as Sphinx extension.
parent
ede1df71
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
41 deletions
+53
-41
docs/conf.py
docs/conf.py
+1
-1
linkify.py
linkify.py
+52
-0
release.py
release.py
+0
-40
No files found.
docs/conf.py
View file @
caea578c
...
@@ -28,7 +28,7 @@ import setup as setup_script
...
@@ -28,7 +28,7 @@ import setup as setup_script
# Add any Sphinx extension module names here, as strings. They can be extensions
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions
=
[]
extensions
=
[
'linkify'
]
# Add any paths that contain templates here, relative to this directory.
# Add any paths that contain templates here, relative to this directory.
templates_path
=
[
'_templates'
]
templates_path
=
[
'_templates'
]
...
...
linkify.py
0 → 100644
View file @
caea578c
"""
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+)
",
]
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}',
)
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')
release.py
View file @
caea578c
...
@@ -3,7 +3,6 @@ Setuptools is released using 'jaraco.packaging.release'. To make a release,
...
@@ -3,7 +3,6 @@ Setuptools is released using 'jaraco.packaging.release'. To make a release,
install jaraco.packaging and run 'python -m jaraco.packaging.release'
install jaraco.packaging and run 'python -m jaraco.packaging.release'
"""
"""
import
re
import
os
import
os
import
subprocess
import
subprocess
...
@@ -14,7 +13,6 @@ pkg_resources.require('wheel')
...
@@ -14,7 +13,6 @@ pkg_resources.require('wheel')
def
before_upload
():
def
before_upload
():
_linkify
(
'CHANGES.txt'
,
'CHANGES (links).txt'
)
BootstrapBookmark
.
add
()
BootstrapBookmark
.
add
()
...
@@ -33,44 +31,6 @@ test_info = "Travis-CI tests: http://travis-ci.org/#!/jaraco/setuptools"
...
@@ -33,44 +31,6 @@ test_info = "Travis-CI tests: http://travis-ci.org/#!/jaraco/setuptools"
os
.
environ
[
"SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES"
]
=
"1"
os
.
environ
[
"SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES"
]
=
"1"
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+)
",
]
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}',
)
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)
class
BootstrapBookmark
:
class
BootstrapBookmark
:
name
=
'bootstrap'
name
=
'bootstrap'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment