Commit 4b8823e5 authored by Łukasz Langa's avatar Łukasz Langa
Browse files

Self-host PyPI-related badges

parent 74f8c131
Loading
Loading
Loading
Loading
+1 −0
Changes for .gitignore: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
.coverage
_build
.DS_Store
docs/_static/pypi.svg
+2 −2
Changes for README.md: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -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="http://black.readthedocs.io/en/latest/_static/license.svg"></a>
<a href="https://pypi.python.org/pypi/black"><img alt="PyPI" src="http://black.readthedocs.io/en/latest/_static/pypi.svg"></a>
<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>

+1 −0
Changes for docs/_static/license.svg: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="78" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="78" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h47v20H0z"/><path fill="#7900CA" d="M47 0h31v20H47z"/><path fill="url(#b)" d="M0 0h78v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><text x="245" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="370">license</text><text x="245" y="140" transform="scale(.1)" textLength="370">license</text><text x="615" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="210">MIT</text><text x="615" y="140" transform="scale(.1)" textLength="210">MIT</text></g> </svg>
 No newline at end of file
+1 −0
Changes for docs/_static/pypi_template.svg: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="88" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="88" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h33v20H0z"/><path fill="#007ec6" d="M33 0h55v20H33z"/><path fill="url(#b)" d="M0 0h88v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><text x="175" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="230">pypi</text><text x="175" y="140" transform="scale(.1)" textLength="230">pypi</text><text x="595" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="450">v18.3a4</text><text x="595" y="140" transform="scale(.1)" textLength="450">$version</text></g> </svg>
+12 −0
Changes for docs/conf.py: 12 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
import ast
from pathlib import Path
import re
import string

from recommonmark.parser import CommonMarkParser

@@ -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'
@@ -43,6 +53,8 @@ def get_version():
version = release
for sp in 'abcfr':
    version = version.split(sp)[0]
make_pypi_svg(release)


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