1# -*- coding: utf-8 -*-
2import re
3from setuptools import setup
4
5INSTALL_REQUIRES = ["sphinx"]
6EXTRAS_REQUIRE = {
7    "tests": ["pytest", 'mock; python_version < "3.0"'],
8    "lint": [
9        "flake8==3.6.0",
10        'flake8-bugbear==18.8.0; python_version >= "3.5"',
11        "pre-commit==1.13.0",
12    ],
13}
14EXTRAS_REQUIRE["dev"] = EXTRAS_REQUIRE["tests"] + EXTRAS_REQUIRE["lint"] + ["tox"]
15
16
17def find_version(fname):
18    """Attempts to find the version number in the file names fname.
19    Raises RuntimeError if not found.
20    """
21    version = ""
22    with open(fname, "r") as fp:
23        reg = re.compile(r'__version__ = [\'"]([^\'"]*)[\'"]')
24        for line in fp:
25            m = reg.match(line)
26            if m:
27                version = m.group(1)
28                break
29    if not version:
30        raise RuntimeError("Cannot find version information")
31    return version
32
33
34def read(fname):
35    with open(fname) as fp:
36        content = fp.read()
37    return content
38
39
40setup(
41    name="sphinx-issues",
42    version=find_version("sphinx_issues.py"),
43    description="A Sphinx extension for linking to your project's " "issue tracker",
44    long_description=read("README.rst"),
45    install_requires=INSTALL_REQUIRES,
46    extras_require=EXTRAS_REQUIRE,
47    author="Steven Loria",
48    author_email="sloria1@gmail.com",
49    url="https://github.com/sloria/sphinx-issues",
50    license="MIT",
51    keywords="sphinx issues github",
52    classifiers=[
53        "Intended Audience :: Developers",
54        "License :: OSI Approved :: MIT License",
55        "Programming Language :: Python :: 2",
56        "Programming Language :: Python :: 2.7",
57        "Programming Language :: Python :: 3",
58        "Programming Language :: Python :: 3.5",
59        "Programming Language :: Python :: 3.6",
60        "Programming Language :: Python :: 3.7",
61        "Topic :: Software Development :: Documentation",
62    ],
63    py_modules=["sphinx_issues"],
64    project_urls={"Issues": "https://github.com/sloria/sphinx-issues/issues"},
65)
66