Skip to content

Commit

Permalink
Self-host PyPI-related badges
Browse files Browse the repository at this point in the history
  • Loading branch information
ambv committed Mar 26, 2018
1 parent 74f8c13 commit 78fb6f7
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.coverage
_build
.DS_Store
.DS_Store
docs/_static/pypi.svg
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<a href="https://travis-ci.org/ambv/black"><img alt="Build Status" src="https://travis-ci.org/ambv/black.svg?branch=master"></a>
<a href="http://black.readthedocs.io/en/latest/?badge=latest"><img alt="Documentation Status" src="http://readthedocs.org/projects/black/badge/?version=latest"></a>
<a href="https://coveralls.io/github/ambv/black?branch=master"><img alt="Coverage Status" src="https://coveralls.io/repos/github/ambv/black/badge.svg?branch=master"></a>
<a href="https://github.com/ambv/black/blob/master/LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-7900CA.svg"></a>
<img alt="PyPI" src="https://img.shields.io/pypi/v/black.svg">
<a href="https://github.com/ambv/black/blob/master/LICENSE"><img alt="License: MIT" src="https://raw.githubusercontent.com/ambv/black/master/docs/_static/license.svg"></a>
<img alt="PyPI" src="http://black.readthedocs.io/en/latest/_static/pypi.svg">
<a href="https://github.com/ambv/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
</p>

Expand Down
1 change: 1 addition & 0 deletions docs/_static/license.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/_static/pypi_template.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import ast
from pathlib import Path
import re
import string

from recommonmark.parser import CommonMarkParser

Expand All @@ -30,6 +31,15 @@ def get_version():
return str(ast.literal_eval(version))


def make_pypi_svg(version):
template = CURRENT_DIR / '_static' / 'pypi_template.svg'
target = CURRENT_DIR / '_static' / 'pypi.svg'
with open(str(template), 'r', encoding='utf8') as f:
svg = string.Template(f.read()).substitute(version=version)
with open(str(target), 'w', encoding='utf8') as f:
f.write(svg)


# -- Project information -----------------------------------------------------

project = 'Black'
Expand All @@ -43,6 +53,8 @@ def get_version():
version = release
for sp in 'abcfr':
version = version.split(sp)[0]
make_pypi_svg(release)


# -- General configuration ---------------------------------------------------

Expand Down

0 comments on commit 78fb6f7

Please sign in to comment.