-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
50 lines (41 loc) · 1.38 KB
/
Copy pathsetup.py
File metadata and controls
50 lines (41 loc) · 1.38 KB
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
import re
import sys
import setuptools
REQUIREMENTS = [
"flake8>=3.5.0,<4",
"flake8-colors>=0.1.6,<1",
"flake8-import-order>=0.18<1",
"flake8-quotes>=1.0.0<2",
]
# Regex matching version pattern
# (3 numerical values separated by `.`, semver style, followed by an optional pre-release marker)
version_pattern = re.compile(r"\d+\.\d+(\.\d+)?([.-][\w-]+)?")
def get_version():
changelog_file = "CHANGELOG.md"
with open(changelog_file, "r") as fn:
for changelog_line in fn:
version = version_pattern.search(changelog_line)
if version is not None:
return "".join(version.group())
raise RuntimeError("Couldn't find a valid version in {}".format(changelog_file))
if __name__ == "__main__":
if sys.argv[1] == "requirements":
for line in REQUIREMENTS:
print(line)
sys.exit(0)
setuptools.setup(
name="flake8-edited",
description="Edited linter for Python, based on flake8",
version=get_version(),
author="EDITED devs",
author_email="dev@edited.com",
packages=setuptools.find_packages(),
include_package_data=True,
url="https://github.com/EDITD/flake8_edited",
install_requires=REQUIREMENTS,
entry_points={
"console_scripts": [
"elinted = elinted.main:main"
],
},
)