-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
108 lines (95 loc) · 2.79 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
"""Setup script for package."""
# pylint: disable=consider-using-with, no-self-use
import os
import re
import sys
from typing import Optional
from setuptools import Command, find_packages, setup
match = re.search(
r'^VERSION\s*=\s*"(.*)"',
open("flake8_plus/version.py", encoding="utf_8").read(),
re.M,
)
VERSION = match.group(1) if match else "???"
with open("README.md", "rb") as f:
LONG_DESCRIPTION = f.read().decode("utf-8")
class VerifyVersion(Command):
"""Command for verifying that git tag matches package version."""
description = "verify that the git tag matches package version"
user_options = []
def initialize_options(self):
"""Implement required method for Command."""
def finalize_options(self):
"""Implement required method for Command."""
def run(self):
"""
Check that the git tag matches the package version.
If it doesn't match, exit.
"""
tag = os.getenv("CIRCLE_TAG")
if not _validate_version(tag, VERSION):
info = f"Git tag: '{tag}' does not match package version: {VERSION}"
sys.exit(info)
def _validate_version(tag: Optional[str], version: str) -> bool:
if not tag:
return version == "0.0.0"
if tag[0] != "v":
return False
return tag[1:] == version
setup(
name="flake8-plus",
version=VERSION,
description="Flake8 plugin adding PEP8-compliant vertical whitespacing rules",
long_description=LONG_DESCRIPTION,
long_description_content_type="text/markdown",
author="Soren Kristiansen",
author_email="sorenlind@mac.com",
url="https://github.com/sorenlind/flake8-plus",
keywords="",
packages=find_packages(),
install_requires=["flake8"],
extras_require={
"dev": [
"astpretty",
"bandit",
"black",
"coverage",
"flake8",
"flake8-annotations",
"flake8-pytest-style",
"mypy",
"pycodestyle",
"pydocstyle",
"pylint",
"rope",
"pyenchant",
"pytest",
"pytest-cov",
"pytest-mock",
"tox",
],
"test": [
"coverage",
"pytest",
"pytest-cov",
"pytest-mock",
"tox",
],
},
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.10",
],
cmdclass={
"verify": VerifyVersion,
},
entry_points={
"flake8.extension": [
"PLU = flake8_plus:Plugin",
],
},
)